Skip to content

Enable all feature gates during development #211

Enable all feature gates during development

Enable all feature gates during development #211

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:
cache:
# Run only one of these jobs at a time across the entire project.
concurrency: { group: trivy-cache }
# Do not fail this workflow when this job fails.
continue-on-error: true
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Download Trivy
uses: ./.github/actions/trivy
env:
TRIVY_DEBUG: true
TRIVY_DOWNLOAD_DB_ONLY: true
TRIVY_NO_PROGRESS: true
TRIVY_SCANNERS: license,secret,vuln
licenses:
# Run this job after the cache job regardless of its success or failure.
needs: [cache]
if: >-
${{ !cancelled() }}
runs-on: ubuntu-24.04
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: ./.github/actions/trivy
env:
TRIVY_DEBUG: true
TRIVY_EXIT_CODE: 1
TRIVY_SCANNERS: license
with:
cache: restore,use
database: skip
vulnerabilities:
# Run this job after the cache job regardless of its success or failure.
needs: [cache]
if: >-
${{ github.repository == 'CrunchyData/postgres-operator' && !cancelled() }}
permissions:
security-events: write
runs-on: ubuntu-24.04
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: ./.github/actions/trivy
env:
TRIVY_SCANNERS: secret,vuln
with:
cache: restore,use
database: skip
# Produce a SARIF report of actionable results. This step fails only when
# Trivy is unable to scan.
- name: Report actionable vulnerabilities
uses: ./.github/actions/trivy
env:
TRIVY_IGNORE_UNFIXED: true
TRIVY_FORMAT: 'sarif'
TRIVY_OUTPUT: 'trivy-results.sarif'
TRIVY_SCANNERS: secret,vuln
with:
cache: use
database: skip
setup: none
# 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'