Skip to content

Commit

Permalink
wip add helmfile linter
Browse files Browse the repository at this point in the history
  • Loading branch information
rouja committed Sep 23, 2024
1 parent be30706 commit d7c2577
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/helmfile-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Helmfile lint
run-name: Helmfile lint

on:
push:

jobs:
helmfile-lint:
runs-on: ubuntu-latest
container:
image: ghcr.io/helmfile/helmfile:latest
steps:
-
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: "meet,secrets"
-
name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}
-
name: Load sops secrets
uses: rouja/actions-sops@main
with:
secret-file: secrets/numerique-gouv/meet/secrets.enc.env
age-key: ${{ secrets.SOPS_PRIVATE }}
-
name: Helmfile lint
shell: bash
run: |
mkdir -p ~/.config/sops/age/
echo $SOPS_PRIVATE > ~/.config/sops/age /keys.txt
/bin/validate-helm-configuration.sh
13 changes: 13 additions & 0 deletions bin/validate-helm-configuration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

HELMFILE=src/helm/helmfile.yaml

environments=$(awk '/environments:/,0' "$HELMFILE" | grep -E '^[[:space:]]{2}[a-zA-Z]+' | sed 's/^[[:space:]]*//;s/:.*//')

for env in $environments; do
echo "################### $env lint ###################"
helmfile -e $env -f src/helm/helmfile.yaml lint || exit 1
echo -e "\n"
done
2 changes: 1 addition & 1 deletion secrets

0 comments on commit d7c2577

Please sign in to comment.