11name : Vulnerabilities Report
2+ <<<<<<< HEAD
23description : Generates and uploads a vulnerability report from an SBOM for the given image.
4+ =======
5+ >>>>>>> e78d94f (new CI workflow template)
36
47inputs :
58 build_datetime :
@@ -8,11 +11,18 @@ inputs:
811 build_timestamp :
912 description : Build timestamp, set by the CI/CD pipeline workflow
1013 required : true
14+ <<<<<<< HEAD
15+ =======
16+ project_name :
17+ description : Project Name
18+ required : true
19+ >>>>>>> e78d94f (new CI workflow template)
1120 image_name :
1221 description : Docker Image to be scanned
1322 required : true
1423 sbom_repository_report :
1524 description : File path of SBOM report
25+ <<<<<<< HEAD
1626 required : true
1727
1828runs :
@@ -28,13 +38,32 @@ runs:
2838 VULNERABILITIES_REPOSITORY_REPORT : ${{ inputs.image_name }}-vulnerabilities-repository-report
2939 VULNERABILITIES_SUMMARY_LOGFILE : ${{ inputs.image_name }}-vulnerabilities-summary.txt
3040 SBOM_REPOSITORY_REPORT : ${{ inputs.sbom_repository_report }}
41+ =======
42+ required : true
43+
44+ runs :
45+ using : composite
46+ env :
47+ BUILD_DATETIME : ${{ inputs.build_datetime }}
48+ CHECK_DOCKER_IMAGE : ${{ inputs.project_name }}-${{ inputs.image_name }}:latest
49+ FORCE_USE_DOCKER : true
50+ VULNERABILITIES_REPOSITORY_REPORT : ${{ inputs.image_name }}-vulnerabilities-repository-report
51+ VULNERABILITIES_SUMMARY_LOGFILE : ${{ inputs.image_name }}-vulnerabilities-summary.txt
52+ SBOM_REPOSITORY_REPORT : {{ inputs.sbom_repository_report }}
53+ steps :
54+ - name : Create vulnerabilites report
55+ >>>>>>> e78d94f (new CI workflow template)
3156 run : |
3257 mkdir vulnerabilities
3358 bash -x ${GITHUB_WORKSPACE}/templates/scripts/reports/scan-vulnerabilities.sh
3459 curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sudo sh -s -- -b /usr/local/bin
60+ <<<<<<< HEAD
3561
3662 SCAN_RESULTS=$(grype "${CHECK_DOCKER_IMAGE}" --scope all-layers)
3763 echo "${SCAN_RESULTS}" > "vulnerabilities/${VULNERABILITIES_REPOSITORY_REPORT}.json"
64+ =======
65+ SCAN_RESULTS=$(grype "${{ inputs.image_name }}:latest" --scope all-layers)
66+ >>>>>>> e78d94f (new CI workflow template)
3867
3968 # ANSI color codes
4069 RED="\033[0;31m"
4675 for SEVERITY in CRITICAL HIGH MEDIUM; do
4776 {
4877 echo
78+ <<<<<<< HEAD
4979 echo "${CHECK_DOCKER_IMAGE} : vulnerabilities"
5080 echo -e "=== ${RED}${SEVERITY}${RESET} Vulnerabilities list ==="
5181 # If grep finds nothing, we print a fallback message
6090 path : |
6191 vulnerabilities/${{ inputs.image_name }}-vulnerabilities-repository-report.json
6292 vulnerabilities/${{ inputs.image_name }}-vulnerabilities-summary.txt
93+ =======
94+ echo "${{ inputs.image_name }} : vulnerabilities"
95+ echo -e "=== ${RED}${SEVERITY}${RESET} Vulnerabilities list ==="
96+ # If grep finds nothing, we print a fallback message
97+ echo "${SCAN_RESULTS}" | grep -i "${SEVERITY}" || echo "No ${SEVERITY} vulnerabilities found."
98+ } | tee -a "vunerabilities/${VULNERABILITIES_SUMMARY_LOGFILE}"
99+ done
100+
101+ - name : Upload vulnerabilities report
102+ uses : actions/upload-artifact@v4
103+ with :
104+ name : ${{ env.VULNERABILITIES_REPOSITORY_REPORT }}.json
105+ path : |
106+ vulnerabilities/${{ env.VULNERABILITIES_REPOSITORY_REPORT }}.json
107+ vulnerabilities/${{ env.VULNERABILITIES_SUMMARY_LOGFILE }}.json
108+ >>>>>>> e78d94f (new CI workflow template)
63109 retention-days : 21
0 commit comments