diff --git a/cmd/stacker/publish.go b/cmd/stacker/publish.go index c4ae6807..30c9acaa 100644 --- a/cmd/stacker/publish.go +++ b/cmd/stacker/publish.go @@ -73,8 +73,8 @@ var publishCmd = cli.Command{ Value: cli.NewStringSlice("tar"), }, &cli.StringSliceFlag{ - Name: "layer", - Usage: "layer to be published; can be specified multiple times", + Name: "image", + Usage: "specific image to be published when a stacker file has many images; can be specified multiple times", }, }, Before: beforePublish, @@ -127,7 +127,7 @@ func doPublish(ctx *cli.Context) error { Progress: shouldShowProgress(ctx), SkipTLS: ctx.Bool("skip-tls"), LayerTypes: layerTypes, - Layers: ctx.StringSlice("layer"), + Images: ctx.StringSlice("image"), } var stackerFiles []string diff --git a/pkg/stacker/publisher.go b/pkg/stacker/publisher.go index a837c485..8d64a6e6 100644 --- a/pkg/stacker/publisher.go +++ b/pkg/stacker/publisher.go @@ -40,7 +40,7 @@ type PublishArgs struct { Progress bool SkipTLS bool LayerTypes []types.LayerType - Layers []string + Images []string } // Publisher is responsible for publishing the layers based on stackerfiles @@ -377,9 +377,9 @@ func (p *Publisher) Publish(file string) error { log.Infof("will not publish: %s build_only %s", file, name) continue } - if len(p.opts.Layers) > 0 { + if len(p.opts.Images) > 0 { found := false - for _, lname := range p.opts.Layers { + for _, lname := range p.opts.Images { if lname == name { found = true break diff --git a/test/convert.bats b/test/convert.bats index 860a0aff..5207a7ad 100644 --- a/test/convert.bats +++ b/test/convert.bats @@ -42,7 +42,7 @@ EOF if [ -z "${REGISTRY_URL}" ]; then skip "test because no registry found in REGISTRY_URL env variable" fi - stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=app --skip-tls --url docker://${REGISTRY_URL} --layer app --tag latest + stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=app --skip-tls --url docker://${REGISTRY_URL} --image app --tag latest rm -f stacker.yaml stacker-subs.yaml stacker clean } @@ -56,7 +56,7 @@ EOF stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --substitute STACKER_VOL1="$TEMPDIR" if [ -nz "${REGISTRY_URL}" ]; then - stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --substitute STACKER_VOL1="$TEMPDIR" --skip-tls --url docker://${REGISTRY_URL} --layer alpine --tag latest + stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --substitute STACKER_VOL1="$TEMPDIR" --skip-tls --url docker://${REGISTRY_URL} --image alpine --tag latest fi rm -f stacker.yaml stacker-subs.yaml stacker clean @@ -70,7 +70,7 @@ EOF stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=elasticsearch if [ -nz "${REGISTRY_URL}" ]; then - stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=elasticsearch --skip-tls --url docker://${REGISTRY_URL} --layer elasticsearch --tag latest + stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=elasticsearch --skip-tls --url docker://${REGISTRY_URL} --image elasticsearch --tag latest fi rm -f stacker.yaml stacker-subs.yaml stacker clean @@ -84,7 +84,7 @@ EOF stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=python if [ -nz "${REGISTRY_URL}" ]; then - stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=python --skip-tls --url docker://${REGISTRY_URL} --layer python --tag latest + stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=python --skip-tls --url docker://${REGISTRY_URL} --image python --tag latest fi rm -f stacker.yaml stacker-subs.yaml stacker clean diff --git a/test/publish.bats b/test/publish.bats index e4e684c4..159bcb9d 100644 --- a/test/publish.bats +++ b/test/publish.bats @@ -118,7 +118,7 @@ function teardown() { @test "publish selected multiple layers" { stacker recursive-build -d ocibuilds - stacker publish -d ocibuilds --url oci:oci_publish --tag test1 --layer layer1 --layer layer6 + stacker publish -d ocibuilds --url oci:oci_publish --tag test1 --image layer1 --image layer6 # Unpack published image and check content umoci unpack --image oci_publish:layer1_test1 dest/layer1_test1