Skip to content

Commit

Permalink
Fix passing the tag to build-args
Browse files Browse the repository at this point in the history
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
  • Loading branch information
galal-hussein committed Jun 6, 2024
1 parent 419a160 commit 8518aa4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
push: false
tags: rancher/hardened-ib-sriov-cni:${{ env.TAG }}-amd64
file: Dockerfile
build-args: |
TAG=${{ env.TAG }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.21.0
Expand Down Expand Up @@ -68,3 +70,5 @@ jobs:
file: Dockerfile
outputs: type=docker
platforms: linux/arm64
build-args: |
TAG=${{ env.TAG }}
10 changes: 10 additions & 0 deletions .github/workflows/image-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
permissions:
contents: read

env:
GITHUB_ACTION_TAG: ${{ github.ref_name }}

jobs:
push-multiarch:
permissions:
Expand All @@ -15,6 +18,11 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set the TAG value
id: get-TAG
run: |
echo "$(make -s log | grep TAG)" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down Expand Up @@ -42,3 +50,5 @@ jobs:
tags: rancher/hardened-ib-sriov-cni:${{ github.event.release.tag_name }}
file: Dockerfile
platforms: linux/amd64, linux/arm64
build-args: |
TAG=${{ env.TAG }}
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ endif

BUILD_META=-build$(shell date +%Y%m%d)
ORG ?= rancher
TAG ?= v1.0.3$(BUILD_META)
TAG ?= ${GITHUB_ACTION_TAG}

ifeq ($(TAG),)
TAG := v1.0.3$(BUILD_META)
endif

ifeq (,$(filter %$(BUILD_META),$(TAG)))
$(error TAG $(TAG) needs to end with build metadata: $(BUILD_META))
Expand Down Expand Up @@ -41,7 +45,7 @@ image-scan:
PHONY: log
log:
@echo "ARCH=$(ARCH)"
@echo "TAG=$(TAG)"
@echo "TAG=$(TAG:$(BUILD_META)=)"
@echo "ORG=$(ORG)"
@echo "PKG=$(PKG)"
@echo "SRC=$(SRC)"
Expand Down

0 comments on commit 8518aa4

Please sign in to comment.