Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename 'layer' as 'image' in stacker publish path #583

Merged
merged 1 commit into from
Jan 12, 2024
Merged
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
6 changes: 3 additions & 3 deletions cmd/stacker/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
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,
Expand Down Expand Up @@ -127,7 +127,7 @@
Progress: shouldShowProgress(ctx),
SkipTLS: ctx.Bool("skip-tls"),
LayerTypes: layerTypes,
Layers: ctx.StringSlice("layer"),
Images: ctx.StringSlice("image"),

Check warning on line 130 in cmd/stacker/publish.go

View check run for this annotation

Codecov / codecov/patch

cmd/stacker/publish.go#L130

Added line #L130 was not covered by tests
}

var stackerFiles []string
Expand Down
6 changes: 3 additions & 3 deletions pkg/stacker/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
Progress bool
SkipTLS bool
LayerTypes []types.LayerType
Layers []string
Images []string
}

// Publisher is responsible for publishing the layers based on stackerfiles
Expand Down Expand Up @@ -377,9 +377,9 @@
log.Infof("will not publish: %s build_only %s", file, name)
continue
}
if len(p.opts.Layers) > 0 {
if len(p.opts.Images) > 0 {

Check warning on line 380 in pkg/stacker/publisher.go

View check run for this annotation

Codecov / codecov/patch

pkg/stacker/publisher.go#L380

Added line #L380 was not covered by tests
found := false
for _, lname := range p.opts.Layers {
for _, lname := range p.opts.Images {

Check warning on line 382 in pkg/stacker/publisher.go

View check run for this annotation

Codecov / codecov/patch

pkg/stacker/publisher.go#L382

Added line #L382 was not covered by tests
if lname == name {
found = true
break
Expand Down
8 changes: 4 additions & 4 deletions test/convert.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/publish.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading