screwdriver-api 6.0.40 → 6.0.41
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 +26 -39
package/package.json
CHANGED
package/plugins/builds/index.js
CHANGED
|
@@ -528,29 +528,27 @@ 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 (
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
531
|
+
if (done) {
|
|
532
|
+
// Delete new build since previous build failed
|
|
533
|
+
if (hasFailure) {
|
|
534
|
+
logger.info(
|
|
535
|
+
`Failure occurred in upstream job, removing new build - build:${newBuild.id} pipeline:${pipelineId}-${jobName} event:${newBuild.eventId} `
|
|
536
|
+
);
|
|
537
|
+
await newBuild.remove();
|
|
538
|
+
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
537
541
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
);
|
|
543
|
-
await newBuild.remove();
|
|
542
|
+
// If all join builds finished successfully and it's clear that a new build has not been started before, start new build
|
|
543
|
+
if (['CREATED', null, undefined].includes(newBuild.status)) {
|
|
544
|
+
newBuild.status = 'QUEUED';
|
|
545
|
+
const queuedBuild = await newBuild.update();
|
|
544
546
|
|
|
545
|
-
|
|
547
|
+
return queuedBuild.start();
|
|
548
|
+
}
|
|
546
549
|
}
|
|
547
550
|
|
|
548
|
-
|
|
549
|
-
// Start new build.
|
|
550
|
-
newBuild.status = 'QUEUED';
|
|
551
|
-
await newBuild.update();
|
|
552
|
-
|
|
553
|
-
return newBuild.start();
|
|
551
|
+
return null;
|
|
554
552
|
}
|
|
555
553
|
|
|
556
554
|
/**
|
|
@@ -832,29 +830,18 @@ const buildsPlugin = {
|
|
|
832
830
|
parentBuilds,
|
|
833
831
|
parentBuildId: current.build.id
|
|
834
832
|
};
|
|
833
|
+
let newBuild;
|
|
835
834
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
jobId: nextJob.id
|
|
844
|
-
});
|
|
845
|
-
|
|
846
|
-
if (existNextBuild === null) {
|
|
847
|
-
return createInternalBuild(internalBuildConfig);
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
if (!['CREATED', null, undefined].includes(existNextBuild.status)) {
|
|
851
|
-
return existNextBuild;
|
|
835
|
+
try {
|
|
836
|
+
newBuild = await createInternalBuild(internalBuildConfig);
|
|
837
|
+
} catch (err) {
|
|
838
|
+
logger.error(
|
|
839
|
+
`Error in triggerNextJobs - pipeline:${current.pipeline.id}-${nextJobName} event:${event.id} `,
|
|
840
|
+
err
|
|
841
|
+
);
|
|
852
842
|
}
|
|
853
843
|
|
|
854
|
-
|
|
855
|
-
await existNextBuild.update();
|
|
856
|
-
|
|
857
|
-
return existNextBuild.start();
|
|
844
|
+
return newBuild;
|
|
858
845
|
}
|
|
859
846
|
|
|
860
847
|
logger.info(`Fetching finished builds for event ${event.id}`);
|