screwdriver-api 4.1.240 → 4.1.243
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 +12 -7
package/package.json
CHANGED
package/plugins/builds/index.js
CHANGED
|
@@ -1048,16 +1048,17 @@ const buildsPlugin = {
|
|
|
1048
1048
|
|
|
1049
1049
|
if (isCurrentPipeline) {
|
|
1050
1050
|
for (const nextJobName of Object.keys(pipelineJoinData[pid].jobs)) {
|
|
1051
|
+
const resource = `pipeline:${current.pipeline.id}:event:${current.event.id}`;
|
|
1052
|
+
let lock;
|
|
1053
|
+
|
|
1051
1054
|
try {
|
|
1052
1055
|
const { isExternal } = pipelineJoinData[pid].jobs[nextJobName];
|
|
1053
1056
|
|
|
1054
1057
|
triggerCurrentPipelineAsExternal = triggerCurrentPipelineAsExternal || isExternal;
|
|
1055
1058
|
if (!isExternal) {
|
|
1056
|
-
|
|
1057
|
-
const lock = await locker.lock(resource);
|
|
1059
|
+
lock = await locker.lock(resource);
|
|
1058
1060
|
|
|
1059
1061
|
await triggerNextJobInSamePipeline(nextJobName, pipelineJoinData[pid].jobs);
|
|
1060
|
-
await locker.unlock(lock, resource);
|
|
1061
1062
|
}
|
|
1062
1063
|
} catch (err) {
|
|
1063
1064
|
logger.error(
|
|
@@ -1065,32 +1066,36 @@ const buildsPlugin = {
|
|
|
1065
1066
|
err
|
|
1066
1067
|
);
|
|
1067
1068
|
}
|
|
1069
|
+
|
|
1070
|
+
await locker.unlock(lock, resource);
|
|
1068
1071
|
}
|
|
1069
1072
|
}
|
|
1070
1073
|
if (triggerCurrentPipelineAsExternal || !isCurrentPipeline) {
|
|
1074
|
+
let resource;
|
|
1075
|
+
let lock;
|
|
1076
|
+
|
|
1071
1077
|
try {
|
|
1072
1078
|
if (isCurrentPipeline) {
|
|
1073
1079
|
// force external trigger for jobs in same pipeline if user used external trigger syntax
|
|
1074
1080
|
delete pipelineJoinData[pid].event;
|
|
1075
1081
|
}
|
|
1076
1082
|
const extEvent = pipelineJoinData[pid].event;
|
|
1077
|
-
let lock;
|
|
1078
|
-
let resource;
|
|
1079
1083
|
|
|
1080
1084
|
// no need to lock if there is no external event
|
|
1081
1085
|
if (extEvent) {
|
|
1082
|
-
resource = `pipeline:${pid}:event:${
|
|
1086
|
+
resource = `pipeline:${pid}:event:${extEvent.id}`;
|
|
1083
1087
|
lock = await locker.lock(resource);
|
|
1084
1088
|
}
|
|
1085
1089
|
|
|
1086
1090
|
await triggerJobsInExternalPipeline(pid, pipelineJoinData[pid]);
|
|
1087
|
-
await locker.unlock(lock, resource);
|
|
1088
1091
|
} catch (err) {
|
|
1089
1092
|
logger.error(
|
|
1090
1093
|
`Error in triggerJobsInExternalPipeline:${pid} from pipeline:${current.pipeline.id}-${current.job.name}-event:${current.event.id} `,
|
|
1091
1094
|
err
|
|
1092
1095
|
);
|
|
1093
1096
|
}
|
|
1097
|
+
|
|
1098
|
+
await locker.unlock(lock, resource);
|
|
1094
1099
|
}
|
|
1095
1100
|
}
|
|
1096
1101
|
|