diff --git a/cmd/buildah/manifest.go b/cmd/buildah/manifest.go index b3a8ad62cbf..233ccf9b5b5 100644 --- a/cmd/buildah/manifest.go +++ b/cmd/buildah/manifest.go @@ -210,7 +210,7 @@ func init() { return manifestPushCmd(cmd, args, manifestPushOpts) }, Example: `buildah manifest push mylist:v1.11 transport:imageName`, - Args: cobra.MinimumNArgs(2), + Args: cobra.MinimumNArgs(1), } manifestPushCommand.SetUsageTemplate(UsageTemplate()) flags = manifestPushCommand.Flags() @@ -830,20 +830,20 @@ func manifestPushCmd(c *cobra.Command, args []string, opts pushOptions) error { case 0: return errors.New("At least a source list ID must be specified") case 1: - return errors.New("Two arguments are necessary to push: source and destination") + listImageSpec = args[0] + destSpec = "docker://"+listImageSpec case 2: listImageSpec = args[0] destSpec = args[1] - if listImageSpec == "" { - return fmt.Errorf(`invalid image name "%s"`, listImageSpec) - } - if destSpec == "" { - return fmt.Errorf(`invalid image name "%s"`, destSpec) - } default: return errors.New("Only two arguments are necessary to push: source and destination") } - + if listImageSpec == "" { + return fmt.Errorf(`invalid image name "%s"`, listImageSpec) + } + if destSpec == "" { + return fmt.Errorf(`invalid image name "%s"`, destSpec) + } store, err := getStore(c) if err != nil { return err diff --git a/tests/push.bats b/tests/push.bats index 73450a59b5a..aaa48dbed43 100644 --- a/tests/push.bats +++ b/tests/push.bats @@ -199,6 +199,10 @@ load helpers run_buildah login --authfile ${TEST_SCRATCH_DIR}/tmp/test.auth --username testuser --password testpassword --tls-verify=false localhost:${REGISTRY_PORT} run_buildah push --authfile ${TEST_SCRATCH_DIR}/tmp/test.auth $WITH_POLICY_JSON --tls-verify=false busybox docker://localhost:${REGISTRY_PORT}/buildah/busybox:latest expect_output --substring "Copying" + + run_buildah manifest create localhost:${REGISTRY_PORT}/testmanifest + run_buildah manifest push --authfile ${TEST_SCRATCH_DIR}/tmp/test.auth $WITH_POLICY_JSON --tls-verify=false localhost:${REGISTRY_PORT}/testmanifest + expect_output --substring "Writing manifest list to image destination" } @test "push with --quiet" {