Skip to content

Commit df74c48

Browse files
authored
build(image): overwrite base image annotations (#6076)
1 parent 8e7be63 commit df74c48

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ else
1212
endif
1313
COMMIT_TIMESTAMP := $(shell $(CMD_GIT) show --no-patch --format=%ct)-
1414
ifeq ($(GITHUB_SHA),)
15-
COMMIT := $(shell $(CMD_GIT) rev-parse --short=8 HEAD)
15+
COMMIT := $(shell $(CMD_GIT) rev-parse HEAD)
16+
COMMIT_SHORT := $(shell $(CMD_GIT) rev-parse --short=8 HEAD)
1617
else
17-
COMMIT := $(shell echo $(GITHUB_SHA) | cut -c1-8)
18+
COMMIT := $(GITHUB_SHA)
19+
COMMIT_SHORT := $(shell echo $(GITHUB_SHA) | cut -c1-8)
1820
endif
19-
VERSION ?= $(if $(RELEASE_TAG),$(RELEASE_TAG),$(shell $(CMD_GIT) describe --tags --match='v*' || echo '$(subst /,-,$(BRANCH))$(COMMIT_TIMESTAMP)$(COMMIT)'))
21+
VERSION ?= $(if $(RELEASE_TAG),$(RELEASE_TAG),$(shell $(CMD_GIT) describe --tags --match='v*' || echo '$(subst /,-,$(BRANCH))$(COMMIT_TIMESTAMP)$(COMMIT_SHORT)'))
2022
OUT_DOCKER ?= ghcr.io/parca-dev/parca
2123

2224
ENABLE_RACE := no
@@ -154,6 +156,11 @@ container-dev:
154156
.PHONY: container
155157
container:
156158
podman build \
159+
--annotation "org.opencontainers.image.created=1970-01-01T00:00:00Z" \
160+
--annotation "org.opencontainers.image.revision=$(COMMIT)" \
161+
--annotation "org.opencontainers.image.source=https://github.com/parca-dev/parca" \
162+
--annotation "org.opencontainers.image.url=https://github.com/parca-dev/parca" \
163+
--annotation "org.opencontainers.image.version=$(VERSION)" \
157164
--platform linux/amd64,linux/arm64 \
158165
--timestamp 0 \
159166
--manifest $(OUT_DOCKER):$(VERSION) .
@@ -165,7 +172,7 @@ push-container:
165172
.PHONY: sign-container
166173
sign-container:
167174
crane digest $(OUT_DOCKER):$(VERSION)
168-
cosign sign --yes -a GIT_HASH=$(COMMIT) -a GIT_VERSION=$(VERSION) $(OUT_DOCKER)@$(shell crane digest $(OUT_DOCKER):$(VERSION))
175+
cosign sign --yes -a GIT_HASH=$(COMMIT_SHORT) -a GIT_VERSION=$(VERSION) $(OUT_DOCKER)@$(shell crane digest $(OUT_DOCKER):$(VERSION))
169176

170177
.PHONY: push-quay-container
171178
push-quay-container:

0 commit comments

Comments
 (0)