diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-05 03:40:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 03:40:19 -0400 |
commit | f1703abea1987b096e0269622e2ad72d1304e878 (patch) | |
tree | 40b0f1d2e0c06cf265d0bd4a0d576f6499db697b /hack | |
parent | bdaac4b2b6573d0954c58da9968536017160b1ed (diff) | |
parent | 8781a3635a045282fac656b2b372ec1010c3b2e4 (diff) | |
download | podman-f1703abea1987b096e0269622e2ad72d1304e878.tar.gz podman-f1703abea1987b096e0269622e2ad72d1304e878.tar.bz2 podman-f1703abea1987b096e0269622e2ad72d1304e878.zip |
Merge pull request #14092 from vrothberg/benchmarks
benchmarks: push/pull
Diffstat (limited to 'hack')
-rw-r--r-- | hack/podman-registry-go/registry.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/hack/podman-registry-go/registry.go b/hack/podman-registry-go/registry.go index 095f6fb18..af8f3117c 100644 --- a/hack/podman-registry-go/registry.go +++ b/hack/podman-registry-go/registry.go @@ -31,10 +31,31 @@ type Registry struct { running bool } +// Options allows for customizing a registry. +type Options struct { + // Image - custom registry image. + Image string +} + // Start a new registry and return it along with it's image, user, password, and port. func Start() (*Registry, error) { + return StartWithOptions(nil) +} + +// StartWithOptions a new registry and return it along with it's image, user, password, and port. +func StartWithOptions(options *Options) (*Registry, error) { + if options == nil { + options = &Options{} + } + + var args []string + if options.Image != "" { + args = append(args, "-i", options.Image) + } + args = append(args, "start") + // Start a registry. - out, err := utils.ExecCmd(binary, "start") + out, err := utils.ExecCmd(binary, args...) if err != nil { return nil, errors.Wrapf(err, "error running %q: %s", binary, out) } |