diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5fd6d07..46bf475 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,8 @@ jobs: push: false tags: rancher/hardened-sriov-network-device-plugin:${{ env.TAG }}-amd64 file: Dockerfile + build-args: | + TAG=${{ env.TAG }} - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@0.21.0 @@ -68,3 +70,5 @@ jobs: file: Dockerfile outputs: type=docker platforms: linux/arm64 + build-args: | + TAG=${{ env.TAG }} diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml index 4ab5aea..4130a8d 100644 --- a/.github/workflows/image-push.yml +++ b/.github/workflows/image-push.yml @@ -5,6 +5,9 @@ on: permissions: contents: read +env: + GITHUB_ACTION_TAG: ${{ github.ref_name }} + jobs: push-multiarch: permissions: @@ -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 @@ -42,3 +50,5 @@ jobs: tags: rancher/hardened-sriov-network-device-plugin:${{ github.event.release.tag_name }} file: Dockerfile platforms: linux/amd64, linux/arm64 + build-args: | + TAG=${{ env.TAG }} diff --git a/Makefile b/Makefile index ef8f58d..83ae93c 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,12 @@ endif BUILD_META=-build$(shell date +%Y%m%d) ORG ?= rancher # last commit on 2021-10-06 -TAG ?= v3.6.2$(BUILD_META) +TAG ?= ${GITHUB_ACTION_TAG} + +ifeq ($(TAG),) +TAG := v3.6.2$(BUILD_META) +endif + ifeq (,$(filter %$(BUILD_META),$(TAG))) $(error TAG $(TAG) needs to end with build metadata: $(BUILD_META)) @@ -42,7 +47,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)"