Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/buildah/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func manifestInit() {
flags := manifestCreateCommand.Flags()
flags.BoolVar(&manifestCreateOpts.all, "all", false, "add all of the lists' images if the images to add are lists")
flags.BoolVar(&manifestCreateOpts.amend, "amend", false, "modify an existing list if one with the desired name already exists")
flags.StringSliceVar(&manifestCreateOpts.annotations, "annotation", nil, "set an `annotation` for the image index")
flags.StringArrayVar(&manifestCreateOpts.annotations, "annotation", nil, "set an `annotation` for the image index")
flags.StringVar(&manifestCreateOpts.os, "os", "", "if any of the specified images is a list, choose the one for `os`")
if err := flags.MarkHidden("os"); err != nil {
panic(fmt.Sprintf("error marking --os as hidden: %v", err))
Expand Down Expand Up @@ -213,7 +213,7 @@ func manifestInit() {
flags.StringVar(&manifestAnnotateOpts.osVersion, "os-version", "", "override the os `version` of the specified image")
flags.StringSliceVar(&manifestAnnotateOpts.features, "features", nil, "override the `features` of the specified image")
flags.StringSliceVar(&manifestAnnotateOpts.osFeatures, "os-features", nil, "override the os `features` of the specified image")
flags.StringSliceVar(&manifestAnnotateOpts.annotations, "annotation", nil, "set an `annotation` for the specified image")
flags.StringArrayVar(&manifestAnnotateOpts.annotations, "annotation", nil, "set an `annotation` for the specified image")
flags.StringVar(&manifestAnnotateOpts.subject, "subject", "", "set a subject for the image index")
manifestAnnotateCommand.SetUsageTemplate(UsageTemplate())
manifestCommand.AddCommand(manifestAnnotateCommand)
Expand Down
12 changes: 8 additions & 4 deletions tests/lists.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ IMAGE_LIST_S390X_INSTANCE_DIGEST=sha256:882a20ee0df7399a445285361d38b711c299ca09
assert "$output" =~ "that name is already in use"
run_buildah manifest create --amend foo
assert "$output" == "$listid"
run_buildah manifest create --amend --annotation red=blue foo busybox
run_buildah manifest create --amend --annotation red=blue --annotation green=yellow,orange,purple foo busybox
assert "$output" == "$listid"
run_buildah manifest inspect foo
assert "$output" =~ '"red": "blue"'
assert "$output" =~ '"green": "yellow,orange,purple"'
assert "$output" =~ "${imagedigest}"
# since manifest exists in local storage this should exit with `0`
run_buildah manifest exists foo
Expand Down Expand Up @@ -60,10 +61,11 @@ IMAGE_LIST_S390X_INSTANCE_DIGEST=sha256:882a20ee0df7399a445285361d38b711c299ca09
digest="${output##* }"
alg="${digest%%:*}"
encoded="${digest##*:}"
run_buildah manifest annotate --annotation red=blue foo $TEST_SCRATCH_DIR/randomfile
run_buildah manifest annotate --annotation red=blue --annotation green=yellow,orange,purple foo $TEST_SCRATCH_DIR/randomfile
run_buildah manifest inspect foo
assert "$output" =~ '"image/png"'
assert "$output" =~ '"red": "blue"'
assert "$output" =~ '"green": "yellow,orange,purple"'
run_buildah manifest push --all foo oci:$TEST_SCRATCH_DIR/pushed
run cmp $TEST_SCRATCH_DIR/randomfile $TEST_SCRATCH_DIR/pushed/blobs/sha256/$blobencoded
assert "$status" -eq 0 "pushed copy of random file did not match original"
Expand Down Expand Up @@ -120,24 +122,26 @@ IMAGE_LIST_S390X_INSTANCE_DIGEST=sha256:882a20ee0df7399a445285361d38b711c299ca09
_prefetch busybox
run_buildah manifest create foo
run_buildah manifest add foo busybox
run_buildah manifest annotate --index --annotation red=blue foo
run_buildah manifest annotate --index --annotation red=blue --annotation green=yellow,orange,purple foo
run_buildah manifest inspect foo
assert "$output" =~ '"red": "blue"'
assert "$output" =~ '"green": "yellow,orange,purple"'
}

@test "manifest-annotate instance annotation" {
_prefetch busybox
run_buildah manifest create foo
run_buildah manifest add foo busybox
instance="${output##* }"
run_buildah manifest annotate --annotation red=blue foo "${instance}"
run_buildah manifest annotate --annotation red=blue --annotation green=yellow,orange,purple foo "${instance}"
run_buildah manifest annotate --os OperatingSystem foo "${instance}"
run_buildah manifest annotate --arch aRCHITECTURE foo "${instance}"
run_buildah manifest annotate --variant vARIANT foo "${instance}"
run_buildah manifest annotate --features FEATURE1 --features FEATURE2 foo "${instance}"
run_buildah manifest annotate --os-features OSFEATURE1 --os-features OSFEATURE2 foo "${instance}"
run_buildah manifest inspect foo
assert "$output" =~ '"red": "blue"'
assert "$output" =~ '"green": "yellow,orange,purple"'
assert "$output" =~ '"os": "OperatingSystem"'
assert "$output" =~ '"architecture": "aRCHITECTURE"'
assert "$output" =~ '"variant": "vARIANT"'
Expand Down
Loading