Skip to content

Commit 36d0ab2

Browse files
Move trivy to separate workflow (#1341)
* Move trivy to separate workflow * Trigger tests --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 6c10093 commit 36d0ab2

File tree

2 files changed

+61
-41
lines changed

2 files changed

+61
-41
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -58,47 +58,6 @@ jobs:
5858
- name: Success
5959
run: echo "Success!"
6060

61-
# Upload Trivy data
62-
trivy:
63-
if: success() || failure() # Does not run on cancelled workflows
64-
runs-on: ubuntu-20.04
65-
needs:
66-
- tests
67-
68-
steps:
69-
# Git Checkout
70-
- name: Checkout Code
71-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
72-
with:
73-
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
74-
fetch-depth: 0
75-
76-
- name: Run Trivy vulnerability scanner in repo mode
77-
if: ${{ github.event_name == 'pull_request' }}
78-
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
79-
with:
80-
scan-type: "fs"
81-
ignore-unfixed: true
82-
format: table
83-
exit-code: 1
84-
severity: "CRITICAL,HIGH,MEDIUM,LOW"
85-
86-
- name: Run Trivy vulnerability scanner in repo mode
87-
if: ${{ github.event_name == 'schedule' }}
88-
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
89-
with:
90-
scan-type: "fs"
91-
ignore-unfixed: true
92-
format: "sarif"
93-
output: "trivy-results.sarif"
94-
severity: "CRITICAL,HIGH,MEDIUM,LOW"
95-
96-
- name: Upload Trivy scan results to GitHub Security tab
97-
if: ${{ github.event_name == 'schedule' }}
98-
uses: github/codeql-action/upload-sarif@v3
99-
with:
100-
sarif_file: "trivy-results.sarif"
101-
10261
# Combine and upload coverage data
10362
coverage:
10463
if: success() || failure() # Does not run on cancelled workflows

.github/workflows/trivy.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
---
15+
name: Trivy
16+
17+
on:
18+
pull_request:
19+
20+
concurrency:
21+
group: ${{ github.ref || github.run_id }}-${{ github.workflow }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
# Upload Trivy data
26+
trivy:
27+
if: success() || failure() # Does not run on cancelled workflows
28+
runs-on: ubuntu-20.04
29+
steps:
30+
# Git Checkout
31+
- name: Checkout Code
32+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
33+
with:
34+
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
35+
fetch-depth: 0
36+
37+
- name: Run Trivy vulnerability scanner in repo mode
38+
if: ${{ github.event_name == 'pull_request' }}
39+
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
40+
with:
41+
scan-type: "fs"
42+
ignore-unfixed: true
43+
format: table
44+
exit-code: 1
45+
severity: "CRITICAL,HIGH,MEDIUM,LOW"
46+
47+
- name: Run Trivy vulnerability scanner in repo mode
48+
if: ${{ github.event_name == 'schedule' }}
49+
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
50+
with:
51+
scan-type: "fs"
52+
ignore-unfixed: true
53+
format: "sarif"
54+
output: "trivy-results.sarif"
55+
severity: "CRITICAL,HIGH,MEDIUM,LOW"
56+
57+
- name: Upload Trivy scan results to GitHub Security tab
58+
if: ${{ github.event_name == 'schedule' }}
59+
uses: github/codeql-action/upload-sarif@v3
60+
with:
61+
sarif_file: "trivy-results.sarif"

0 commit comments

Comments
 (0)