Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkins Plugin Release Plugin Version 2024.1.2 #248

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/com/cx/restclient/CxSASTClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,8 @@ private boolean isScanWithSettingsSupported() {
HashMap swaggerResponse = this.httpClient.getRequest(SWAGGER_LOCATION, CONTENT_TYPE_APPLICATION_JSON, HashMap.class, 200, SAST_SCAN, false);
return swaggerResponse.toString().contains("/sast/scanWithSettings");
} catch (Exception e) {
return false;
// Assuming something went wrong but SAST version is greater than 9.x
return true;
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/cx/restclient/ast/AstScaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ public Results waitForScanResults() {
}

fileName = PDF_REPORT_NAME + "_" + now + "." + reportFormat.toLowerCase();
String pdfLink = SASTUtils.writePDFReport(scanReport, config.getReportsDir(), fileName, log);
if (reportFormat.toLowerCase().equals("pdf")) {
String pdfLink = SASTUtils.writePDFReport(scanReport, config.getReportsDir(), fileName, log);
scaResults.setScaPDFLink(pdfLink);
scaResults.setPdfFileName(fileName);
}
Expand Down Expand Up @@ -921,7 +921,7 @@ private String resolveRiskManagementProject() throws IOException {
log.info("Created a project with ID {}", resolvedProjectId);
} else {
log.info("Project already exists with ID {}", resolvedProjectId);
UpdateRiskManagementProject(resolvedProjectId,projectCustomTag);
UpdateRiskManagementProject(resolvedProjectId,projectCustomTag,assignedTeam);
}
return resolvedProjectId;
}
Expand Down Expand Up @@ -1040,12 +1040,16 @@ private String createRiskManagementProject(String name, String assignedTeam, Str
return newProject.getId();
}

private void UpdateRiskManagementProject(String projectId, String customTags) throws IOException {
private void UpdateRiskManagementProject(String projectId, String customTags, String assignedTeam) throws IOException {
Project existingProject = httpClient.getRequest(PROJECTID.replace("id",projectId),ContentType.CONTENT_TYPE_APPLICATION_JSON,Project.class,
HttpStatus.SC_OK,"got project details",false);

UpdateProjectRequest request = new UpdateProjectRequest();
request.setName(existingProject.getName());
if (!StringUtils.isEmpty(assignedTeam)) {
request.addAssignedTeams(assignedTeam);
log.info("Team name: {}", assignedTeam);
}

log.info("Project level custom tag name: {}",customTags);
if(existingProject.getTags()!=null){
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/cx/restclient/sast/utils/LegacyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public long resolveProjectId() throws IOException {
}
} else {
projectId = projects.get(0).getId();
if(config.isEnableDataRetention()) {
setRetentionRate(projectId);
}
setIsNewProject(false);
log.info("Project already exists with ID {}", projectId);
}
Expand Down