added Trivy Report
This commit is contained in:
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -43,9 +43,15 @@ pipeline {
|
||||
stage('Security: Trivy Scan') {
|
||||
steps {
|
||||
container('trivy') {
|
||||
// Wir erstellen ein Verzeichnis für den Report
|
||||
sh 'mkdir -p reports'
|
||||
|
||||
// Der Befehl erzeugt die HTML-Datei
|
||||
// --format template: Nutzt ein Layout
|
||||
// --template "@/contrib/html.tpl": Das Standard-Trivy-Layout
|
||||
// Scannt das Dateisystem auf Schwachstellen (NuGet) und Secrets
|
||||
// --exit-code 1 lässt die Pipeline bei kritischen Fehlern abbrechen
|
||||
sh 'trivy fs --exit-code 1 --severity HIGH,CRITICAL .'
|
||||
sh 'trivy fs --exit-code 1 --severity HIGH,CRITICAL --format template --template "@/contrib/html.tpl" -o reports/trivy-report.html .'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +95,16 @@ pipeline {
|
||||
// Das **/ bedeutet: Suche in allen Unterordnern nach .xml Dateien
|
||||
junit testResults: '**/TestResults/*.xml', allowEmptyResults: true
|
||||
|
||||
// Dieser Schritt macht den Report im Jenkins-Menü links sichtbar
|
||||
publishHTML([
|
||||
allowMissing: false,
|
||||
alwaysLinkToLastBuild: true,
|
||||
keepAll: true,
|
||||
reportDir: 'reports',
|
||||
reportFiles: 'trivy-report.html',
|
||||
reportName: 'Trivy Security Report'
|
||||
])
|
||||
|
||||
// Meldet den Status zurück, wenn das Gitea-Plugin korrekt konfiguriert ist
|
||||
echo "Pipeline beendet: ${currentBuild.result}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user