-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot-github_actions-azure-setup-helm-4
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: 'Trivy Scan Docker and Repository' | ||
on: | ||
workflow_call: | ||
inputs: | ||
javaVersion: | ||
required: false | ||
type: string | ||
default: '17' | ||
buildCommand: | ||
required: false | ||
type: string | ||
sarif: | ||
required: false | ||
description: 'Whether to generate a sarif report, otherwise a table is generated.' | ||
type: string | ||
default: 'false' | ||
severity: | ||
required: true | ||
description: 'The severity of the vulnerabilities to report.' | ||
type: string | ||
default: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL' | ||
checkoutSubmodule: | ||
required: false | ||
description: 'Whether to checkout submodules.' | ||
type: string | ||
default: 'true' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
image: | ||
name: 'Trivy Image Scan' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: ${{ inputs.checkoutSubmodule }} | ||
|
||
- name: Build project | ||
uses: UKHomeOffice/sas-github-workflows/.github/actions/gradle-build-project@v2 | ||
with: | ||
java_version: ${{ inputs.javaVersion }} | ||
build_command: ${{ inputs.buildCommand }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Scan image | ||
uses: UKHomeOffice/sas-github-workflows/.github/actions/trivy-image-scan@v2 | ||
with: | ||
sarif: ${{ inputs.sarif }} | ||
severity: ${{ inputs.severity }} | ||
|
||
repo: | ||
name: 'Trivy Repo Scan' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: ${{ inputs.checkoutSubmodule }} | ||
|
||
- name: Scan repository | ||
uses: UKHomeOffice/sas-github-workflows/.github/actions/trivy-repo-scan@v2 | ||
with: | ||
sarif: ${{ inputs.sarif }} | ||
severity: ${{ inputs.severity }} |