-
Notifications
You must be signed in to change notification settings - Fork 32
101 lines (90 loc) · 3.33 KB
/
trivy-main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
###############################################################
# Copyright (c) 2022 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
###############################################################
# Depending on the location of your Docker container
# you need to change the path to the specific Docker registry.
#
name: 'Trivy Main'
on:
push:
branches: [main]
# pull_request:
# The branches below must be a subset of the branches above
# branches: [ main ]
# paths-ignore:
# - "**/*.md"
# - "**/*.txt"
schedule:
# Once a day
- cron: '0 0 * * *'
workflow_dispatch:
# Trigger manually
env:
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-frontend'
jobs:
analyze-config:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@5681af892cd0f4997658e2bacc62bd0a894cf564 # v0.27.0
with:
scan-type: 'config'
hide-progress: false
format: 'sarif'
output: 'trivy-results1.sarif'
vuln-type: 'os,library'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
if: always()
with:
sarif_file: 'trivy-results1.sarif'
analyze-portal-frontend:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
# It's also possible to scan your private registry with Trivy's built-in image scan.
# All you have to do is set ENV vars.
# Docker Hub needs TRIVY_USERNAME and TRIVY_PASSWORD.
# You don't need to set ENV vars when downloading from a public repository.
# For public images, no ENV vars must be set.
- name: Run Trivy vulnerability scanner
if: always()
uses: aquasecurity/trivy-action@5681af892cd0f4997658e2bacc62bd0a894cf564 # v0.27.0
with:
# Path to Docker image
image-ref: '${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:main'
format: 'sarif'
output: 'trivy-results2.sarif'
vuln-type: 'os,library'
- name: Upload Trivy scan results to GitHub Security tab
if: always()
uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
with:
sarif_file: 'trivy-results2.sarif'