Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ko #132

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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