// logic run during a build @Override public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException { api.authenticate(); final PrintStream logger = listener.getLogger(); taskListener.set(listener); logger.println("Starting FoD Upload."); if (getAssessmentTypeId() == 0) { logger.println("Assessment Type is empty."); build.setResult(Result.FAILURE); } // zips the file in a temporary location File payload = CreateZipFile(workspace); if (payload.length() == 0) { logger.println("Source is empty for given Technology Stack and Language Level."); build.setResult(Result.FAILURE); } logger.println(jobModel.toString()); jobModel.setUploadFile(payload); boolean success = api.getStaticScanController().startStaticScan(jobModel); boolean deleted = payload.delete(); if (success && deleted) { logger.println("Scan Uploaded Successfully."); if (getDescriptor().getDoPollFortify() && jobModel.getPollingInterval() > 0) { PollStatus /*Amy*/ poller = new PollStatus(api, jobModel); success = poller.releaseStatus(getReleaseId()); } } // Success could be true then set to false from polling. api.retireToken(); build.setResult(success ? Result.SUCCESS : Result.UNSTABLE); }
/** * Gets the out for the build console output * * @return Task Listener object */ public static PrintStream getLogger() { return taskListener.get().getLogger(); }