From 27cd15fc92a1c4067fd18a571b010600f8d71a79 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 18 Sep 2023 15:33:51 +0200 Subject: [PATCH 1/2] Add an action for linting and releasing helm chart I've added a GitHub action that is linting helm chart on each pushed commit and releasing a new version helm chart automatically on each new push to the `master` branch. The linter job is checking whether the chart is changed, and in case it is, the linter expects the versions to be bumped. That means that all the changes to chart will be delivered to its users right away. --- .github/workflows/helm-chart-workflow.yaml | 52 ++++++++++++++++++++++ helm/vernemq/Chart.yaml | 2 +- helm/vernemq/values.yaml | 3 +- 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/helm-chart-workflow.yaml diff --git a/.github/workflows/helm-chart-workflow.yaml b/.github/workflows/helm-chart-workflow.yaml new file mode 100644 index 0000000..92ab5c2 --- /dev/null +++ b/.github/workflows/helm-chart-workflow.yaml @@ -0,0 +1,52 @@ +--- +name: Lint and release the helm chart +on: + pull_request: + push: + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v3 + with: + version: v3.12.1 + + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + check-latest: true + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --chart-dirs helm --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' + run: ct lint --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false --chart-dirs helm + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Release charts + if: github.ref == ${{ github.event.repository.default_branch }} + uses: helm/chart-releaser-action@v1.5.0 + with: + charts_dir: helm + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/helm/vernemq/Chart.yaml b/helm/vernemq/Chart.yaml index ce84ab1..dc5055b 100644 --- a/helm/vernemq/Chart.yaml +++ b/helm/vernemq/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v1 appVersion: 1.13.0 description: VerneMQ is a high-performance, distributed MQTT message broker name: vernemq -version: 1.9.0 +version: 1.9.1 icon: http://www.stickpng.com/assets/thumbs/58482b21cef1014c0b5e4a24.png diff --git a/helm/vernemq/values.yaml b/helm/vernemq/values.yaml index 112d989..fc42a9d 100644 --- a/helm/vernemq/values.yaml +++ b/helm/vernemq/values.yaml @@ -58,7 +58,7 @@ service: annotations: {} annotations: {} labels: {} - + ## Ingress can optionally be applied when enabling the MQTT websocket service ## This allows for an ingress controller to route web ports and arbitrary hostnames @@ -83,7 +83,6 @@ ingress: paths: - path: / pathType: ImplementationSpecific - ## TLS configuration for ingress ## Secret must be manually created in the namespace From 839de247d509f532ea7b8e17eda9d82726bf2c8c Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 20 Sep 2023 05:33:05 +0200 Subject: [PATCH 2/2] Disable release on PR --- .github/workflows/helm-chart-workflow.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/helm-chart-workflow.yaml b/.github/workflows/helm-chart-workflow.yaml index 92ab5c2..124bfe9 100644 --- a/.github/workflows/helm-chart-workflow.yaml +++ b/.github/workflows/helm-chart-workflow.yaml @@ -1,8 +1,6 @@ --- name: Lint and release the helm chart -on: - pull_request: - push: +on: push jobs: lint-test: