Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job URL to be stashed on QD #78

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,16 @@ private void sendBuildDataToQD(Run run, Result overallResult, String finalZipPat
String jobName = run.getParent().getFullName();
int buildNumber = run.getNumber();
long endTimeInMillis = run.getTimeInMillis();

Jenkins jenkins = Jenkins.getInstanceOrNull();
String rootUrl = jenkins !=null ? jenkins.getRootUrl() : null;
String jobUrl = null;
if(rootUrl != null) {
jobUrl = rootUrl + run.getUrl();
}

Timestamp endTime = new Timestamp(endTimeInMillis);
PipelineResults pipelineResultsReqObj = new PipelineResults(buildNumber, pipelineDuration, overallResult.toString(), finalZipPath, jobName, endTime);
PipelineResults pipelineResultsReqObj = new PipelineResults(buildNumber, pipelineDuration, overallResult.toString(), finalZipPath, jobName, endTime, jobUrl);
ObjectMapper objectMapper = new ObjectMapper();
String jsonBody = objectMapper.writeValueAsString(pipelineResultsReqObj);

Expand Down Expand Up @@ -292,6 +300,9 @@ class PipelineResults implements Serializable {
@JsonProperty("buildDuration")
private Long buildDuration;

@JsonProperty("jobUrl")
private String jobUrl;

@JsonProperty("endTime")
private Timestamp endTime;
@JsonProperty("buildStatus")
Expand All @@ -300,12 +311,13 @@ class PipelineResults implements Serializable {
@JsonProperty("zipFile")
private String zipFile;

public PipelineResults(Integer buildNumber, Long buildDuration, String buildStatus, String zipFile, String pipelineName, Timestamp endTime) {
public PipelineResults(Integer buildNumber, Long buildDuration, String buildStatus, String zipFile, String pipelineName, Timestamp endTime, String jobUrl) {
this.buildNumber = buildNumber;
this.buildDuration = buildDuration;
this.buildStatus = buildStatus;
this.zipFile = zipFile;
this.pipelineName = pipelineName;
this.endTime = endTime;
this.jobUrl = jobUrl;
}
}
Loading