Skip to content

Commit

Permalink
Merge pull request #4767 from flouthoc/manifest-push-merge-dest
Browse files Browse the repository at this point in the history
manifest, push: use `source` as `destination` if not specified
  • Loading branch information
openshift-merge-robot authored May 4, 2023
2 parents e925b58 + d5b32b0 commit 77a8dfc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cmd/buildah/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/push.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 77a8dfc

Please sign in to comment.