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 <[email protected]>
  • Loading branch information
galal-hussein committed Jun 6, 2024
1 parent 9cee56c commit cb64e60
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-whereabouts:${{ env.TAG }}-amd64
file: Dockerfile
build-args: |
TAG=${{ env.TAG }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
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-whereabouts:${{ 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 @@ -14,7 +14,11 @@ BUILD_META=-build$(shell date +%Y%m%d)
ORG ?= rancher
PKG ?= github.com/k8snetworkplumbingwg/whereabouts
SRC ?= github.com/k8snetworkplumbingwg/whereabouts
TAG ?= v0.7.0$(BUILD_META)
TAG ?= ${GITHUB_ACTION_TAG}

ifeq ($(TAG),)
TAG := v0.7.0$(BUILD_META)
endif

ifeq (,$(filter %$(BUILD_META),$(TAG)))
$(error TAG $(TAG) needs to end with build metadata: $(BUILD_META))
Expand Down Expand Up @@ -45,7 +49,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 cb64e60

Please sign in to comment.