screwdriver-api 8.0.100 → 8.0.101
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 +2 -2
- package/plugins/events/create.js +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screwdriver-api",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.101",
|
|
4
4
|
"description": "API server for the Screwdriver.cd service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"screwdriver-config-parser": "^12.2.3",
|
|
115
115
|
"screwdriver-coverage-bookend": "^3.0.0",
|
|
116
116
|
"screwdriver-coverage-sonar": "^5.0.0",
|
|
117
|
-
"screwdriver-data-schema": "^25.
|
|
117
|
+
"screwdriver-data-schema": "^25.12.0",
|
|
118
118
|
"screwdriver-datastore-sequelize": "^10.0.0",
|
|
119
119
|
"screwdriver-executor-base": "^11.0.0",
|
|
120
120
|
"screwdriver-executor-docker": "^8.0.1",
|
package/plugins/events/create.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports = () => ({
|
|
|
21
21
|
|
|
22
22
|
handler: async (request, h) => {
|
|
23
23
|
const { buildFactory, jobFactory, eventFactory, pipelineFactory, userFactory } = request.server.app;
|
|
24
|
-
const { buildId, causeMessage, creator } = request.payload;
|
|
24
|
+
const { buildId, causeMessage, creator, sha } = request.payload;
|
|
25
25
|
const { scmContext, username, scope } = request.auth.credentials;
|
|
26
26
|
const { scm } = eventFactory;
|
|
27
27
|
const { isValidToken } = request.server.plugins.pipelines;
|
|
@@ -63,6 +63,10 @@ module.exports = () => ({
|
|
|
63
63
|
meta: request.payload.meta // always exists because default is {}
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
if (sha) {
|
|
67
|
+
payload.sha = sha;
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
if (parentEventId) {
|
|
67
71
|
payload.parentEventId = parentEventId;
|
|
68
72
|
}
|
|
@@ -219,18 +223,20 @@ module.exports = () => ({
|
|
|
219
223
|
}
|
|
220
224
|
}
|
|
221
225
|
|
|
222
|
-
let
|
|
226
|
+
let latestCommitSha;
|
|
223
227
|
|
|
224
228
|
try {
|
|
225
229
|
// User has good permissions, create an event
|
|
226
|
-
|
|
230
|
+
latestCommitSha = await scm.getCommitSha(scmConfig);
|
|
227
231
|
} catch (err) {
|
|
228
232
|
if (err.statusCode) {
|
|
229
233
|
throw boom.boomify(err, { statusCode: err.statusCode });
|
|
230
234
|
}
|
|
231
235
|
}
|
|
232
236
|
|
|
233
|
-
payload.sha
|
|
237
|
+
if (!payload.sha || prNum) {
|
|
238
|
+
payload.sha = latestCommitSha;
|
|
239
|
+
}
|
|
234
240
|
|
|
235
241
|
// If there is parentEvent, pass workflowGraph, meta and sha to payload
|
|
236
242
|
// Skip PR, for PR builds, we should always start from latest commit
|