Skip to content

Commit

Permalink
(baobab) Update CI Helm Lint workflow to include pull request events (#…
Browse files Browse the repository at this point in the history
…176)

* feat: Add actions workflow to linting helm charts

* feat: Update Helm setup and linting process

* feat: Update helm chart change detection logic

* fix: Fix can't detect changed charts

* feat: Update ci.helm-lint.yaml to set output variable for changed charts

* feat: Stop workflow when lint returned ERROR

* fix: Update Helm lint command to check for "failed" instead of "[ERROR]".

* fix: Fix workflow can't find HEAD~1 git commit

* feat: Make workflow be failed when Lint returned error

* feat: Store failed services to output of workflow

* refactor: Remove unnecessary code in ci.helm-lint.yaml

* feat: Add failed services output to GitHub Actions workflow

* fix: Fix linting script to display failed services

* feat: Update CI Helm Lint workflow to include pull request events

* fix: Remove unnecessary branches from CI workflow
  • Loading branch information
jay-bisonai authored Feb 13, 2024
1 parent abe4e6a commit 8d94e05
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.helm-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI Helm Lint

on:
workflow_dispatch:
pull_request:
types:
- opened
branches:
- gcp-baobab-prod

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run Helm lint
uses: WyriHaximus/github-action-helm3@v3
id: lint
with:
exec: |
failed_services=""
for file in $(git diff --name-only HEAD~1..HEAD); do
dir=$(dirname $file)
if [ -f "$dir/Chart.yaml" ]; then
if ! helm lint $dir; then
failed_services+="'$(basename $dir)', "
fi
fi
done
if [ -n "$failed_services" ]; then
# Remove the trailing comma and space
failed_services=${failed_services%??}
echo "failed_services=$failed_services" >> $GITHUB_OUTPUT
fi
- name: Failed services
if: steps.lint.outputs.failed_services
run: |
echo "Failed services: ${{ steps.lint.outputs.failed_services }}"
exit 1

0 comments on commit 8d94e05

Please sign in to comment.