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

Add yaml lint GitHub Action #447

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .github/workflows/charts-release-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
# Run the helm chart release command
git config user.email "[email protected]"

# Run the helm chart release command
- name: Run csm chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
with:
charts_dir: charts
skip_existing: true
36 changes: 18 additions & 18 deletions .github/workflows/helm-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
check_files:
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.diff.outputs.run_tests }}
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
- 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
lint:
runs-on: ubuntu-latest
Expand All @@ -35,19 +35,19 @@ jobs:
# Check out the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: "0"
# Lint and version increment checks on updated charts
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
with:
command: lint
config: lintConfig.yaml
# This job checks that dependency versions have been updated on the karavi-observability chart

# 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
Expand All @@ -57,9 +57,9 @@ jobs:
# Check out the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: "0"
with:
fetch-depth: "0"

# Run a check on karavi-observability chart for updated dependency versions
- name: Run dependency version checks
id: lint
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/kubelinter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ jobs:
with:
directory: charts/cosi
config: kubelinter-config.yaml

4 changes: 2 additions & 2 deletions .github/workflows/wizard-release-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

# Run the helm chart release command
- name: Run csm chart-releaser for container-storage-modules
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
with:
charts_dir: installation-wizard
skip_existing: true
22 changes: 22 additions & 0 deletions .github/workflows/yamllinter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This action checks the linting errors in yaml files
name: yaml-lint

on:
pull_request:
branches:
- main
- release-v*

jobs:
yaml_lint_scan:
name: Run Yaml Lint
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install yamllint
- run: yamllint .
34 changes: 34 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
yaml-files:
- "*.yaml"
- "*.yml"
- ".yamllint"

rules:
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start: disable
empty-lines: enable
empty-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy:
level: warning

ignore:
- .github/workflows/
Loading