mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
chore: enable overriding images repo (#4694)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
073ff38cc9
commit
332a5aa01f
2 changed files with 26 additions and 26 deletions
4
.github/workflows/reuse.yaml
vendored
4
.github/workflows/reuse.yaml
vendored
|
@ -110,7 +110,7 @@ jobs:
|
||||||
if: ${{inputs.tag == 'image' && steps.extract_branch.outputs.branch == 'main'}}
|
if: ${{inputs.tag == 'image' && steps.extract_branch.outputs.branch == 'main'}}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
echo "::set-output name=digest::$(REGISTRY=ghcr.io REGISTRY_PASSWORD=${{secrets.registry_password}} make ${{inputs.publish_command}}-dev)"
|
echo "::set-output name=digest::$(REGISTRY=ghcr.io REPO=${{ github.repository_owner }} REGISTRY_PASSWORD=${{secrets.registry_password}} make ${{inputs.publish_command}}-dev)"
|
||||||
|
|
||||||
- name: ko build release image
|
- name: ko build release image
|
||||||
id: ko-publish
|
id: ko-publish
|
||||||
|
@ -119,7 +119,7 @@ jobs:
|
||||||
if: ${{inputs.tag == 'release' || (inputs.tag == 'image' && steps.check-branch.outputs.match == 'true')}}
|
if: ${{inputs.tag == 'release' || (inputs.tag == 'image' && steps.check-branch.outputs.match == 'true')}}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
echo "::set-output name=digest::$(REGISTRY=ghcr.io REGISTRY_PASSWORD=${{secrets.registry_password}} make ${{inputs.publish_command}})"
|
echo "::set-output name=digest::$(REGISTRY=ghcr.io REPO=${{ github.repository_owner }} REGISTRY_PASSWORD=${{secrets.registry_password}} make ${{inputs.publish_command}})"
|
||||||
|
|
||||||
- name: Sign dev image
|
- name: Sign dev image
|
||||||
if: ${{inputs.tag == 'image' && steps.extract_branch.outputs.branch == 'main'}}
|
if: ${{inputs.tag == 'image' && steps.extract_branch.outputs.branch == 'main'}}
|
||||||
|
|
48
Makefile
48
Makefile
|
@ -11,7 +11,7 @@ GIT_HASH := $(GIT_BRANCH)/$(shell git log -1 --pretty=format:"%H")
|
||||||
TIMESTAMP := $(shell date '+%Y-%m-%d_%I:%M:%S%p')
|
TIMESTAMP := $(shell date '+%Y-%m-%d_%I:%M:%S%p')
|
||||||
VERSION ?= $(shell git describe --match "v[0-9]*")
|
VERSION ?= $(shell git describe --match "v[0-9]*")
|
||||||
REGISTRY ?= ghcr.io
|
REGISTRY ?= ghcr.io
|
||||||
REPO = $(REGISTRY)/kyverno
|
REPO ?= kyverno
|
||||||
IMAGE_TAG_LATEST_DEV = $(shell git describe --match "[0-9].[0-9]-dev*" | cut -d '-' -f-2)
|
IMAGE_TAG_LATEST_DEV = $(shell git describe --match "[0-9].[0-9]-dev*" | cut -d '-' -f-2)
|
||||||
IMAGE_TAG_DEV = $(GIT_VERSION_DEV)
|
IMAGE_TAG_DEV = $(GIT_VERSION_DEV)
|
||||||
IMAGE_TAG ?= $(GIT_VERSION)
|
IMAGE_TAG ?= $(GIT_VERSION)
|
||||||
|
@ -23,6 +23,12 @@ GOOS ?= $(shell go env GOOS)
|
||||||
GOARCH ?= $(shell go env GOARCH)
|
GOARCH ?= $(shell go env GOARCH)
|
||||||
KOCACHE ?= /tmp/ko-cache
|
KOCACHE ?= /tmp/ko-cache
|
||||||
BUILD_WITH ?= ko
|
BUILD_WITH ?= ko
|
||||||
|
KYVERNOPRE_IMAGE := kyvernopre
|
||||||
|
KYVERNO_IMAGE := kyverno
|
||||||
|
CLI_IMAGE := kyverno-cli
|
||||||
|
REPO_KYVERNOPRE := $(REGISTRY)/$(REPO)/$(KYVERNOPRE_IMAGE)
|
||||||
|
REPO_KYVERNO := $(REGISTRY)/$(REPO)/$(KYVERNO_IMAGE)
|
||||||
|
REPO_CLI := $(REGISTRY)/$(REPO)/$(CLI_IMAGE)
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# TOOLS #
|
# TOOLS #
|
||||||
|
@ -160,9 +166,6 @@ PLATFORMS := linux/amd64,linux/arm64,linux/s390x
|
||||||
LOCAL_PLATFORM := linux/$(GOARCH)
|
LOCAL_PLATFORM := linux/$(GOARCH)
|
||||||
KO_TAGS := latest,$(IMAGE_TAG)
|
KO_TAGS := latest,$(IMAGE_TAG)
|
||||||
KO_TAGS_DEV := latest,$(IMAGE_TAG_DEV)
|
KO_TAGS_DEV := latest,$(IMAGE_TAG_DEV)
|
||||||
KYVERNOPRE_IMAGE := kyvernopre
|
|
||||||
KYVERNO_IMAGE := kyverno
|
|
||||||
CLI_IMAGE := kyverno-cli
|
|
||||||
|
|
||||||
.PHONY: ko-build-kyvernopre
|
.PHONY: ko-build-kyvernopre
|
||||||
ko-build-kyvernopre: $(KO) ## Build kyvernopre local image (with ko)
|
ko-build-kyvernopre: $(KO) ## Build kyvernopre local image (with ko)
|
||||||
|
@ -186,9 +189,6 @@ ko-build-all: ko-build-kyvernopre ko-build-kyverno ko-build-cli ## Build all loc
|
||||||
# PUBLISH (KO) #
|
# PUBLISH (KO) #
|
||||||
################
|
################
|
||||||
|
|
||||||
REPO_KYVERNOPRE := $(REPO)/$(KYVERNOPRE_IMAGE)
|
|
||||||
REPO_KYVERNO := $(REPO)/$(KYVERNO_IMAGE)
|
|
||||||
REPO_CLI := $(REPO)/$(CLI_IMAGE)
|
|
||||||
REGISTRY_USERNAME ?= dummy
|
REGISTRY_USERNAME ?= dummy
|
||||||
KO_KYVERNOPRE_IMAGE := ko.local/github.com/kyverno/kyverno/cmd/initcontainer
|
KO_KYVERNOPRE_IMAGE := ko.local/github.com/kyverno/kyverno/cmd/initcontainer
|
||||||
KO_KYVERNO_IMAGE := ko.local/github.com/kyverno/kyverno/cmd/kyverno
|
KO_KYVERNO_IMAGE := ko.local/github.com/kyverno/kyverno/cmd/kyverno
|
||||||
|
@ -233,19 +233,19 @@ ko-publish-all-dev: ko-publish-kyvernopre-dev ko-publish-kyverno-dev ko-publish-
|
||||||
|
|
||||||
.PHONY: docker-get-kyvernopre-digest
|
.PHONY: docker-get-kyvernopre-digest
|
||||||
docker-get-kyvernopre-digest: ## Get kyvernopre image digest (with docker)
|
docker-get-kyvernopre-digest: ## Get kyvernopre image digest (with docker)
|
||||||
@docker buildx imagetools inspect --raw $(REPO)/$(KYVERNOPRE_IMAGE):$(IMAGE_TAG) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
@docker buildx imagetools inspect --raw $(REPO_KYVERNOPRE):$(IMAGE_TAG) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
||||||
|
|
||||||
.PHONY: docker-get-kyvernopre-digest-dev
|
.PHONY: docker-get-kyvernopre-digest-dev
|
||||||
docker-get-kyvernopre-digest-dev: ## Get kyvernopre dev image digest (with docker)
|
docker-get-kyvernopre-digest-dev: ## Get kyvernopre dev image digest (with docker)
|
||||||
@docker buildx imagetools inspect --raw $(REPO)/$(KYVERNOPRE_IMAGE):$(IMAGE_TAG_DEV) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
@docker buildx imagetools inspect --raw $(REPO_KYVERNOPRE):$(IMAGE_TAG_DEV) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
||||||
|
|
||||||
.PHONY: docker-get-kyverno-digest
|
.PHONY: docker-get-kyverno-digest
|
||||||
docker-get-kyverno-digest: ## Get kyverno image digest (with docker)
|
docker-get-kyverno-digest: ## Get kyverno image digest (with docker)
|
||||||
@docker buildx imagetools inspect --raw $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
@docker buildx imagetools inspect --raw $(REPO_KYVERNO):$(IMAGE_TAG) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
||||||
|
|
||||||
.PHONY: docker-get-kyverno-digest-dev
|
.PHONY: docker-get-kyverno-digest-dev
|
||||||
docker-get-kyverno-digest-dev: ## Get kyverno dev image digest (with docker)
|
docker-get-kyverno-digest-dev: ## Get kyverno dev image digest (with docker)
|
||||||
@docker buildx imagetools inspect --raw $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG_DEV) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
@docker buildx imagetools inspect --raw $(REPO_KYVERNO):$(IMAGE_TAG_DEV) | perl -pe 'chomp if eof' | openssl dgst -sha256 | sed 's/^.* //'
|
||||||
|
|
||||||
.PHONY: docker-buildx-builder
|
.PHONY: docker-buildx-builder
|
||||||
docker-buildx-builder:
|
docker-buildx-builder:
|
||||||
|
@ -257,23 +257,23 @@ docker-buildx-builder:
|
||||||
# BUILD (DOCKER) #
|
# BUILD (DOCKER) #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
DOCKER_KYVERNOPRE_IMAGE := $(REPO)/$(KYVERNOPRE_IMAGE)
|
DOCKER_KYVERNOPRE_IMAGE := $(REPO_KYVERNOPRE)
|
||||||
DOCKER_KYVERNO_IMAGE := $(REPO)/$(KYVERNO_IMAGE)
|
DOCKER_KYVERNO_IMAGE := $(REPO_KYVERNO)
|
||||||
|
|
||||||
.PHONY: docker-build-kyvernopre
|
.PHONY: docker-build-kyvernopre
|
||||||
docker-build-kyvernopre: docker-buildx-builder ## Build kyvernopre local image (with docker)
|
docker-build-kyvernopre: docker-buildx-builder ## Build kyvernopre local image (with docker)
|
||||||
@echo Build kyvernopre local image with docker...
|
@echo Build kyvernopre local image with docker...
|
||||||
@docker buildx build --file $(KYVERNOPRE_DIR)/Dockerfile --progress plain --load --platform $(LOCAL_PLATFORM) --tag $(REPO)/$(KYVERNOPRE_IMAGE):$(IMAGE_TAG_DEV) . --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
@docker buildx build --file $(KYVERNOPRE_DIR)/Dockerfile --progress plain --load --platform $(LOCAL_PLATFORM) --tag $(REPO_KYVERNOPRE):$(IMAGE_TAG_DEV) . --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
||||||
|
|
||||||
.PHONY: docker-build-kyverno
|
.PHONY: docker-build-kyverno
|
||||||
docker-build-kyverno: docker-buildx-builder ## Build kyverno local image (with docker)
|
docker-build-kyverno: docker-buildx-builder ## Build kyverno local image (with docker)
|
||||||
@echo Build kyverno local image with docker...
|
@echo Build kyverno local image with docker...
|
||||||
@docker buildx build --file $(KYVERNO_DIR)/Dockerfile --progress plain --load --platform $(LOCAL_PLATFORM) --tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG_DEV) . --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
@docker buildx build --file $(KYVERNO_DIR)/Dockerfile --progress plain --load --platform $(LOCAL_PLATFORM) --tag $(REPO_KYVERNO):$(IMAGE_TAG_DEV) . --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
||||||
|
|
||||||
.PHONY: docker-build-cli
|
.PHONY: docker-build-cli
|
||||||
docker-build-cli: docker-buildx-builder ## Build cli local image (with docker)
|
docker-build-cli: docker-buildx-builder ## Build cli local image (with docker)
|
||||||
@echo Build cli local image with docker...
|
@echo Build cli local image with docker...
|
||||||
@docker buildx build --file $(CLI_DIR)/Dockerfile --progress plain --load --platform $(LOCAL_PLATFORM) --tag $(REPO)/$(CLI_IMAGE):$(IMAGE_TAG_DEV) . --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
@docker buildx build --file $(CLI_DIR)/Dockerfile --progress plain --load --platform $(LOCAL_PLATFORM) --tag $(REPO_CLI):$(IMAGE_TAG_DEV) . --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
||||||
|
|
||||||
.PHONY: docker-build-all
|
.PHONY: docker-build-all
|
||||||
docker-build-all: docker-build-kyvernopre docker-build-kyverno docker-build-cli ## Build all local images (with docker)
|
docker-build-all: docker-build-kyvernopre docker-build-kyverno docker-build-cli ## Build all local images (with docker)
|
||||||
|
@ -284,32 +284,32 @@ docker-build-all: docker-build-kyvernopre docker-build-kyverno docker-build-cli
|
||||||
|
|
||||||
.PHONY: docker-publish-kyvernopre
|
.PHONY: docker-publish-kyvernopre
|
||||||
docker-publish-kyvernopre: docker-buildx-builder ## Build and publish kyvernopre image (with docker)
|
docker-publish-kyvernopre: docker-buildx-builder ## Build and publish kyvernopre image (with docker)
|
||||||
@docker buildx build --file $(KYVERNOPRE_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) --tag $(REPO)/$(KYVERNOPRE_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
@docker buildx build --file $(KYVERNOPRE_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) --tag $(REPO_KYVERNOPRE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||||
|
|
||||||
.PHONY: docker-publish-kyvernopre-dev
|
.PHONY: docker-publish-kyvernopre-dev
|
||||||
docker-publish-kyvernopre-dev: docker-buildx-builder ## Build and publish kyvernopre dev image (with docker)
|
docker-publish-kyvernopre-dev: docker-buildx-builder ## Build and publish kyvernopre dev image (with docker)
|
||||||
@docker buildx build --file $(KYVERNOPRE_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) \
|
@docker buildx build --file $(KYVERNOPRE_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) \
|
||||||
--tag $(REPO)/$(KYVERNOPRE_IMAGE):$(IMAGE_TAG_DEV) --tag $(REPO)/$(KYVERNOPRE_IMAGE):$(IMAGE_TAG_LATEST_DEV)-latest --tag $(REPO)/$(KYVERNOPRE_IMAGE):latest \
|
--tag $(REPO_KYVERNOPRE):$(IMAGE_TAG_DEV) --tag $(REPO_KYVERNOPRE):$(IMAGE_TAG_LATEST_DEV)-latest --tag $(REPO_KYVERNOPRE):latest \
|
||||||
. --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
. --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
||||||
|
|
||||||
.PHONY: docker-publish-kyverno
|
.PHONY: docker-publish-kyverno
|
||||||
docker-publish-kyverno: docker-buildx-builder ## Build and publish kyverno image (with docker)
|
docker-publish-kyverno: docker-buildx-builder ## Build and publish kyverno image (with docker)
|
||||||
@docker buildx build --file $(KYVERNO_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) --tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
@docker buildx build --file $(KYVERNO_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) --tag $(REPO_KYVERNO):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||||
|
|
||||||
.PHONY: docker-publish-kyverno-dev
|
.PHONY: docker-publish-kyverno-dev
|
||||||
docker-publish-kyverno-dev: docker-buildx-builder ## Build and publish kyverno dev image (with docker)
|
docker-publish-kyverno-dev: docker-buildx-builder ## Build and publish kyverno dev image (with docker)
|
||||||
@docker buildx build --file $(KYVERNO_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) \
|
@docker buildx build --file $(KYVERNO_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) \
|
||||||
--tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG_DEV) --tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG_LATEST_DEV)-latest --tag $(REPO)/$(KYVERNO_IMAGE):latest \
|
--tag $(REPO_KYVERNO):$(IMAGE_TAG_DEV) --tag $(REPO_KYVERNO):$(IMAGE_TAG_LATEST_DEV)-latest --tag $(REPO_KYVERNO):latest \
|
||||||
. --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
. --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
||||||
|
|
||||||
.PHONY: docker-publish-cli
|
.PHONY: docker-publish-cli
|
||||||
docker-publish-cli: docker-buildx-builder ## Build and publish cli image (with docker)
|
docker-publish-cli: docker-buildx-builder ## Build and publish cli image (with docker)
|
||||||
@docker buildx build --file $(CLI_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) --tag $(REPO)/$(CLI_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
@docker buildx build --file $(CLI_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) --tag $(REPO_CLI):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||||
|
|
||||||
.PHONY: docker-publish-cli-dev
|
.PHONY: docker-publish-cli-dev
|
||||||
docker-publish-cli-dev: docker-buildx-builder ## Build and publish cli dev image (with docker)
|
docker-publish-cli-dev: docker-buildx-builder ## Build and publish cli dev image (with docker)
|
||||||
@docker buildx build --file $(CLI_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) \
|
@docker buildx build --file $(CLI_DIR)/Dockerfile --progress plain --push --platform $(PLATFORMS) \
|
||||||
--tag $(REPO)/$(CLI_IMAGE):$(IMAGE_TAG_DEV) --tag $(REPO)/$(CLI_IMAGE):$(IMAGE_TAG_LATEST_DEV)-latest --tag $(REPO)/$(CLI_IMAGE):latest \
|
--tag $(REPO_CLI):$(IMAGE_TAG_DEV) --tag $(REPO_CLI):$(IMAGE_TAG_LATEST_DEV)-latest --tag $(REPO_CLI):latest \
|
||||||
. --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
. --build-arg LD_FLAGS=$(LD_FLAGS_DEV)
|
||||||
|
|
||||||
.PHONY: docker-publish-all
|
.PHONY: docker-publish-all
|
||||||
|
@ -500,8 +500,8 @@ kind-e2e-cluster: $(KIND) ## Create kind cluster for e2e tests
|
||||||
.PHONY: e2e-kustomize
|
.PHONY: e2e-kustomize
|
||||||
e2e-kustomize: $(KUSTOMIZE) ## Build kustomize manifests for e2e tests
|
e2e-kustomize: $(KUSTOMIZE) ## Build kustomize manifests for e2e tests
|
||||||
cd config && \
|
cd config && \
|
||||||
$(KUSTOMIZE) edit set image $(REPO)/$(KYVERNOPRE_IMAGE)=$(LOCAL_KYVERNOPRE_IMAGE):$(IMAGE_TAG_DEV) && \
|
$(KUSTOMIZE) edit set image $(REPO_KYVERNOPRE)=$(LOCAL_KYVERNOPRE_IMAGE):$(IMAGE_TAG_DEV) && \
|
||||||
$(KUSTOMIZE) edit set image $(REPO)/$(KYVERNO_IMAGE)=$(LOCAL_KYVERNO_IMAGE):$(IMAGE_TAG_DEV)
|
$(KUSTOMIZE) edit set image $(REPO_KYVERNO)=$(LOCAL_KYVERNO_IMAGE):$(IMAGE_TAG_DEV)
|
||||||
$(KUSTOMIZE) build config/ -o config/install.yaml
|
$(KUSTOMIZE) build config/ -o config/install.yaml
|
||||||
|
|
||||||
.PHONY: e2e-init-container
|
.PHONY: e2e-init-container
|
||||||
|
|
Loading…
Reference in a new issue