Skip to content

Commit

Permalink
feat: add helm chart release workflow (#2436)
Browse files Browse the repository at this point in the history
Add helm chart release flow to gh-pages

Also moved helm charts to `charts` directory as it is expected there. 

Fixed some linting and deployment errors along too

Solves PZ-4965

---------

Co-authored-by: Cyril Roos <cyril@info.nl>
  • Loading branch information
niorg and Cyril Roos authored Jan 20, 2025
1 parent e39d225 commit 62a605e
Show file tree
Hide file tree
Showing 31 changed files with 609 additions and 47 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/helm-chart-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPDX-FileCopyrightText: 2024 Lifely
# SPDX-License-Identifier: EUPL-1.2+

name: Helm chart release

on:
push:
branches: [main]
paths:
- 'charts/**'

jobs:
helm-release:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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: Set up Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: v3.16.4 # needs renovate version regex

- name: Add repositories
run: |
helm repo add opentelemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
with:
skip_existing: true
version: 1.7.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
30 changes: 14 additions & 16 deletions .github/workflows/helm-chart-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
branches: [main]
paths:
- 'helm/**'
- 'charts/**'
merge_group:
workflow_dispatch:

Expand All @@ -29,29 +29,27 @@ jobs:
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Add repositories
working-directory: ./helm
run: |
helm dependency list | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
helm repo add opentelemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-testing (list-changed)
working-directory: ./helm
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs . --target-branch ${{ github.event.repository.default_branch }})
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
working-directory: ./helm
run: ct lint --charts . --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false

# - name: Create kind cluster
# if: steps.list-changed.outputs.changed == 'true'
# uses: helm/kind-action@ae94020eaf628e9b9b9f341a10cc0cdcf5c018fb # v1.11.0
#
# - name: Run chart-testing (install)
# if: steps.list-changed.outputs.changed == 'true'
# working-directory: ./helm
# run: ct install --charts . --target-branch ${{ github.event.repository.default_branch }}
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@ae94020eaf628e9b9b9f341a10cc0cdcf5c018fb # v1.11.0

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
continue-on-error: true
run: ct install --target-branch ${{ github.event.repository.default_branch }}
2 changes: 1 addition & 1 deletion .github/workflows/run-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./src/e2e/reports/ # directory of your reports
publish_branch: gh-pages/dimpact-e2e-test-report # deploying to gh-pages branch
publish_branch: gh-pages # deploying to gh-pages branch
keep_files: true # retains files that are not part of the current publish
- name: Notify Slack
if: ${{ !cancelled() && github.ref == 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ header:
- 'gradle'
# Exclude Helm Chart files because the 'Azure Kubernetes Bake' GitHub Action that we use cannot
# deal with SPDX headers in these files. See: https://github.com/Azure/k8s-bake/issues/117
- 'helm'
- 'charts'
- 'scripts'
- 'target'
- 'wildfly-*'
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ tasks {
group = "build"
dependsOn("downloadAndUnpackHelmDocs")

workingDir("helm")
workingDir("charts/zac")
commandLine("$rootDir/build/helm-docs/helm-docs", "values.yaml")
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions helm/Chart.yaml → charts/zac/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ name: zaakafhandelcomponent
description: A Helm chart for installing Zaakafhandelcomponent
version: 0.4.0
appVersion: "latest"
icon: https://raw.githubusercontent.com/infonl/dimpact-zaakafhandelcomponent/49f8dee60948282b546ebdfdc5cff6f8bbef0305/docs/manuals/ZAC-gebruikershandleiding/images/pic.svg
dependencies:
- name: opentelemetry-collector
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
repository: "@opentelemetry"
condition: opentelemetry-collector.enabled
version: 0.104.0
- name: solr
version: 9.5.1
repository: https://charts.bitnami.com/bitnami
repository: "@bitnami"
condition: solr.enabled
maintainers:
- name: Team Genève, INFO
Expand Down
File renamed without changes.
Loading

0 comments on commit 62a605e

Please sign in to comment.