From 3028e8ebf8622d6423cd56249d0d255802e9b1f5 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 16 Sep 2022 22:17:32 -0700 Subject: [PATCH] refactor: add helm script and job --- .github/workflows/build.yaml | 28 ++++++++++++++++++++++++++++ ci/dev/helm.sh | 14 ++++++++++++++ ci/dev/lint.sh | 3 --- package.json | 1 + 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100755 ci/dev/helm.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b53ceb9df..8669ce9f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -108,6 +108,34 @@ jobs: if: failure() uses: andymckay/cancel-action@0.2 + lint-helm: + name: Lint Helm chart + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v23.2 + with: + files: | + ci/helm-chart/** + + - name: Install helm + uses: azure/setup-helm@v3.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Lint Helm chart + if: steps.changed-files.outputs.any_changed == 'true' + run: ./ci/dev/helm.sh + + - name: Fail workflow + if: failure() + uses: andymckay/cancel-action@0.2 + build: name: Build needs: prebuild diff --git a/ci/dev/helm.sh b/ci/dev/helm.sh new file mode 100755 index 000000000..895db6542 --- /dev/null +++ b/ci/dev/helm.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail + +main() { + cd "$(dirname "$0")/../.." + + if command -v helm && helm kubeval --help > /dev/null; then + helm kubeval ci/helm-chart + fi + + cd "$OLDPWD" +} + +main "$@" diff --git a/ci/dev/lint.sh b/ci/dev/lint.sh index ac6be75ce..f0d7ae586 100755 --- a/ci/dev/lint.sh +++ b/ci/dev/lint.sh @@ -6,9 +6,6 @@ main() { eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode") tsc --noEmit --skipLibCheck - if command -v helm && helm kubeval --help > /dev/null; then - helm kubeval ci/helm-chart - fi cd "$OLDPWD" } diff --git a/package.json b/package.json index 4a2c64add..72659fffc 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "_audit": "./ci/dev/audit.sh", "fmt": "./ci/dev/fmt.sh", "lint": "./ci/dev/lint.sh", + "lint:helm": "./ci/dedv/helm.sh", "lint:sh": "shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files '*.sh' | grep -v 'lib/vscode')", "test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1", "ci": "./ci/dev/ci.sh",