@@ -105,19 +105,54 @@ private static boolean initialQDSetupRequired(BrowserStackCredentials browserSta
105105 return false ;
106106 }
107107
108- private static List <String > getAllPipelines (BrowserStackCredentials browserStackCredentials ) throws JsonProcessingException {
108+ private static List <String > getAllPipelines (BrowserStackCredentials browserStackCredentials ) {
109109 List <String > allPipelines = new ArrayList <>();
110110 Jenkins jenkins = Jenkins .getInstanceOrNull ();
111+ Integer totalPipelines = 0 ;
112+
111113 if (jenkins != null ) {
114+ totalPipelines = jenkins .getAllItems ().size ();
112115 jenkins .getAllItems ().forEach (job -> {
113- if (job instanceof WorkflowJob ) {
114- String pipelineName = job .getFullName ();
116+ try {
117+ // Logging job details
118+ apiUtil .logToQD (
119+ browserStackCredentials ,
120+ String .format (
121+ "Job name: %s, instance type: %s, and is_workflow_job: %s" ,
122+ job .getName (),
123+ job .getClass ().getSimpleName (),
124+ (job instanceof WorkflowJob ) ? "yes" : "no"
125+ )
126+ );
127+ } catch (JsonProcessingException e ) {
128+ // Handling the exception and logging an error
129+ System .err .println ("Error processing JSON for job: " + job .getName ());
130+ e .printStackTrace ();
131+ }
132+
133+ if (job instanceof WorkflowJob ) {
134+ String pipelineName = job .getFullName (); // Getting pipeline name
115135 allPipelines .add (pipelineName );
116136 }
117137 });
118138 } else {
119- apiUtil .logToQD (browserStackCredentials ,"Issue getting Jenkins Instance" );
139+ try {
140+ apiUtil .logToQD (browserStackCredentials , "Issue getting Jenkins Instance" );
141+ } catch (JsonProcessingException e ) {
142+ System .err .println ("Error logging issue with Jenkins instance." );
143+ e .printStackTrace ();
144+ }
145+ }
146+
147+ try {
148+ apiUtil .logToQD (browserStackCredentials ,"Total Pipelines on the jenkins side : " + totalPipelines );
149+ apiUtil .logToQD (browserStackCredentials ,"Total Pipelines detected : " + allPipelines .size ());
150+ } catch (JsonProcessingException e ) {
151+ // Handling the exception and logging an error
152+ System .err .println ("Error processing JSON for total pipelines: " );
153+ e .printStackTrace ();
120154 }
155+ // Returning the list of filtered pipelines
121156 return allPipelines ;
122157 }
123158
@@ -135,6 +170,7 @@ private static boolean sendPipelinesPaginated(BrowserStackCredentials browserSta
135170 String jsonBody = objectMapper .writeValueAsString (pipelinesPaginated );
136171 RequestBody requestBody = RequestBody .create (MediaType .parse ("application/json" ), jsonBody );
137172 Response response = apiUtil .makePostRequestToQd (Constants .QualityDashboardAPI .getSavePipelinesEndpoint (), browserStackCredentials , requestBody );
173+ apiUtil .logToQD (browserStackCredentials , "Sending page " + page + " with " + singlePagePipelineList .size () + " pipelines" );
138174 if (response == null || response .code () != HttpURLConnection .HTTP_OK ) {
139175 apiUtil .logToQD (browserStackCredentials ,"Got Non 200 response while saving projects" );
140176 isSuccess = false ;
0 commit comments