1
0
mirror of https://github.com/stackrox/kube-linter-action.git synced 2026-07-04 23:51:37 +00:00
Files
kube-linter-action/.github/workflows/self-test.yml
T
dependabot[bot] 35a85230e1 Bump actions/checkout from 6 to 7
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-18 16:42:39 +00: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@v7
- 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@v7
# 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@v7
# 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@v7
- 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" ]]