Skip to content

Conversation

@sanjay000001
Copy link
Contributor

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

apiUtil.logToQD(browserStackCredentials, "Finally no artifacts found for jobName: " + jobName + " and buildNumber: " + buildNumber);
}
sendBuildDataToQD(run, overallResult, qdS3Url, browserStackCredentials);
processArtifactsAndSendData(run, overallResult, browserStackCredentials, jobName, buildNumber);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for clean code.
String jobName = getJobNameFromRun(run, browserStackCredentials);
int buildNumber = run.getNumber();

These 2 lines can be moved inside processArtifactsAndSendData since we are already passing run object to the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the build name is needed to check whether the pipeline is enabled. Based on that, we call the processArtifactsAndSendData function. The build number is used to improve logging and help uniquely identify the run in the try-catch block.

* @param browserStackCredentials The credentials required for logging
* @param message The error message to log
*/
private static void logError(BrowserStackCredentials browserStackCredentials, String message) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like wrapper over a wrapper. any specific reason of creating this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We handle error logging this way to avoid declaring throws JsonProcessingException in every function. Otherwise, we would also need to add extra try-catch blocks at the top level just to log the error when calling the Upstream resolver methods(as seen in QualityDashboardPipelineTracker.java, lines 53–57). This approach reduces repetition and keeps error logging centralized in UpStreamResolver.

if (cause instanceof Cause.UpstreamCause) {
return handleUpstreamCause((Cause.UpstreamCause) cause, browserStackCredentials, visitedProjects);
} else if (cause instanceof hudson.triggers.TimerTrigger.TimerTriggerCause) {
apiUtil.logToQD(browserStackCredentials, "Build triggered by timer/schedule");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just log it on Jenkins side? is this log useful for debugging on server side?

public static final String QEI_DEFAULT_URL = "https://quality-engineering-insights.browserstack.com";
public static String host = QEI_DEFAULT_URL;
// Cache configuration
public static final long CACHE_DURATION_MS = 60 * 60 * 1000L; // 1 hour in milliseconds

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for now but ideally it should be configurable either on client side or server side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. As discussed, we will handle this in the future.

Copy link

@agrawalsaurabhs agrawalsaurabhs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! clean code, nicely done.
minor comments added.

Copy link

@karanshah-browserstack karanshah-browserstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All file changes, except those in common, fall under QD’s ownership, an internal review within QD should be sufficient. Also, can we update the CODEOWNERS file to reflect QD as the owner for these files? I won’t be able to review them as I don’t have enough context.

} catch (JsonProcessingException e) {
// Handling the exception and logging an error
System.err.println("Error processing JSON for job: " + job.getName());
LOGGER.info("Error processing JSON for job: " + job.getName() + " - " + e.getMessage());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be logger error right? And till will also be displayed to user correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karanshah-browserstack , yes, the user will be able to see it in the Jenkins System Log. I've changed it to a warning in all places.

apiUtil.logToQD(browserStackCredentials, "Issue getting Jenkins Instance");
} catch (JsonProcessingException e) {
System.err.println("Error logging issue with Jenkins instance.");
LOGGER.info("Error logging issue with Jenkins instance.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same error Logger comment as above for all logger related changes

…supporting job and folder item type handling on rename and deletion.
@sanjay000001
Copy link
Contributor Author

@karanshah-browserstack , we’ll review and update the CODEOWNERS for QD related files.

apiUtil.logToQD(browserStackCredentials, "Issue getting Jenkins Instance");
} catch (JsonProcessingException e) {
LOGGER.info("Error logging issue with Jenkins instance.");
LOGGER.warning("Error logging issue with Jenkins instance.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karanshah-browserstack, We are logging this as a warning instead of an error because the logs appear on the user's Jenkins system. We want to avoid showing error logs to the user.

@francisf francisf merged commit 1be5219 into jenkinsci:master Jul 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants