Skip to content

Refactor: Tidy some imports and tests #119

Refactor: Tidy some imports and tests

Refactor: Tidy some imports and tests #119

Workflow file for this run

# https://aquasecurity.github.io/trivy
name: Trivy
on:
pull_request:
push:
branches:
- main
env:
# Use the Go toolchain installed by setup-go
# https://github.com/actions/setup-go/issues/457
GOTOOLCHAIN: local
jobs:
licenses:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Trivy needs a populated Go module cache to detect Go module licenses.
- uses: actions/setup-go@v5
with: { go-version: stable }
- run: go mod download
# Report success only when detected licenses are listed in [/trivy.yaml].
- name: Scan licenses
uses: aquasecurity/[email protected]
env:
TRIVY_DEBUG: true
with:
scan-type: filesystem
scanners: license
exit-code: 1
vulnerabilities:
if: ${{ github.repository == 'CrunchyData/postgres-operator' }}
permissions:
security-events: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Print any detected secrets or vulnerabilities to the workflow log for
# human consumption. This step fails only when Trivy is unable to scan.
# A later step uploads results to GitHub as a pull request check.
- name: Log detected vulnerabilities
uses: aquasecurity/[email protected]
with:
scan-type: filesystem
hide-progress: true
scanners: secret,vuln
# Manage the cache only once during this workflow.
# - https://github.com/aquasecurity/trivy-action#cache
cache: true
# Produce a SARIF report of actionable results. This step fails only when
# Trivy is unable to scan.
- name: Report actionable vulnerabilities
uses: aquasecurity/[email protected]
with:
scan-type: filesystem
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
scanners: secret,vuln
# Use the cache downloaded in a prior step.
# - https://github.com/aquasecurity/trivy-action#cache
cache: false
# Submit the SARIF report to GitHub code scanning. Pull requests checks
# succeed or fail according to branch protection rules.
# - https://docs.github.com/en/code-security/code-scanning
- name: Upload results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'