Skip to content

Commit

Permalink
Use class variable instead of hardcoding the directory; #136
Browse files Browse the repository at this point in the history
  • Loading branch information
robertauer committed Dec 10, 2024
1 parent c8484a0 commit 12c2a30
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/com/cloudogu/ces/cesbuildlib/Trivy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class Trivy implements Serializable {
void saveFormattedTrivyReport(String format = TrivyScanFormat.HTML, String formattedTrivyReportFilename = "formattedTrivyReport", String trivyReportFile = "trivy/trivyReport.json") {
String fileExtension
String formatString
String trivyDirectory = "trivy/"
switch (format) {
case TrivyScanFormat.HTML:
formatString = "template --template \"@/contrib/html.tpl\""
Expand All @@ -126,7 +125,7 @@ class Trivy implements Serializable {
}
docker.image("aquasec/trivy:${trivyVersion}")
.inside("-v ${script.env.WORKSPACE}/.trivy/.cache:/root/.cache/") {
script.sh(script: "trivy convert --format ${formatString} --output ${trivyDirectory}${formattedTrivyReportFilename}.${fileExtension} ${trivyReportFile}")
script.sh(script: "trivy convert --format ${formatString} --output ${trivyDirectory}/${formattedTrivyReportFilename}.${fileExtension} ${trivyReportFile}")
}
script.archiveArtifacts artifacts: "${trivyDirectory}${formattedTrivyReportFilename}.*", allowEmptyArchive: true
}
Expand Down

0 comments on commit 12c2a30

Please sign in to comment.