screwdriver-api 8.0.127 → 8.0.129
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screwdriver-api",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.129",
|
|
4
4
|
"description": "API server for the Screwdriver.cd service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@hapi/hoek": "^11.0.0",
|
|
85
85
|
"@hapi/inert": "^7.0.0",
|
|
86
86
|
"@hapi/vision": "^7.0.0",
|
|
87
|
-
"@promster/hapi": "^
|
|
87
|
+
"@promster/hapi": "^15.0.0",
|
|
88
88
|
"archiver": "^7.0.1",
|
|
89
89
|
"async": "^3.2.4",
|
|
90
90
|
"badge-maker": "^3.3.1",
|
|
@@ -168,16 +168,5 @@
|
|
|
168
168
|
"rewiremock": "^3.14.4",
|
|
169
169
|
"sinon": "^15.0.0",
|
|
170
170
|
"stream-to-promise": "^3.0.0"
|
|
171
|
-
},
|
|
172
|
-
"overrides": {
|
|
173
|
-
"@mapbox/node-pre-gyp": {
|
|
174
|
-
"tar": "^7.5.9"
|
|
175
|
-
},
|
|
176
|
-
"sqlite3": {
|
|
177
|
-
"tar": "^7.5.9"
|
|
178
|
-
},
|
|
179
|
-
"ssh-keygen": {
|
|
180
|
-
"underscore": "^1.13.8"
|
|
181
|
-
}
|
|
182
171
|
}
|
|
183
172
|
}
|
|
@@ -166,8 +166,8 @@ function unixToFullTime(timestamp, timeZone) {
|
|
|
166
166
|
);
|
|
167
167
|
|
|
168
168
|
const offsetMatch = timeZoneName.match(/GMT(.*)/)[1];
|
|
169
|
-
|
|
170
|
-
const timezoneOffset =
|
|
169
|
+
const isUtcOffset = offsetMatch === '' || offsetMatch === '+00:00' || offsetMatch === '-00:00';
|
|
170
|
+
const timezoneOffset = isUtcOffset ? 'Z' : offsetMatch;
|
|
171
171
|
|
|
172
172
|
return `${year}-${month}-${day}T${hour}:${minute}:${second}.${fractionalSecond}${timezoneOffset}`;
|
|
173
173
|
}
|
|
@@ -8,6 +8,7 @@ const schema = require('screwdriver-data-schema');
|
|
|
8
8
|
const getSchema = schema.models.event.get;
|
|
9
9
|
const idSchema = schema.models.event.base.extract('id');
|
|
10
10
|
const { deriveEventStatusFromBuildStatuses, stopBuilds } = require('../builds/helper/updateBuild');
|
|
11
|
+
const { emitBuildStatusEvent } = require('../builds/triggers/helpers');
|
|
11
12
|
const nonTerminatedStatus = ['CREATED', 'RUNNING', 'QUEUED', 'BLOCKED', 'FROZEN'];
|
|
12
13
|
|
|
13
14
|
module.exports = () => ({
|
|
@@ -89,15 +90,26 @@ module.exports = () => ({
|
|
|
89
90
|
const statusMessage = `Aborted event by ${username}`;
|
|
90
91
|
|
|
91
92
|
const { unchangedBuilds, changedBuilds } = stopBuilds(builds, statusMessage);
|
|
92
|
-
const updatedBuilds =
|
|
93
|
+
const updatedBuilds = await Promise.all(changedBuilds.map(b => b.update()));
|
|
94
|
+
const updatedAllBuilds = [...unchangedBuilds, ...updatedBuilds];
|
|
93
95
|
|
|
94
|
-
const newEventStatus = deriveEventStatusFromBuildStatuses(
|
|
96
|
+
const newEventStatus = deriveEventStatusFromBuildStatuses(updatedAllBuilds);
|
|
95
97
|
|
|
96
98
|
if (newEventStatus && event.status !== newEventStatus) {
|
|
97
99
|
event.status = newEventStatus;
|
|
98
100
|
await event.update();
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
const abortedBuilds = updatedBuilds.filter(build => build.status === 'ABORTED');
|
|
104
|
+
|
|
105
|
+
const buildNotifies = abortedBuilds.map(async build => {
|
|
106
|
+
const job = await build.job;
|
|
107
|
+
|
|
108
|
+
return emitBuildStatusEvent({ server: request.server, build, pipeline, event, job });
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
await Promise.all(buildNotifies);
|
|
112
|
+
|
|
101
113
|
// Update stageBuild status to ABORTED
|
|
102
114
|
const stageBuilds = await event.getStageBuilds();
|
|
103
115
|
const toUpdateStageBuilds = [];
|