1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

fix: publish yaml manifests in release instead of repo (#4738)

* fix: publish yaml manifests in release instead of repo

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* ignore

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* pin actions

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* messages

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix helm gen crds

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* chart app version

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* makefile

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:
Charles-Edouard Brétéché 2022-10-03 17:12:43 +02:00 committed by GitHub
parent 59f11f08b3
commit 7e0884ca36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 25637 deletions

View file

@ -62,12 +62,12 @@ jobs:
run: echo ::set-output name=version::${GITHUB_REF#refs/*/}
- name: Checkout
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # pin@v2.4.0
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 # v2.1.5
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 # pin@v2.1.5
with:
go-version: ~1.18.6
@ -80,8 +80,8 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: creekorful/goreportcard-action@1f35ced8cdac2cba28c9a2f2288a16aacfd507f9 # v1.0
- uses: creekorful/goreportcard-action@1f35ced8cdac2cba28c9a2f2288a16aacfd507f9 # pin@v1.0
- name: Make Release
env:
@ -91,22 +91,33 @@ jobs:
mkdir release
make release-notes > release/release-notes.out
cat release/release-notes.out
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@5df302e5e9e4c66310a6b6493a8865b12c555af2 #v2.8.0
uses: goreleaser/goreleaser-action@5df302e5e9e4c66310a6b6493a8865b12c555af2 # pin@v2.8.0
with:
version: latest
args: release --rm-dist --debug --release-notes=release/release-notes.out
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build yaml manifest
run: make codegen-release
- name: Upload yaml manifest
uses: svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575 # pin@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: config/.release/install.yaml
asset_name: install.yaml
tag: ${{ github.ref }}
release-cli-via-krew:
runs-on: ubuntu-latest
needs:
- create-release
needs:
- create-release
steps:
- name: Checkout
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # pin@v2.4.0
- name: Unshallow
run: git fetch --prune --unshallow
@ -120,4 +131,4 @@ jobs:
- name: Update new version in krew-index
if: steps.check-tag.outputs.match == 'true'
uses: rajatjindal/krew-release-bot@3320c0b546b5d2320613c46762bd3f73e2801bdc # v0.0.38
uses: rajatjindal/krew-release-bot@3320c0b546b5d2320613c46762bd3f73e2801bdc # pin@v0.0.38

2
.gitignore vendored
View file

@ -12,4 +12,6 @@ kubectl-kyverno
.DS_Store
.tools
.gopath
/config/.helm
/config/.release
.dist

View file

@ -434,14 +434,22 @@ codegen-helm-docs: ## Generate helm docs
.PHONY: codegen-helm-crds
codegen-helm-crds: $(KUSTOMIZE) codegen-crds-all ## Generate helm CRDs
@echo Create temp folder for kustomization... >&2
@mkdir -p config/.helm
@echo Create kustomization... >&2
@VERSION='"{{.Chart.AppVersion}}"' TOP_PATH=".." envsubst < config/templates/labels.yaml.envsubst > config/.helm/labels.yaml
@VERSION=dummy TOP_PATH=".." envsubst < config/templates/kustomization.yaml.envsubst > config/.helm/kustomization.yaml
@echo Generate helm crds... >&2
@$(KUSTOMIZE) build ./config/release | $(KUSTOMIZE) cfg grep kind=CustomResourceDefinition | $(SED) -e "1i{{- if .Values.installCRDs }}" -e '$$a{{- end }}' > ./charts/kyverno/templates/crds.yaml
@$(KUSTOMIZE) build ./config/.helm | $(KUSTOMIZE) cfg grep kind=CustomResourceDefinition | $(SED) -e "1i{{- if .Values.installCRDs }}" -e '$$a{{- end }}' > ./charts/kyverno/templates/crds.yaml
.PHONY: codegen-helm-all
codegen-helm-all: codegen-helm-crds codegen-helm-docs ## Generate helm docs and CRDs
.PHONY: codegen-install
codegen-install: $(KUSTOMIZE) ## Create install maifests
@echo Create kustomization... >&2
@VERSION=latest TOP_PATH="." envsubst < config/templates/labels.yaml.envsubst > config/labels.yaml
@VERSION=latest TOP_PATH="." envsubst < config/templates/kustomization.yaml.envsubst > config/kustomization.yaml
@echo Generate install.yaml... >&2
@$(KUSTOMIZE) build ./config > ./config/install.yaml
@echo Generate install_debug.yaml... >&2
@ -450,8 +458,13 @@ codegen-install: $(KUSTOMIZE) ## Create install maifests
# guidance https://github.com/kyverno/kyverno/wiki/Generate-a-Release
.PHONY: codegen-release
codegen-release: codegen-install $(KUSTOMIZE) ## Create release maifests
@echo Generate release manifests...
@$(KUSTOMIZE) build ./config/release > ./config/release/install.yaml
@echo Create release folder... >&2
@mkdir -p config/.release
@echo Create kustomization... >&2
@VERSION=$(GIT_VERSION) TOP_PATH=".." envsubst < config/templates/labels.yaml.envsubst > config/.release/labels.yaml
@VERSION=$(GIT_VERSION) TOP_PATH=".." envsubst < config/templates/kustomization.yaml.envsubst > config/.release/kustomization.yaml
@echo Generate release manifests... >&2
@$(KUSTOMIZE) build ./config/.release > ./config/.release/install.yaml
.PHONY: codegen-quick
codegen-quick: codegen-deepcopy-all codegen-crds-all codegen-api-docs codegen-helm-all codegen-install codegen-release ## Generate all generated code except client
@ -464,7 +477,7 @@ codegen-all: codegen-quick codegen-slow ## Generate all generated code
# .PHONY: codegen-openapi
# codegen-openapi: $(PACKAGE_SHIM) $(OPENAPI_GEN) ## Generate open api code
# @echo Generate open api definitions...
# @echo Generate open api definitions... >&2
# @GOPATH=$(GOPATH_SHIM) $(OPENAPI_GEN) --go-header-file ./scripts/boilerplate.go.txt \
# --input-dirs $(INPUT_DIRS) \
# --input-dirs k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/version \
@ -478,36 +491,36 @@ codegen-all: codegen-quick codegen-slow ## Generate all generated code
.PHONY: verify-crds
verify-crds: codegen-crds-all ## Check CRDs are up to date
@git --no-pager diff config
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-crds-all".'
@echo 'To correct this, locally run "make codegen-crds-all", commit the changes, and re-run tests.'
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-crds-all".' >&2
@echo 'To correct this, locally run "make codegen-crds-all", commit the changes, and re-run tests.' >&2
@git diff --quiet --exit-code config
.PHONY: verify-client
verify-client: codegen-client-all ## Check client is up to date
@git --no-pager diff --ignore-space-change pkg/client
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-client-all".'
@echo 'To correct this, locally run "make codegen-client-all", commit the changes, and re-run tests.'
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-client-all".' >&2
@echo 'To correct this, locally run "make codegen-client-all", commit the changes, and re-run tests.' >&2
@git diff --ignore-space-change --quiet --exit-code pkg/client
.PHONY: verify-deepcopy
verify-deepcopy: codegen-deepcopy-all ## Check deepcopy functions are up to date
@git --no-pager diff api
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-deepcopy-all".'
@echo 'To correct this, locally run "make codegen-deepcopy-all", commit the changes, and re-run tests.'
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-deepcopy-all".' >&2
@echo 'To correct this, locally run "make codegen-deepcopy-all", commit the changes, and re-run tests.' >&2
@git diff --quiet --exit-code api
.PHONY: verify-api-docs
verify-api-docs: codegen-api-docs ## Check api reference docs are up to date
@git --no-pager diff docs
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-api-docs".'
@echo 'To correct this, locally run "make codegen-api-docs", commit the changes, and re-run tests.'
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-api-docs".' >&2
@echo 'To correct this, locally run "make codegen-api-docs", commit the changes, and re-run tests.' >&2
@git diff --quiet --exit-code docs
.PHONY: verify-helm
verify-helm: codegen-helm-all ## Check Helm charts are up to date
@git --no-pager diff charts
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-helm-all".'
@echo 'To correct this, locally run "make codegen-helm", commit the changes, and re-run tests.'
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-helm-all".' >&2
@echo 'To correct this, locally run "make codegen-helm", commit the changes, and re-run tests.' >&2
@git diff --quiet --exit-code charts
.PHONY: verify-codegen
@ -633,6 +646,18 @@ release-notes:
@bash -c 'while IFS= read -r line ; do if [[ "$$line" == "## "* && "$$line" != "## $(VERSION)" ]]; then break ; fi; echo "$$line"; done < "CHANGELOG.md"' \
true
##########
# GITHUB #
##########
.PHONY: gh-install-pin-github-action
gh-install-pin-github-action:
@npm install -g pin-github-action
.PHONY: gh-pin-actions
gh-pin-actions: gh-install-pin-github-action
@pin-github-action ./.github/workflows/release.yaml
########
# KIND #
########

View file

@ -12,7 +12,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: admissionreports.kyverno.io
spec:
group: kyverno.io
@ -266,7 +266,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: backgroundscanreports.kyverno.io
spec:
group: kyverno.io
@ -490,7 +490,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: clusteradmissionreports.kyverno.io
spec:
group: kyverno.io
@ -744,7 +744,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: clusterbackgroundscanreports.kyverno.io
spec:
group: kyverno.io
@ -968,7 +968,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: clusterpolicies.kyverno.io
spec:
group: kyverno.io
@ -7940,7 +7940,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: clusterpolicyreports.wgpolicyk8s.io
spec:
group: wgpolicyk8s.io
@ -8212,7 +8212,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: generaterequests.kyverno.io
spec:
group: kyverno.io
@ -8387,7 +8387,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: policies.kyverno.io
spec:
group: kyverno.io
@ -15359,7 +15359,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: policyreports.wgpolicyk8s.io
spec:
group: wgpolicyk8s.io
@ -15631,7 +15631,7 @@ metadata:
app.kubernetes.io/instance: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
name: updaterequests.kyverno.io
spec:
group: kyverno.io

View file

@ -2,4 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./release
- ./bundle/
transformers:
- labels.yaml
images:
- name: ghcr.io/kyverno/kyverno
newTag: latest
- name: ghcr.io/kyverno/kyvernopre
newTag: latest

File diff suppressed because it is too large Load diff

View file

@ -2,13 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../bundle/
- $TOP_PATH/bundle/
transformers:
- labels.yaml
images:
- name: ghcr.io/kyverno/kyverno
newTag: latest
newTag: $VERSION
- name: ghcr.io/kyverno/kyvernopre
newTag: latest
newTag: $VERSION

View file

@ -0,0 +1,13 @@
---
apiVersion: builtin
kind: LabelTransformer
metadata:
name: labelTransformer
labels:
app.kubernetes.io/version: $VERSION
fieldSpecs:
- path: metadata/labels
create: true
- kind: Deployment
path: spec/template/metadata/labels
create: true