1
0
mirror of https://github.com/stackrox/kube-linter-action.git synced 2026-07-04 23:51:37 +00:00
Files
dependabot[bot] 8ed7cc3d11 Bump actions/checkout from 5 to 6 (#35)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-21 17:16:38 +01:00

115 lines
3.4 KiB
YAML

# This workflow is provided for testing changes to the action.
# When developing make sure that "Scan 2 - failing" produces expected kube-linter validation logs.
name: kube-linter-action development self-test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-scan:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
format: [ plain, json, sarif ]
version: [ latest, 0.2.3 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Scan 1 - should succeed
uses: ./
with:
directory: sample/valid-yaml
config: sample/.kube-linter-config.yaml
format: ${{ matrix.format }}
version: ${{ matrix.version }}
- name: Scan 2 - should fail
id: failing-scan
uses: ./
with:
directory: sample/invalid-yaml
config: sample/.kube-linter-config.yaml
format: ${{ matrix.format }}
version: ${{ matrix.version }}
continue-on-error: true
- name: Verify Scan 2 should have failed
shell: bash
run: |
echo "Verifying that kube-linter-action outcome (${{ steps.failing-scan.outcome }}) from Scan 2 is failure."
[[ "${{ steps.failing-scan.outcome }}" == "failure" ]]
test-with-sarif-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Setup directory where github/codeql-action/upload-sarif@v4 looks up files by default.
- name: Create ../results directory for sarif files
shell: bash
run: mkdir -p ../results
- name: Scan - should succeed
uses: ./
with:
directory: sample/valid-yaml
config: sample/.kube-linter-config.yaml
format: sarif
output-file: ../results/kube-linter-success.sarif
- name: Upload SARIF output file to GitHub
uses: github/codeql-action/upload-sarif@v4
test-with-sarif-upload-fail:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Setup directory where github/codeql-action/upload-sarif@v4 looks up files by default.
- name: Create ../results directory for sarif files
shell: bash
run: mkdir -p ../results
- name: Scan - should fail
uses: ./
with:
directory: sample/invalid-yaml
config: sample/.kube-linter-config.yaml
format: sarif
output-file: ../results/kube-linter-fail.sarif
continue-on-error: true
- name: Upload SARIF output file to GitHub
uses: github/codeql-action/upload-sarif@v4
test-fail-on-invalid-resource:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Scan 1 - should succeed
uses: ./
with:
directory: sample/non-kubernetes-yaml
config: sample/.kube-linter-config.yaml
- name: Scan 2 - should fail
id: failing-scan
uses: ./
with:
directory: sample/non-kubernetes-yaml
config: sample/.kube-linter-config.yaml
fail-on-invalid-resource: "true"
continue-on-error: true
- name: Verify Scan 2 should have failed
shell: bash
run: |
echo "Verifying that kube-linter-action outcome (${{ steps.failing-scan.outcome }}) from Scan 2 is failure."
[[ "${{ steps.failing-scan.outcome }}" == "failure" ]]