Skip to content

Commit

Permalink
cx-client-common release (#247)
Browse files Browse the repository at this point in the history
* Remove the Swagger call

* Latest Jenkins plugin override SCA team with "All Users" values

---------

Co-authored-by: Swati Awate <swati.awate@checkmarx.com>
  • Loading branch information
swatipersistent and Swati Awate authored Apr 8, 2024
1 parent 48dd960 commit f48efbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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
8 changes: 6 additions & 2 deletions src/main/java/com/cx/restclient/ast/AstScaClient.java
Original file line number Diff line number Diff line change
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

0 comments on commit f48efbc

Please sign in to comment.