@@ -38,6 +38,9 @@ public Result runCommand() throws Exception
3838 {
3939 boolean passed = true ;
4040 int Ycritical = 0 , Yhigh = 0 , Ymedium = 0 , Ylow = 0 ;
41+ int timeout = 0 ;
42+ int timeoutTime = 60000 ;
43+ int timeLimit = 900000 ;
4144
4245 FortifyRequest request = new FortifyRequest ("" , "" , "" , true );
4346 request .setUsername (configVars .getValue (FortifyTask .USERNAME ));
@@ -50,6 +53,24 @@ public Result runCommand() throws Exception
5053 int projectId = getProjectId (request );
5154 log ("Project ID: " + projectId + "\n " );
5255
56+ JSONArray array = getDataArrayArtifacts (request , projectId );
57+
58+ while (isUnsuccessfulScan (array )) {
59+ array = getDataArrayArtifacts (request , projectId );
60+
61+ timeout = timeout + timeoutTime ;
62+
63+ log ("Couldn't find latest scan. Waiting for 1 minute and trying again ..." );
64+
65+ if (timeout > timeLimit ) {
66+ return new Result (false , "[Fortify] Error ! " +
67+ "Couldn't find a Fortify scan created in this pipeline run !" + "\n " );
68+ }
69+
70+ Thread .sleep (timeoutTime );
71+ }
72+ passed = true ;
73+
5374 JSONArray pointArrayData = getPointsArrayIssuePriority (request , projectId );
5475
5576 if (pointArrayData .length () > 0 ) {
@@ -79,22 +100,14 @@ public Result runCommand() throws Exception
79100 passed = false ;
80101 }
81102
82- JSONArray array = getDataArrayArtifacts (request , projectId );
83-
84- if (isUnsuccessfulScan (array ))
85- {
86- passed = false ;
87- }
88-
89103 log ("Link to the scan: " + "https://v-fortifyapp/ssc/html/ssc/index.jsp#!/version/"
90104 + projectId + "/scan" + "\n " );
91105
92106 if (passed )
93107 return new Result (true , "Finished" );
94108 else
95109 return new Result (false , "[Fortify] Error ! There may be: \n - critical or high priority " +
96- "issues\n - the name of the filescan doesn't match the pipeline counter\n " +
97- "- there are scans which require approval" + "\n " );
110+ "issues\n " + "- there are scans which require approval" + "\n " );
98111 }
99112
100113 public boolean isUnsuccessfulScan (JSONArray array )
0 commit comments