Skip to content

Commit

Permalink
fix makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Mohamed Mahmoud <[email protected]>
  • Loading branch information
msherif1234 committed May 17, 2023
1 parent fb851fd commit 30ae723
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push_image_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: push images
run: IMAGE_ORG=${{ env.ORG }} IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ env.short_sha }} make image-push
- name: build and push manifest
run: IMAGE_ORG=${{ env.ORG }} VERSION=${{ env.VERSION }} make ci-manifest
run: IMAGE_ORG=${{ env.ORG }} IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ env.VERSION }} make ci-manifes
- name: build bundle
run: IMAGE_ORG=${{ env.ORG }} VERSION=${{ env.short_sha }} PLG_VERSION=main FLP_VERSION=main BPF_VERSION=main BUNDLE_VERSION=0.0.0-${{ env.short_sha }} make bundle shortlived-bundle-build
- name: push bundle to quay.io
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ GOBIN=$(shell go env GOBIN)
endif

# Image building tool (docker / podman)
OCI_BIN_PATH = $(shell which podman || which docker)
OCI_BIN ?= $(shell v='$(OCI_BIN_PATH)'; echo "$${v##*/}")
OCI_BIN_PATH := $(shell which podman || which docker)
OCI_BIN ?= $(shell basename ${OCI_BIN_PATH})

DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")

Expand All @@ -114,6 +114,12 @@ define build_target
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETPLATFORM=linux/$(1) --build-arg TARGETARCH=$(1) --build-arg BUILDPLATFORM=linux/amd64 -t ${IMAGE}-$(1) -f Dockerfile .;
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

# push a single arch target image
define push_target
echo 'pushing image ${IMAGE}-$(1)'; \
Expand Down Expand Up @@ -296,8 +302,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
Expand Down

0 comments on commit 30ae723

Please sign in to comment.