Skip to content

Commit e42a582

Browse files
refactor(build): skip duplicate versioned tag when it matches IMAGE_TAG
On release builds IMAGE_TAG = github.ref_name = vX.Y.Z, and Makefiles that pass v$(COZYSTACK_VERSION) as the versioned arg evaluate to the same vX.Y.Z on the tag commit. The macro then emitted `--tag :vX.Y.Z --tag :vX.Y.Z --tag :latest`. docker buildx dedupes internally so there is no functional impact, but the build logs carried the redundant flag for every affected package. Replace the empty-string guard with filter-out so the versioned tag is also skipped when it would duplicate IMAGE_TAG. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 1bcaa3d commit e42a582

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎hack/common-envs.mk‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ BUILDX_ARGS := --provenance=false --push=$(PUSH) --load=$(LOAD) \
3737
# image-tags <repo> <versioned-tag>
3838
# Expands to one or more `--tag` flags for `docker buildx build`:
3939
# - always: :$(IMAGE_TAG) (build-unique handle)
40-
# - if PUBLISH_VERSIONED=1: :<versioned-tag> (skipped when arg2 is empty)
40+
# - if PUBLISH_VERSIONED=1: :<versioned-tag> (skipped when arg2 is empty
41+
# or equals IMAGE_TAG)
4142
# - if PUBLISH_FLOATING=1: :latest
4243
# Consumers reference images by digest, so the build-unique tag is enough
4344
# for cluster-side pulls; the versioned and floating tags exist for human
4445
# discoverability and downstream tooling on releases.
4546
define image-tags
46-
--tag $(REGISTRY)/$(1):$(IMAGE_TAG)$(if $(filter 1,$(PUBLISH_VERSIONED)),$(if $(strip $(2)), --tag $(REGISTRY)/$(1):$(strip $(2))))$(if $(filter 1,$(PUBLISH_FLOATING)), --tag $(REGISTRY)/$(1):latest)
47+
--tag $(REGISTRY)/$(1):$(IMAGE_TAG)$(if $(filter 1,$(PUBLISH_VERSIONED)),$(if $(filter-out $(IMAGE_TAG),$(strip $(2))), --tag $(REGISTRY)/$(1):$(strip $(2))))$(if $(filter 1,$(PUBLISH_FLOATING)), --tag $(REGISTRY)/$(1):latest)
4748
endef
4849

4950
ifeq ($(COZYSTACK_VERSION),)

0 commit comments

Comments
 (0)