screwdriver-api 6.0.39 → 6.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/builds/index.js +39 -26
package/package.json
CHANGED
package/plugins/builds/index.js
CHANGED
|
@@ -528,27 +528,29 @@ async function getParentBuildStatus({ newBuild, joinListNames, pipelineId, build
|
|
|
528
528
|
* @return {Promise} The newly updated/created build
|
|
529
529
|
*/
|
|
530
530
|
async function handleNewBuild({ done, hasFailure, newBuild, jobName, pipelineId }) {
|
|
531
|
-
if (done) {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
await newBuild.remove();
|
|
538
|
-
|
|
539
|
-
return null;
|
|
540
|
-
}
|
|
531
|
+
if (!done) {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
if (!['CREATED', null, undefined].includes(newBuild.status)) {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
541
537
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
538
|
+
// Delete new build since previous build failed
|
|
539
|
+
if (hasFailure) {
|
|
540
|
+
logger.info(
|
|
541
|
+
`Failure occurred in upstream job, removing new build - build:${newBuild.id} pipeline:${pipelineId}-${jobName} event:${newBuild.eventId} `
|
|
542
|
+
);
|
|
543
|
+
await newBuild.remove();
|
|
546
544
|
|
|
547
|
-
|
|
548
|
-
}
|
|
545
|
+
return null;
|
|
549
546
|
}
|
|
550
547
|
|
|
551
|
-
|
|
548
|
+
// All join builds finished successfully and it's clear that a new build has not been started before.
|
|
549
|
+
// Start new build.
|
|
550
|
+
newBuild.status = 'QUEUED';
|
|
551
|
+
await newBuild.update();
|
|
552
|
+
|
|
553
|
+
return newBuild.start();
|
|
552
554
|
}
|
|
553
555
|
|
|
554
556
|
/**
|
|
@@ -830,18 +832,29 @@ const buildsPlugin = {
|
|
|
830
832
|
parentBuilds,
|
|
831
833
|
parentBuildId: current.build.id
|
|
832
834
|
};
|
|
833
|
-
let newBuild;
|
|
834
835
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
836
|
+
const nextJob = await jobFactory.get({
|
|
837
|
+
name: nextJobName,
|
|
838
|
+
pipelineId: current.pipeline.id
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
const existNextBuild = await buildFactory.get({
|
|
842
|
+
eventId: current.event.id,
|
|
843
|
+
jobId: nextJob.id
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
if (existNextBuild === null) {
|
|
847
|
+
return createInternalBuild(internalBuildConfig);
|
|
842
848
|
}
|
|
843
849
|
|
|
844
|
-
|
|
850
|
+
if (!['CREATED', null, undefined].includes(existNextBuild.status)) {
|
|
851
|
+
return existNextBuild;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
existNextBuild.status = 'QUEUED';
|
|
855
|
+
await existNextBuild.update();
|
|
856
|
+
|
|
857
|
+
return existNextBuild.start();
|
|
845
858
|
}
|
|
846
859
|
|
|
847
860
|
logger.info(`Fetching finished builds for event ${event.id}`);
|