Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update helm chart validation action #449

Merged
merged 9 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 23 additions & 46 deletions .github/workflows/helm-validations.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,46 @@
# This action checks the Helm Chart changes for linting and version updates
# This action checks the Helm Chart changes for linting
name: helm-validations

# Check runs on PRs created to merge to main branch
on:
pull_request:
branches:
- main
- karavi-observability-release
- csm-authorization-release
- release-v*

jobs:
# This job will check to see if any .yaml file is modified
check_files:
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.diff.outputs.run_tests }}
steps:
- uses: actions/checkout@v4
- name: Check for files changed
id: diff
run: |
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
FILES=$(curl -s -X GET -G $URL | jq -r '.[] | .filename')
echo $FILES | grep \.yaml && echo '::set-output name=run_tests::true' || true

# This job will run helm lint and version increment check on updated charts
# This job will run helm lint on updated charts
lint:
name: CSM Chart Linter
runs-on: ubuntu-latest
# Only run job when .yaml file is changed
needs: check_files
if: needs.check_files.outputs.run_tests == 'true'
steps:
# Check out the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: "0"

# Lint and version increment checks on updated charts
- name: Run lint/version increment checks
id: versionIncrement
# Bump to proper version after this issue is fixed : https://github.com/helm/chart-testing-action/issues/132
uses: helm/chart-testing-action@cb49023b9227b1097e5eddd8824f48bdea11b1aa
- name: Set up Helm
uses: azure/setup-helm@v4.2.0
with:
command: lint
config: lintConfig.yaml
version: latest

# This job checks that dependency versions have been updated on the karavi-observability chart
dependency:
runs-on: ubuntu-latest
# Only run job when .yaml file is changed
needs: check_files
if: needs.check_files.outputs.run_tests == 'true'
steps:
# Check out the repo
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
shaynafinocchiaro marked this conversation as resolved.
Show resolved Hide resolved
fetch-depth: "0"
python-version: '3.10'

shaynafinocchiaro marked this conversation as resolved.
Show resolved Hide resolved
# Run a check on karavi-observability chart for updated dependency versions
- name: Run dependency version checks
id: lint
uses: helm/chart-testing-action@cb49023b9227b1097e5eddd8824f48bdea11b1aa
with:
command: lint
config: dependencyConfig.yaml
- name: Install chart-testing-action
uses: helm/chart-testing-action@v2.6.1

- name: Run chart-testing list-changed
id: modified-charts
run: |
modified=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$modified" ]]; then
echo "modified=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing linter
if: steps.modified-charts.outputs.modified == 'true'
run: ct lint --config ct.yaml
19 changes: 13 additions & 6 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ yaml-files:
- ".yamllint"

rules:
braces: enable
brackets: enable
braces:
level: warning
max-spaces-inside: 1
brackets:
level: warning
max-spaces-inside: 1
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
comments-indentation: disable
document-end: disable
document-start: disable
empty-lines: enable
Expand All @@ -30,5 +33,9 @@ rules:
truthy:
level: warning

ignore:
- .github/workflows/
ignore: |
.github/workflows/
charts/*/templates/
charts/*/*/*/templates/
charts/csi-powermax/charts/csireverseproxy/conf/config.yaml
charts/csm-replication/crds/replicationcrds.all.yaml
7 changes: 7 additions & 0 deletions ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See https://github.com/helm/chart-testing#configuration
remote: origin
target-branch: main
# Not executed on installation-wizard because of the dependency on other charts
chart-dirs:
- charts
validate-maintainers: false
5 changes: 0 additions & 5 deletions dependencyConfig.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions lintConfig.yaml

This file was deleted.

Loading