Skip to content

Commit

Permalink
Fix codenarc violation.
Browse files Browse the repository at this point in the history
  • Loading branch information
zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL committed Sep 13, 2024
1 parent 35f98fb commit 4588cb3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/org/ods/component/ScanWithAquaStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,7 @@ class ScanWithAquaStage extends Stage {
notifyAquaProblem(alertEmails, errorMessages)

if (actionableVulnerabilities?.size() > 0) { // We need to mark the pipeline and delete the image
context.addArtifactURI('aquaCriticalVulnerability', actionableVulnerabilities)
context.addArtifactURI('jiraComponentId', context.getComponentId())
context.addArtifactURI('gitUrl', context.getGitUrl())
context.addArtifactURI('gitBranch', context.getGitBranch())
context.addArtifactURI('repoName', context.getRepoName())
context.addArtifactURI('nexusReportLink', nexusReportLink)
addAquaVulnerabilityObjectsToContext(actionableVulnerabilities, nexusReportLink)
String response = openShift.deleteImage(context.getComponentId() + ":" + context.getShortGitCommit())
logger.debug("Delete image response: " + response)
throw new AquaRemoteCriticalVulnerabilityWithSolutionException(
Expand All @@ -154,6 +149,15 @@ class ScanWithAquaStage extends Stage {
return
}

private void addAquaVulnerabilityObjectsToContext(List actionableVulnerabilities, String nexusReportLink) {
context.addArtifactURI('aquaCriticalVulnerability', actionableVulnerabilities)
context.addArtifactURI('jiraComponentId', context.getComponentId())
context.addArtifactURI('gitUrl', context.getGitUrl())
context.addArtifactURI('gitBranch', context.getGitBranch())
context.addArtifactURI('repoName', context.getRepoName())
context.addArtifactURI('nexusReportLink', nexusReportLink)
}

private String buildActionableMessageForAquaVulnerabilities(Map args) {
StringBuilder message = new StringBuilder();
message.append("We detected remotely exploitable critical vulnerabilities in ${args.gitUrl} " +
Expand Down

0 comments on commit 4588cb3

Please sign in to comment.