Skip to content

Commit

Permalink
Add kube-linter to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisDuarte1 committed Aug 25, 2023
1 parent e32647c commit c8502a2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/kube-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Check Kubernetes YAMLs with kube-linter

on:
pull_request:

jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# This prepares directory where github/codeql-action/upload-sarif@v1 looks up report files by default.
- name: Create ../results directory for SARIF report files
shell: bash
run: mkdir -p ../results

- name: Scan yaml files with kube-linter
uses: stackrox/[email protected]
id: kube-linter-action-scan
with:
# Adjust this directory to the location where your kubernetes resources and helm charts are located.
directory: "**"
# Adjust this to the location of kube-linter config you're using, or remove the setting if you'd like to use
# the default config.
config: .kube-linter.yaml
# The following two settings make kube-linter produce scan analysis in SARIF format which would then be
# made available in GitHub UI via upload-sarif action below.
format: sarif
output-file: ../results/kube-linter.sarif
# The following line prevents aborting the workflow immediately in case your files fail kube-linter checks.
# This allows the following upload-sarif action to still upload the results to your GitHub repo.
continue-on-error: true

- name: Upload SARIF report files to GitHub
uses: github/codeql-action/upload-sarif@v1

# Ensure the workflow eventually fails if files did not pass kube-linter checks.
- name: Verify kube-linter-action succeeded
shell: bash
run: |
echo "If this step fails, kube-linter found issues. Check the output of the scan step above."
[[ "${{ steps.kube-linter-action-scan.outcome }}" == "success" ]]
1 change: 1 addition & 0 deletions .kube-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#for future configuration of kube linter

0 comments on commit c8502a2

Please sign in to comment.