Skip to content

Commit

Permalink
fix: ko
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly committed Oct 24, 2024
1 parent c35fa97 commit b3a449c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ko-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ on:
jobs:
ko-publish:
permissions:
contents: write
id-token: write
packages: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -28,4 +26,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
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -137,9 +144,10 @@ build-ko: $(KO)
publish-ko: ## Publish Docker image with ko
publish-ko: fmt
publish-ko: vet
publish-ko: ko-login
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 #
Expand Down

0 comments on commit b3a449c

Please sign in to comment.