1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/.github/workflows/report-on-vulnerabilities.yaml
dependabot[bot] f8c3f2b530
chore(deps): bump actions/checkout from 3.3.0 to 3.4.0 (#6591)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](ac59398561...24cb908017)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-16 09:25:58 +00:00

68 lines
2.2 KiB
YAML

name: report-on-vulnerabilities
on:
workflow_dispatch: {}
schedule:
- cron: '23 2 * * *' # Every day at 02:23
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
scan:
runs-on: ubuntu-20.04
permissions:
contents: read
outputs:
results: ${{ steps.parse-results.outputs.results }}
steps:
- name: Scan for vulnerabilities
uses: aquasecurity/trivy-action@1f0aa582c8c8f5f7639610d6d38baddfea4fdcee # v0.8.0 (Trivy v0.34.0)
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
format: json
ignore-unfixed: false
severity: HIGH,CRITICAL
output: scan.json
- name: Parse scan results
id: parse-results
continue-on-error: true
run: |
VULNS=$(cat scan.json | jq '.Results[] | has("Vulnerabilities")')
if echo $VULNS | grep -q 'true'; then
echo "Vulnerabilities found, creating issue"
echo "results=$(cat scan.json)" >> $GITHUB_OUTPUT
else
echo "No vulnerabilities found, halting"
echo "results=nothing" >> $GITHUB_OUTPUT
fi
- name: Upload vulnerability scan report
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: contains(steps.parse-results.outputs.results, 'SchemaVersion')
with:
name: scan.json
path: scan.json
if-no-files-found: error
open-issue:
runs-on: ubuntu-latest
if: contains(needs.scan.outputs.results, 'SchemaVersion')
needs: scan
steps:
- name: Checkout
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- name: Setup build env
uses: ./.github/actions/setup-build-env
- name: Download scan
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: scan.json
- name: Set scan output
id: set-scan-output
run: echo "results=$(cat scan.json)" >> $GITHUB_OUTPUT
- uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd # v2.9.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RESULTS: ${{ steps.set-scan-output.outputs.results }}
with:
filename: .github/VULN_TEMPLATE.md