Skip to content

Commit

Permalink
Update wording on Fortify SSC in plugin logs
Browse files Browse the repository at this point in the history
  • Loading branch information
akaryakina committed Oct 25, 2023
1 parent 1d9723d commit 4c85ab9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
21 changes: 13 additions & 8 deletions src/main/java/com/fortify/plugin/jenkins/steps/FortifyStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,20 @@ protected String resolve(String param, TaskListener listener) {
if (lastBuild == null) {
return param;
}
listener = listener == null ? new StreamBuildListener(System.out, Charset.defaultCharset()) : listener;
try {
// TODO: see at lastBuild.getBuildVariableResolver()
final EnvVars vars = lastBuild.getEnvironment(listener);
return vars.expand(param);
} catch (IOException e) {
// do nothing
} catch (InterruptedException e) {
// do nothing
// if we can parse it as an Integer, then there's no need to resolve the variable
Integer.parseInt(param);
} catch (NumberFormatException e1) {
listener = listener == null ? new StreamBuildListener(System.out, Charset.defaultCharset()) : listener;
try {
// TODO: see at lastBuild.getBuildVariableResolver()

Check warning on line 138 in src/main/java/com/fortify/plugin/jenkins/steps/FortifyStep.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: see at lastBuild.getBuildVariableResolver()
final EnvVars vars = lastBuild.getEnvironment(listener);
return vars.expand(param);
} catch (IOException e2) {
// do nothing
} catch (InterruptedException e3) {
// do nothing
}
}

Check warning on line 146 in src/main/java/com/fortify/plugin/jenkins/steps/FortifyStep.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 134-146 are not covered by tests
return param;
}
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/com/fortify/plugin/jenkins/steps/FortifyUpload.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public Integer performAndReturnIssueCount(Run<?, ?> run, FilePath workspace, Env
Long artifactId = uploadToSSC(summary, workspace, listener);
pollFprProcessing(run, artifactId, listener);

log.println("Retrieving build statistics from SSC");
log.println("Retrieving build statistics from Fortify Software Security Center");
calculateFprStatistics(summary, listener);

log.printf("Calculated NVS=%f, failedCount=%d%n", summary.getNvs(), summary.getFailedCount());
Expand Down Expand Up @@ -291,7 +291,7 @@ private Long uploadToSSC(FPRSummary summary, FilePath workspace, TaskListener li
if (!StringUtils.isBlank(getResolvedAppName(listener)) && !StringUtils.isBlank(getResolvedAppVersion(listener))
&& FortifyPlugin.DESCRIPTOR.canUploadToSsc()) {
// the FPR may be in remote slave, we need to call launcher to do this for me
log.printf("Uploading analysis results file to SSC at %s to application '%s' and application version '%s'%n",
log.printf("Uploading analysis results file to Fortify Software Security Center at %s to application '%s' and application version '%s'%n",
FortifyPlugin.DESCRIPTOR.getUrl(), getResolvedAppName(listener), getResolvedAppVersion(listener));
try {
final Long projectId = createNewOrGetProject(listener);
Expand All @@ -306,11 +306,11 @@ public Long runWith(FortifyClient client) throws Exception {
log.printf("Analysis results uploaded successfully. artifact id = %d%n", artifactId);
return artifactId;
} catch (Throwable t) {
log.println("Error uploading to SSC: " + FortifyPlugin.DESCRIPTOR.getUrl());
log.println("Error uploading to Fortify Software Security Center: " + FortifyPlugin.DESCRIPTOR.getUrl());
String message = t.getMessage();
log.println(message);
t.printStackTrace(log);
throw new AbortException("Error uploading to SSC: " + message);
throw new AbortException("Error uploading to Fortify Software Security Center: " + message);
} finally {
// if this is a remote FPR, I need to delete the local temp FPR after use
if (summary.getFprFile().isRemote()) {
Expand Down Expand Up @@ -378,15 +378,15 @@ public Artifact.StatusEnum runWith(FortifyClient client) throws Exception {
isProcessingComplete = true;
break;
case ERROR_PROCESSING:
throw new AbortException("SSC encountered an error processing the artifact");
throw new AbortException("Fortify Software Security Center encountered an error processing the artifact");
case REQUIRE_AUTH:
log.println("The artifact needs to be approved for processing in SSC. Will continue to wait...");
log.println("The artifact needs to be approved for processing in Fortify Software Security Center. Will continue to wait...");
break;
case SCHED_PROCESSING:
log.println("The artifact was scheduled for processing on SSC. Will continue to wait...");
log.println("The artifact was scheduled for processing on Fortify Software Security Center. Will continue to wait...");
break;
case PROCESSING:
log.println("The artifact is being processed by SSC. Will continue to wait...");
log.println("The artifact is being processed by Fortify Software Security Center. Will continue to wait...");
break;
default:
log.println("Unexpected artifact status: " + status.name());
Expand All @@ -400,7 +400,7 @@ public Artifact.StatusEnum runWith(FortifyClient client) throws Exception {
String message = t.getMessage();
log.println("Error checking artifact status. " + message);
t.printStackTrace(log);
throw new AbortException("Failed to retrieve artifact statistics from SSC. " + message);
throw new AbortException("Failed to retrieve artifact statistics from Fortify Software Security Center. " + message);
}

if (timeoutInMinutes > 0) {
Expand All @@ -417,8 +417,8 @@ private void setBuildUncompleted(Run<?, ?> run, PrintStream log, int timeoutInMi
final String appArtifactsURL = getAppArtifactsURL(projectVersionId);

run.setResult(Result.NOT_BUILT);
run.setDescription("A timeout has been reached when checking SSC for status of artifacts, this could happen " +
"on long running processing jobs and does not mean that the build failed. You can check the status in SSC here: " +
run.setDescription("A timeout has been reached when checking Fortify Software Security Center for status of artifacts, this could happen " +

Check warning on line 420 in src/main/java/com/fortify/plugin/jenkins/steps/FortifyUpload.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 228-420 are not covered by tests
"on long running processing jobs and does not mean that the build failed. You can check the status in Fortify Software Security Center here: " +
appArtifactsURL);
throw new AbortException("Timeout of " + timeoutInMinutes + " minute(s) is reached.");
}
Expand Down

0 comments on commit 4c85ab9

Please sign in to comment.