Skip to content

Commit

Permalink
fix(3228): GH status for virtual job PR build always shows as pending (
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar1312 authored Nov 19, 2024
1 parent 90288dc commit ff446ae
Showing 1 changed file with 46 additions and 45 deletions.
91 changes: 46 additions & 45 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,55 +526,56 @@ class BuildModel extends BaseModel {
return this.job.then(job =>
Promise.all([job.pipeline, job.prNum])
.then(([pipeline, prNum]) =>
getBlockedByIds(pipeline, job)
.then(blockedBy => {
const config = {
build: this,
buildId: this.id,
eventId: this.eventId,
jobId: job.id,
jobState: job.state,
jobArchived: job.archived,
jobName: job.name,
annotations: hoek.reach(job.permutations[0], 'annotations', { default: {} }),
blockedBy,
pipelineId: pipeline.id,
pipeline: {
id: pipeline.id,
name: pipeline.name,
scmContext: pipeline.scmContext,
configPipelineId: pipeline.configPipelineId
},
causeMessage: causeMessage || '',
freezeWindows: hoek.reach(job.permutations[0], 'freezeWindows', { default: [] }),
apiUri: this[apiUri],
container: this.container,
tokenGen: this[tokenGen],
token: getToken(this, job, pipeline),
isPR: job.isPR(),
prParentJobId: job.prParentJobId
};

if (template && !hoek.deepEqual(template, {})) {
config.template = template;
}
getBlockedByIds(pipeline, job).then(blockedBy => {
const config = {
build: this,
buildId: this.id,
eventId: this.eventId,
jobId: job.id,
jobState: job.state,
jobArchived: job.archived,
jobName: job.name,
annotations: hoek.reach(job.permutations[0], 'annotations', { default: {} }),
blockedBy,
pipelineId: pipeline.id,
pipeline: {
id: pipeline.id,
name: pipeline.name,
scmContext: pipeline.scmContext,
configPipelineId: pipeline.configPipelineId
},
causeMessage: causeMessage || '',
freezeWindows: hoek.reach(job.permutations[0], 'freezeWindows', { default: [] }),
apiUri: this[apiUri],
container: this.container,
tokenGen: this[tokenGen],
token: getToken(this, job, pipeline),
isPR: job.isPR(),
prParentJobId: job.prParentJobId
};

if (prNum) {
config.prNum = prNum;
}
if (template && !hoek.deepEqual(template, {})) {
config.template = template;
}

if (this.buildClusterName) {
config.buildClusterName = this.buildClusterName;
}
if (prNum) {
config.prNum = prNum;
}

if (hoek.reach(job.permutations[0], 'provider')) {
config.provider = job.permutations[0].provider;
}
if (this.buildClusterName) {
config.buildClusterName = this.buildClusterName;
}

return this[executor].start(config);
})
.then(() => this.updateCommitStatus(pipeline))
) // update github
if (hoek.reach(job.permutations[0], 'provider')) {
config.provider = job.permutations[0].provider;
}

return Promise.all([
this[executor].start(config),
this.updateCommitStatus(pipeline) // update github
]);
})
)
.then(() => this)
);
}
Expand Down

0 comments on commit ff446ae

Please sign in to comment.