screwdriver-queue-service 2.0.39 → 2.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/queue/scheduler.js +23 -25
package/package.json
CHANGED
|
@@ -42,32 +42,32 @@ async function postBuildEvent(executor, eventConfig) {
|
|
|
42
42
|
|
|
43
43
|
const admin = await helper.getPipelineAdmin(token, apiUri, pipelineId, helper.requestRetryStrategy);
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
45
|
+
logger.info(
|
|
46
|
+
`POST event for pipeline ${pipelineId}:${job.name}:${job.id}:${buildId} using user ${admin.username}`
|
|
47
|
+
);
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
const jwt = executor.userTokenGen(admin.username, {}, admin.scmContext);
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
const buildEvent = {
|
|
52
|
+
pipelineId,
|
|
53
|
+
startFrom: job.name,
|
|
54
|
+
creator: {
|
|
55
|
+
name: 'Screwdriver scheduler',
|
|
56
|
+
username: 'sd:scheduler'
|
|
57
|
+
},
|
|
58
|
+
causeMessage: causeMessage || 'Automatically started by scheduler'
|
|
59
|
+
};
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
if (eventId) {
|
|
62
|
+
buildEvent.parentEventId = eventId;
|
|
63
|
+
}
|
|
64
|
+
if (buildId) {
|
|
65
|
+
buildEvent.buildId = buildId;
|
|
66
|
+
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
await helper.createBuildEvent(apiUri, jwt, buildEvent, helper.requestRetryStrategyPostEvent);
|
|
69
|
+
} catch (err) {
|
|
70
|
+
if (err.statusCode === 404) {
|
|
71
71
|
logger.error(
|
|
72
72
|
`POST event for pipeline failed as no admin found: ${pipelineId}:${job.name}:${job.id}:${buildId}`
|
|
73
73
|
);
|
|
@@ -91,10 +91,8 @@ async function postBuildEvent(executor, eventConfig) {
|
|
|
91
91
|
},
|
|
92
92
|
helper.requestRetryStrategyPostEvent
|
|
93
93
|
);
|
|
94
|
-
|
|
95
|
-
throw new Error(`Pipeline admin not found, cannot process build ${buildId}`);
|
|
96
94
|
}
|
|
97
|
-
|
|
95
|
+
|
|
98
96
|
logger.error(`Error in post build event function ${buildId} ${err}`);
|
|
99
97
|
throw err;
|
|
100
98
|
}
|