From 9b788055fd2503bb115b120acd5b4bb7d992569b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Thu, 24 Oct 2024 20:48:20 +0200 Subject: [PATCH] fix: ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .github/workflows/ko-publish.yaml | 5 ++++- Makefile | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ko-publish.yaml b/.github/workflows/ko-publish.yaml index 9a519844..8478086c 100644 --- a/.github/workflows/ko-publish.yaml +++ b/.github/workflows/ko-publish.yaml @@ -28,4 +28,7 @@ jobs: - name: Run ko run: | set -e - KO_REGISTRY=ghcr.io/kyverno/kyverno-envoy-plugin make publish-ko + REGISTRY=ghcr.io \ + REGISTRY_USERNAME=${{ github.actor }} \ + REGISTRY_PASSWORD=${{ secrets.GITHUB_TOKEN }} \ + make publish-ko diff --git a/Makefile b/Makefile index ddc1bd84..82b747cb 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ else LD_FLAGS := "-s -w" endif KIND_IMAGE ?= kindest/node:v1.29.2 +REGISTRY ?= ghcr.io +REPO ?= kyverno +IMAGE ?= kyverno-envoy-plugin KO_REGISTRY ?= ko.local KO_TAGS ?= $(GIT_SHA) KO_PLATFORMS ?= all @@ -125,6 +128,10 @@ build: # BUILD (KO) # ############## +.PHONY: ko-login +ko-login: $(KO) + @$(KO) login $(REGISTRY) --username $(REGISTRY_USERNAME) --password $(REGISTRY_PASSWORD) + .PHONY: build-ko build-ko: ## Build Docker image with ko build-ko: fmt @@ -139,7 +146,7 @@ publish-ko: fmt publish-ko: vet publish-ko: $(KO) @echo "Publish Docker image with ko..." >&2 - @LD_FLAGS=$(LD_FLAGS) KO_DOCKER_REPO=$(KO_REGISTRY) $(KO) build . --bare --tags=$(KO_TAGS) --platform=$(KO_PLATFORMS) + @LD_FLAGS=$(LD_FLAGS) KO_DOCKER_REPO=$(REGISTRY)/$(REPO)/$(IMAGE) $(KO) build . --bare --tags=$(KO_TAGS) --platform=$(KO_PLATFORMS) ######## # TEST #