Skip to content

Commit aa6a740

Browse files
Merge pull request #32 from galal-hussein/fixing_tag
Fix passing the tag to build-args
2 parents d477dd3 + 354ec07 commit aa6a740

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

.github/workflows/build.yml

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
push: false
2828
tags: rancher/hardened-crictl:${{ env.TAG }}-amd64
2929
file: Dockerfile
30+
build-args: |
31+
TAG=${{ env.TAG }}
3032
3133
- name: Run Trivy vulnerability scanner
3234
uses: aquasecurity/trivy-action@0.21.0
@@ -68,3 +70,5 @@ jobs:
6870
file: Dockerfile
6971
outputs: type=docker
7072
platforms: linux/arm64
73+
build-args: |
74+
TAG=${{ env.TAG }}

.github/workflows/image-push.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ on:
33
types: [published]
44

55
permissions:
6-
contents: read
6+
contents: read
7+
8+
env:
9+
GITHUB_ACTION_TAG: ${{ github.ref_name }}
710

811
jobs:
912
push-multiarch:
@@ -15,6 +18,11 @@ jobs:
1518
- name: Check out code
1619
uses: actions/checkout@v4
1720

21+
- name: Set the TAG value
22+
id: get-TAG
23+
run: |
24+
echo "$(make -s log | grep TAG)" >> "$GITHUB_ENV"
25+
1826
- name: Set up QEMU
1927
uses: docker/setup-qemu-action@v3
2028

@@ -42,3 +50,5 @@ jobs:
4250
tags: rancher/hardened-crictl:${{ github.event.release.tag_name }}
4351
file: Dockerfile
4452
platforms: linux/amd64, linux/arm64
53+
build-args: |
54+
TAG=${{ env.TAG }}

Makefile

+8-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ BUILD_META=-build$(shell TZ=UTC date +%Y%m%d)
1414
ORG ?= rancher
1515
PKG ?= github.com/kubernetes-sigs/cri-tools
1616
SRC ?= github.com/kubernetes-sigs/cri-tools
17-
TAG ?= v1.26.1$(BUILD_META)
17+
TAG ?= ${GITHUB_ACTION_TAG}
18+
19+
ifeq ($(TAG),)
20+
TAG := v1.26.1$(BUILD_META)
21+
endif
1822

1923
ifeq (,$(filter %$(BUILD_META),$(TAG)))
2024
$(error TAG needs to end with build metadata: $(BUILD_META))
@@ -44,12 +48,13 @@ image-push:
4448
image-scan:
4549
trivy --severity $(SEVERITIES) --no-progress --ignore-unfixed $(ORG)/hardened-crictl:$(TAG)
4650

47-
PHONY: log
51+
.PHONY: log
4852
log:
4953
@echo "ARCH=$(ARCH)"
50-
@echo "TAG=$(TAG)"
54+
@echo "TAG=$(TAG:$(BUILD_META)=)"
5155
@echo "ORG=$(ORG)"
5256
@echo "PKG=$(PKG)"
5357
@echo "SRC=$(SRC)"
5458
@echo "BUILD_META=$(BUILD_META)"
5559
@echo "UNAME_M=$(UNAME_M)"
60+
@echo "GOLANG_VERSION=$(GOLANG_VERSION)"

0 commit comments

Comments
 (0)