From c23838a3173ac3c9eb69161b1dc13b66e98f34d2 Mon Sep 17 00:00:00 2001 From: Mario Ranftl Date: Tue, 29 Oct 2024 18:11:47 +0100 Subject: [PATCH] prepare helm/chart-releaser-action integration --- ...ish.yml => build-test-publish-release.yml} | 28 +++++++++++++++++-- Makefile | 4 +-- {deploy => charts}/backup-ns/.helmignore | 0 {deploy => charts}/backup-ns/Chart.yaml | 2 +- .../backup-ns/templates/NOTES.txt | 0 .../backup-ns/templates/_helpers.tpl | 0 .../backup-ns/templates/configmap.yaml | 0 .../backup-ns/templates/cronjob.yaml | 0 .../backup-ns/templates/deployment.yaml.bak | 0 .../backup-ns/templates/ingress.yaml.bak | 0 .../backup-ns/templates/rolebinding.yaml | 0 .../backup-ns/templates/service.yaml.bak | 0 .../backup-ns/templates/serviceaccount.yaml | 0 {deploy => charts}/backup-ns/values.yaml | 12 ++++---- ...ustomer-namespace-backup-ns.rendered.yaml} | 12 ++++---- .../customer-namespace-backup-ns.values.yaml} | 0 16 files changed, 41 insertions(+), 17 deletions(-) rename .github/workflows/{build-test-publish.yml => build-test-publish-release.yml} (80%) rename {deploy => charts}/backup-ns/.helmignore (100%) rename {deploy => charts}/backup-ns/Chart.yaml (97%) rename {deploy => charts}/backup-ns/templates/NOTES.txt (100%) rename {deploy => charts}/backup-ns/templates/_helpers.tpl (100%) rename {deploy => charts}/backup-ns/templates/configmap.yaml (100%) rename {deploy => charts}/backup-ns/templates/cronjob.yaml (100%) rename {deploy => charts}/backup-ns/templates/deployment.yaml.bak (100%) rename {deploy => charts}/backup-ns/templates/ingress.yaml.bak (100%) rename {deploy => charts}/backup-ns/templates/rolebinding.yaml (100%) rename {deploy => charts}/backup-ns/templates/service.yaml.bak (100%) rename {deploy => charts}/backup-ns/templates/serviceaccount.yaml (100%) rename {deploy => charts}/backup-ns/values.yaml (97%) rename deploy/{samples/customer-namespace-backup.rendered.yaml => backup-ns/customer-namespace-backup-ns.rendered.yaml} (93%) rename deploy/{samples/customer-namespace-backup.values.yaml => backup-ns/customer-namespace-backup-ns.values.yaml} (100%) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish-release.yml similarity index 80% rename from .github/workflows/build-test-publish.yml rename to .github/workflows/build-test-publish-release.yml index 2f2bb89..f435f66 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish-release.yml @@ -16,7 +16,7 @@ jobs: build-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.7 + - uses: actions/checkout@v4 - name: setup@kindconfig run: | @@ -75,7 +75,7 @@ jobs: packages: write steps: - - uses: actions/checkout@v4.1.7 + - uses: actions/checkout@v4 - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 @@ -99,3 +99,27 @@ jobs: ${{ steps.meta.outputs.tags }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} labels: ${{ steps.meta.outputs.labels }} + + release: + if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'push' && github.ref == 'refs/heads/main') + + needs: + - build-test + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/Makefile b/Makefile index 2fdd981..9ac1b2e 100644 --- a/Makefile +++ b/Makefile @@ -37,9 +37,7 @@ go-format: ##- (opt) Runs go format. .PHONY: helm helm: - helm template ./deploy/backup-ns > ./deploy/backup-ns.tmp.yaml - helm template ./deploy/backup-ns -n customer-namespace -f deploy/samples/customer-namespace-backup.values.yaml > ./deploy/samples/customer-namespace-backup.rendered.yaml - helm package ./deploy/backup-ns -d ./deploy + helm template ./charts/backup-ns -n customer-namespace -f deploy/backup-ns/customer-namespace-backup-ns.values.yaml > ./deploy/backup-ns/customer-namespace-backup-ns.rendered.yaml .PHONY: go-build go-build: ##- (opt) Runs go build. diff --git a/deploy/backup-ns/.helmignore b/charts/backup-ns/.helmignore similarity index 100% rename from deploy/backup-ns/.helmignore rename to charts/backup-ns/.helmignore diff --git a/deploy/backup-ns/Chart.yaml b/charts/backup-ns/Chart.yaml similarity index 97% rename from deploy/backup-ns/Chart.yaml rename to charts/backup-ns/Chart.yaml index 23971a9..eeeffc9 100644 --- a/deploy/backup-ns/Chart.yaml +++ b/charts/backup-ns/Chart.yaml @@ -21,4 +21,4 @@ version: 0.1.0 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "a728d01c0a" +appVersion: "v0.1.0" diff --git a/deploy/backup-ns/templates/NOTES.txt b/charts/backup-ns/templates/NOTES.txt similarity index 100% rename from deploy/backup-ns/templates/NOTES.txt rename to charts/backup-ns/templates/NOTES.txt diff --git a/deploy/backup-ns/templates/_helpers.tpl b/charts/backup-ns/templates/_helpers.tpl similarity index 100% rename from deploy/backup-ns/templates/_helpers.tpl rename to charts/backup-ns/templates/_helpers.tpl diff --git a/deploy/backup-ns/templates/configmap.yaml b/charts/backup-ns/templates/configmap.yaml similarity index 100% rename from deploy/backup-ns/templates/configmap.yaml rename to charts/backup-ns/templates/configmap.yaml diff --git a/deploy/backup-ns/templates/cronjob.yaml b/charts/backup-ns/templates/cronjob.yaml similarity index 100% rename from deploy/backup-ns/templates/cronjob.yaml rename to charts/backup-ns/templates/cronjob.yaml diff --git a/deploy/backup-ns/templates/deployment.yaml.bak b/charts/backup-ns/templates/deployment.yaml.bak similarity index 100% rename from deploy/backup-ns/templates/deployment.yaml.bak rename to charts/backup-ns/templates/deployment.yaml.bak diff --git a/deploy/backup-ns/templates/ingress.yaml.bak b/charts/backup-ns/templates/ingress.yaml.bak similarity index 100% rename from deploy/backup-ns/templates/ingress.yaml.bak rename to charts/backup-ns/templates/ingress.yaml.bak diff --git a/deploy/backup-ns/templates/rolebinding.yaml b/charts/backup-ns/templates/rolebinding.yaml similarity index 100% rename from deploy/backup-ns/templates/rolebinding.yaml rename to charts/backup-ns/templates/rolebinding.yaml diff --git a/deploy/backup-ns/templates/service.yaml.bak b/charts/backup-ns/templates/service.yaml.bak similarity index 100% rename from deploy/backup-ns/templates/service.yaml.bak rename to charts/backup-ns/templates/service.yaml.bak diff --git a/deploy/backup-ns/templates/serviceaccount.yaml b/charts/backup-ns/templates/serviceaccount.yaml similarity index 100% rename from deploy/backup-ns/templates/serviceaccount.yaml rename to charts/backup-ns/templates/serviceaccount.yaml diff --git a/deploy/backup-ns/values.yaml b/charts/backup-ns/values.yaml similarity index 97% rename from deploy/backup-ns/values.yaml rename to charts/backup-ns/values.yaml index e99520d..7b97d7c 100644 --- a/deploy/backup-ns/values.yaml +++ b/charts/backup-ns/values.yaml @@ -4,7 +4,7 @@ # This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ image: - repository: eu.gcr.io/a3cloud-192413/aw/backup-ns + repository: ghcr.io/allaboutapps/backup-ns # This sets the pull policy for images. pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. @@ -84,10 +84,12 @@ podAnnotations: {} # For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ podLabels: {} -podSecurityContext: {} +podSecurityContext: + {} # fsGroup: 2000 -securityContext: {} +securityContext: + {} # capabilities: # drop: # - ALL @@ -95,7 +97,8 @@ securityContext: {} # runAsNonRoot: true # runAsUser: 1000 -resources: {} +resources: + {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following @@ -107,7 +110,6 @@ resources: {} # cpu: 100m # memory: 128Mi - additionalContainers: [] nodeSelector: {} diff --git a/deploy/samples/customer-namespace-backup.rendered.yaml b/deploy/backup-ns/customer-namespace-backup-ns.rendered.yaml similarity index 93% rename from deploy/samples/customer-namespace-backup.rendered.yaml rename to deploy/backup-ns/customer-namespace-backup-ns.rendered.yaml index dfdd435..ddd3a37 100644 --- a/deploy/samples/customer-namespace-backup.rendered.yaml +++ b/deploy/backup-ns/customer-namespace-backup-ns.rendered.yaml @@ -9,7 +9,7 @@ metadata: helm.sh/chart: backup-ns-0.1.0 app.kubernetes.io/name: backup-ns app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "a728d01c0a" + app.kubernetes.io/version: "v0.1.0" app.kubernetes.io/managed-by: Helm automountServiceAccountToken: true --- @@ -23,7 +23,7 @@ metadata: helm.sh/chart: backup-ns-0.1.0 app.kubernetes.io/name: backup-ns app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "a728d01c0a" + app.kubernetes.io/version: "v0.1.0" app.kubernetes.io/managed-by: Helm data: BAK_DB_POSTGRES: "true" @@ -45,7 +45,7 @@ metadata: helm.sh/chart: backup-ns-0.1.0 app.kubernetes.io/name: backup-ns app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "a728d01c0a" + app.kubernetes.io/version: "v0.1.0" app.kubernetes.io/managed-by: Helm roleRef: apiGroup: rbac.authorization.k8s.io @@ -66,7 +66,7 @@ metadata: helm.sh/chart: backup-ns-0.1.0 app.kubernetes.io/name: backup-ns app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "a728d01c0a" + app.kubernetes.io/version: "v0.1.0" app.kubernetes.io/managed-by: Helm annotations: a3c-validate-prefer-explicit-pod-strategy: Recreate @@ -86,7 +86,7 @@ spec: helm.sh/chart: backup-ns-0.1.0 app.kubernetes.io/name: backup-ns app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "a728d01c0a" + app.kubernetes.io/version: "v0.1.0" app.kubernetes.io/managed-by: Helm app: backup spec: @@ -111,7 +111,7 @@ spec: - name: backup-ns securityContext: {} - image: "eu.gcr.io/a3cloud-192413/aw/backup-ns:2231cf7214" + image: "ghcr.io/allaboutapps/backup-ns:2231cf7214" imagePullPolicy: IfNotPresent envFrom: - configMapRef: diff --git a/deploy/samples/customer-namespace-backup.values.yaml b/deploy/backup-ns/customer-namespace-backup-ns.values.yaml similarity index 100% rename from deploy/samples/customer-namespace-backup.values.yaml rename to deploy/backup-ns/customer-namespace-backup-ns.values.yaml