From cfb6285e4081afd041059e956317098ac241fc19 Mon Sep 17 00:00:00 2001 From: Angel de la Torre Date: Wed, 7 Feb 2024 14:57:36 -0800 Subject: [PATCH 1/3] feat(helm): add helm CI workflow This uses the helm/chart-testing-action to do basic linting and testing of of the helm charts. --- .github/workflows/helm.yaml | 50 +++++++++++++++++++++++++++++++++++++ ct-config.yaml | 5 ++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/helm.yaml create mode 100644 ct-config.yaml diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml new file mode 100644 index 0000000..f1d0688 --- /dev/null +++ b/.github/workflows/helm.yaml @@ -0,0 +1,50 @@ +name: Lint and Test Charts + +on: + pull_request: + paths: + - 'charts/**' + - 'ct-config.yaml' + - '.github/workflows/lint-and-test-charts.yml' + +jobs: + helm-lint-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v3 + with: + version: v3.14.0 + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + check-latest: true + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.1 + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --config ./ct-config.yaml) + 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 --config ./ct-config.yaml + + - name: Create kind cluster + if: steps.list-changed.outputs.changed == 'true' + uses: helm/kind-action@v1.8.0 + + - name: Run chart-testing (install) + if: steps.list-changed.outputs.changed == 'true' + run: ct install --config ./ct-config.yaml \ No newline at end of file diff --git a/ct-config.yaml b/ct-config.yaml new file mode 100644 index 0000000..52703ac --- /dev/null +++ b/ct-config.yaml @@ -0,0 +1,5 @@ +charts-dir: + - helm +helm-extra-args: "--timeout=5m" +target-branch: main +validate-maintainers: false \ No newline at end of file From 49ce7073609bc427ed0335dd8a3bd6b6594bc557 Mon Sep 17 00:00:00 2001 From: Angel de la Torre Date: Wed, 7 Feb 2024 14:58:59 -0800 Subject: [PATCH 2/3] refactor(helm): rename helm chart dir to charts dir A 'charts' dir is used more consistently across the Helm community as well as for the 'ct' cli tool. This renames the 'helm' dir to 'charts' to align with these conventions. --- {helm => charts}/vigilo/.helmignore | 0 {helm => charts}/vigilo/Chart.yaml | 0 {helm => charts}/vigilo/templates/_helpers.tpl | 0 {helm => charts}/vigilo/templates/cronjob.yaml | 0 {helm => charts}/vigilo/templates/lighthouse-configmap.yaml | 0 {helm => charts}/vigilo/templates/secret.yaml | 0 {helm => charts}/vigilo/templates/urls-configmap.yaml | 0 {helm => charts}/vigilo/values.yaml | 0 ct-config.yaml | 2 +- 9 files changed, 1 insertion(+), 1 deletion(-) rename {helm => charts}/vigilo/.helmignore (100%) rename {helm => charts}/vigilo/Chart.yaml (100%) rename {helm => charts}/vigilo/templates/_helpers.tpl (100%) rename {helm => charts}/vigilo/templates/cronjob.yaml (100%) rename {helm => charts}/vigilo/templates/lighthouse-configmap.yaml (100%) rename {helm => charts}/vigilo/templates/secret.yaml (100%) rename {helm => charts}/vigilo/templates/urls-configmap.yaml (100%) rename {helm => charts}/vigilo/values.yaml (100%) diff --git a/helm/vigilo/.helmignore b/charts/vigilo/.helmignore similarity index 100% rename from helm/vigilo/.helmignore rename to charts/vigilo/.helmignore diff --git a/helm/vigilo/Chart.yaml b/charts/vigilo/Chart.yaml similarity index 100% rename from helm/vigilo/Chart.yaml rename to charts/vigilo/Chart.yaml diff --git a/helm/vigilo/templates/_helpers.tpl b/charts/vigilo/templates/_helpers.tpl similarity index 100% rename from helm/vigilo/templates/_helpers.tpl rename to charts/vigilo/templates/_helpers.tpl diff --git a/helm/vigilo/templates/cronjob.yaml b/charts/vigilo/templates/cronjob.yaml similarity index 100% rename from helm/vigilo/templates/cronjob.yaml rename to charts/vigilo/templates/cronjob.yaml diff --git a/helm/vigilo/templates/lighthouse-configmap.yaml b/charts/vigilo/templates/lighthouse-configmap.yaml similarity index 100% rename from helm/vigilo/templates/lighthouse-configmap.yaml rename to charts/vigilo/templates/lighthouse-configmap.yaml diff --git a/helm/vigilo/templates/secret.yaml b/charts/vigilo/templates/secret.yaml similarity index 100% rename from helm/vigilo/templates/secret.yaml rename to charts/vigilo/templates/secret.yaml diff --git a/helm/vigilo/templates/urls-configmap.yaml b/charts/vigilo/templates/urls-configmap.yaml similarity index 100% rename from helm/vigilo/templates/urls-configmap.yaml rename to charts/vigilo/templates/urls-configmap.yaml diff --git a/helm/vigilo/values.yaml b/charts/vigilo/values.yaml similarity index 100% rename from helm/vigilo/values.yaml rename to charts/vigilo/values.yaml diff --git a/ct-config.yaml b/ct-config.yaml index 52703ac..07ebdc0 100644 --- a/ct-config.yaml +++ b/ct-config.yaml @@ -1,5 +1,5 @@ charts-dir: - - helm + - charts helm-extra-args: "--timeout=5m" target-branch: main validate-maintainers: false \ No newline at end of file From 5fc0c33e16544f3b8b78283c97ccee820773f6b8 Mon Sep 17 00:00:00 2001 From: Angel de la Torre Date: Wed, 7 Feb 2024 15:02:02 -0800 Subject: [PATCH 3/3] fix(helm-lint): address linter errors for values.yaml Two-spaces are needed for inline comments. --- charts/vigilo/values.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/vigilo/values.yaml b/charts/vigilo/values.yaml index b4d433c..2c07b40 100644 --- a/charts/vigilo/values.yaml +++ b/charts/vigilo/values.yaml @@ -13,10 +13,10 @@ imagePullSecrets: - name: "" cronjob: - schedule: "*/10 * * * *" # Every 10 minutes - concurrencyPolicy: Forbid # skip if previous job is still running - successfulJobsHistoryLimit: 0 # keep no history of successful jobs - failedJobsHistoryLimit: 1 # keep only one failed job + schedule: "*/10 * * * *" # Every 10 minutes + concurrencyPolicy: Forbid # skip if previous job is still running + successfulJobsHistoryLimit: 0 # keep no history of successful jobs + failedJobsHistoryLimit: 1 # keep only one failed job configs: datadogSecret: