22# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
33# SPDX-License-Identifier: Apache-2.0
44
5- name : " [Time Series Analytics] PR Scans "
6- run-name : " [Time Series Analytics] PR workflow (by @${{ github.actor }} via ${{ github.event_name }})"
5+ name : " [Time Series Analytics] Trivy filesystem, image and config scans "
6+ run-name : " [Time Series Analytics] Trivy filesystem, image and config scans workflow (by @${{ github.actor }} via ${{ github.event_name }})"
77
88
99# Only run at most 1 workflow concurrently per PR, unlimited for branches
1818 paths :
1919 - ' microservices/time-series-analytics/**'
2020
21- jobs :
22- zizmor-workflow-scan :
23- runs-on : ubuntu-22.04-32core-128GB
24- permissions :
25- contents : read
26- env :
27- ZIZMOR_VERSION : 1.5.2
28- steps :
29- - name : Checkout Code
30- uses : actions/checkout@v4
31- with :
32- persist-credentials : false
33-
34- - name : Install uv
35- uses : astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb
36-
37- - name : Run Zizmor Workflow Security Scan
38- continue-on-error : true
39- run : uvx zizmor=="$ZIZMOR_VERSION" "$GITHUB_WORKSPACE" --no-exit-codes > zizmor_workflow_scan_report.txt
40-
41- - name : Upload Zizmor Scan Report
42- uses : actions/upload-artifact@v4
43- if : always()
44- with :
45- name : zizmor-workflow-security-report
46- path : zizmor_workflow_scan_report.txt
47-
21+ jobs :
4822 trivy-scan-job :
4923 permissions :
5024 contents : read
5428 uses : actions/checkout@v4
5529 with :
5630 persist-credentials : false
57- - name : trivy repo scan
31+ - name : Install Trivy from Aqua Security APT repo
32+ run : |
33+ sudo apt-get update
34+ sudo apt-get install -y gnupg lsb-release wget apt-transport-https curl jq
35+ curl -fsSL https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo gpg --dearmor -o /usr/share/keyrings/trivy.gpg
36+ echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -cs) main" | \
37+ sudo tee /etc/apt/sources.list.d/trivy.list > /dev/null
38+ sudo apt-get update
39+ sudo apt-get install -y trivy
40+ - name : Trivy filesystem/repo scan
5841 continue-on-error : true
5942 shell : bash
6043 run : |
@@ -65,37 +48,66 @@ jobs:
6548 trivy image --download-db-only
6649 curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/html.tpl -o trivy-html.tpl
6750 # Use the downloaded template
68- trivy fs . --format template --template "@trivy-html.tpl" -o "trivy_fs_code_scan.html"
51+ trivy fs . --format template --template "@trivy-html.tpl" -o "trivy_fs_code_scan.html"
52+ trivy fs --list-all-pkgs --format template --template "@trivy-html.tpl" --output trivy-fs-full-report.csv .
53+ trivy fs --ignore-unfixed . | tee trivy-fs-full-report.txt
6954
70- - name : Upload trivy reports
55+ - name : Upload trivy filesystem/repo scan reports
7156 continue-on-error : true
7257 uses : actions/upload-artifact@v4
7358 if : always()
7459 with :
75- name : trivy-code- scan-results-core
60+ name : Trivy FileSystem scan report
7661 path : |
7762 microservices/time-series-analytics/trivy_fs_code_scan.html
63+ microservices/time-series-analytics/trivy-fs-full-report.csv
64+ microservices/time-series-analytics/trivy-fs-full-report.txt
7865
7966 - name : Trivy Image Scan
8067 continue-on-error : true
8168 shell : bash
8269 run : |
8370 pwd
84- curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/html.tpl -o trivy-html.tpl
8571 echo "Building Time Series Analytics scanning"
8672 cd microservices/time-series-analytics/docker
8773 sed -i -e "s|TIME_SERIES_ANALYTICS_IMAGE=.*|TIME_SERIES_ANALYTICS_IMAGE=ia-time-series-analytics-microservice:latest|g" .env
8874 docker compose build
75+ curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/html.tpl -o trivy-html.tpl
8976 trivy image ia-time-series-analytics-microservice:latest --ignore-unfixed --format template --template "@trivy-html.tpl" -o trivy_image_scan.html
9077 trivy image --quiet --format spdx-json --output trivy_image_scan.spdx.json ia-time-series-analytics-microservice:latest
9178 echo "completed Time Series Analytics scanning"
9279
93- - name : Upload Trivy Image Report
80+ - name : Upload Trivy Image Scan Report
9481 continue-on-error : true
9582 if : always()
9683 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
9784 with :
98- name : Trivy image scan report-core
85+ name : Trivy image scan report
9986 path : |
100- microservices/time-series-analytics/trivy_image_scan.html
101- microservices/time-series-analytics/trivy_image_scan.spdx.json
87+ microservices/time-series-analytics/docker/trivy_image_scan.html
88+ microservices/time-series-analytics/docker/trivy_image_scan.spdx.json
89+
90+ - name : Trivy config scan for helm charts
91+ run : |
92+ cd microservices/time-series-analytics/helm
93+ trivy config . >> trivy_helm.txt
94+
95+ - name : Upload Scan artifact to Github
96+ uses : actions/upload-artifact@v4
97+ with :
98+ name : Trivy Config Scan for Helm
99+ path : microservices/time-series-analytics/helm/trivy_*
100+
101+ trivy-config-dockerfile-scan :
102+ permissions :
103+ contents : read
104+ name : Scan Dockerfile
105+ strategy :
106+ fail-fast : false
107+ uses : ./.github/workflows/trivy-config-mode.yaml
108+ with :
109+ dockerfile-path : microservices/time-series-analytics/Dockerfile
110+ trivy-report-format : ' json'
111+ severity-levels : ' HIGH,CRITICAL'
112+ output-report-path : trivy-dockerfile.json
113+ name : Time Series Dockerfile
0 commit comments