From 813a96cf753c6cbf63e73b485ee02334bb43d9ba Mon Sep 17 00:00:00 2001 From: Mohamed Mahmoud Date: Wed, 17 May 2023 19:19:03 -0400 Subject: [PATCH] fix makefile Signed-off-by: Mohamed Mahmoud --- .github/workflows/push_image_pr.yml | 3 +-- Makefile | 13 ++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push_image_pr.yml b/.github/workflows/push_image_pr.yml index 1a6c231e0..31c55b997 100644 --- a/.github/workflows/push_image_pr.yml +++ b/.github/workflows/push_image_pr.yml @@ -8,7 +8,6 @@ env: REGISTRY: quay.io/netobserv IMAGE: flowlogs-pipeline ORG: netobserv - VERSION: temp jobs: push-pr-image: @@ -40,7 +39,7 @@ jobs: - name: build and push images run: IMAGE_ORG=${{ env.ORG }} OCI_BIN=docker IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ env.short_sha }} make images - name: build and push manifest - run: IMAGE_ORG=${{ env.ORG }} OCI_BIN=docker VERSION=${{ env.VERSION }} make ci-manifest + run: IMAGE_ORG=${{ env.ORG }} OCI_BIN=docker IMAGE=${{ env.REGISTRY }}/${{ env.short_sha }}:${{ env.short_sha }} make ci-manifest - uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} diff --git a/Makefile b/Makefile index ebfc51891..d523c4612 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ IMAGE_SHA = $(IMAGE_TAG_BASE):$(BUILD_SHA) # Image building tool (docker / podman) OCI_BIN_PATH = $(shell which podman || which docker) -OCI_BIN ?= $(shell v='$(OCI_BIN_PATH)'; echo "$${v##*/}") +OCI_BIN ?= $(shell basename ${OCI_BIN_PATH}) MIN_GO_VERSION := 1.18.0 FLP_BIN_FILE=flowlogs-pipeline @@ -69,6 +69,12 @@ define push_target DOCKER_BUILDKIT=1 $(OCI_BIN) push ${IMAGE}-$(1); endef +# manifest create a single arch target provided as argument +define manifest_create_target + echo 'manifest create for arch $(1)'; \ + DOCKER_BUILDKIT=1 $(OCI_BIN) manifest add ${IMAGE} ${IMAGE}-$(target); +endef + ##@ General # The help target prints out all targets with their descriptions organized @@ -168,8 +174,9 @@ image-push: ## Push MULTIARCH_TARGETS images .PHONY: manifest-build manifest-build: ## Build MULTIARCH_TARGETS manifest - @echo 'building manifest $(IMAGE)' - DOCKER_BUILDKIT=1 $(OCI_BIN) manifest create ${IMAGE} $(foreach target,$(MULTIARCH_TARGETS),--amend ${IMAGE}-$(target)); + trap 'exit' INT; \ + DOCKER_BUILDKIT=1 $(OCI_BIN) manifest create ${IMAGE} + $(foreach target,$(MULTIARCH_TARGETS),$(call manifest_create_target,$(target))) .PHONY: manifest-push manifest-push: ## Push MULTIARCH_TARGETS manifest