screwdriver-api 8.0.24 → 8.0.25

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.24",
3
+ "version": "8.0.25",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -111,7 +111,7 @@
111
111
  "screwdriver-config-parser": "^12.0.0",
112
112
  "screwdriver-coverage-bookend": "^3.0.0",
113
113
  "screwdriver-coverage-sonar": "^5.0.0",
114
- "screwdriver-data-schema": "^25.5.0",
114
+ "screwdriver-data-schema": "^25.4.0",
115
115
  "screwdriver-datastore-sequelize": "^10.0.0",
116
116
  "screwdriver-executor-base": "^11.0.0",
117
117
  "screwdriver-executor-docker": "^8.0.1",
@@ -120,7 +120,7 @@
120
120
  "screwdriver-executor-queue": "^6.0.0",
121
121
  "screwdriver-executor-router": "^5.0.0",
122
122
  "screwdriver-logger": "^3.0.0",
123
- "screwdriver-models": "^32.4.0",
123
+ "screwdriver-models": "^32.3.0",
124
124
  "screwdriver-notifications-email": "^5.0.0",
125
125
  "screwdriver-notifications-slack": "^7.0.0",
126
126
  "screwdriver-request": "^3.0.0",
@@ -164,56 +164,6 @@ function isStageDone(stageJobBuilds) {
164
164
  return stageIsDone;
165
165
  }
166
166
 
167
- /**
168
- * Derives overall status of the event based on individual build statuses
169
- *
170
- * @param {Build[]} builds Builds associated with the event
171
- * @returns {String} new status for the event
172
- */
173
- function deriveEventStatusFromBuildStatuses(builds) {
174
- let newEventStatus = null;
175
-
176
- const BUILD_STATUS_TO_EVENT_STATUS_MAPPING = {
177
- ABORTED: 'ABORTED',
178
- CREATED: null,
179
- FAILURE: 'FAILURE',
180
- QUEUED: 'IN_PROGRESS',
181
- RUNNING: 'IN_PROGRESS',
182
- SUCCESS: 'SUCCESS',
183
- BLOCKED: 'IN_PROGRESS',
184
- UNSTABLE: 'SUCCESS',
185
- COLLAPSED: null,
186
- FROZEN: 'IN_PROGRESS'
187
- };
188
-
189
- const eventStatusToBuildCount = {
190
- IN_PROGRESS: 0,
191
- ABORTED: 0,
192
- FAILURE: 0,
193
- SUCCESS: 0
194
- };
195
-
196
- for (const b of builds) {
197
- const eventStatus = BUILD_STATUS_TO_EVENT_STATUS_MAPPING[b.status];
198
-
199
- if (eventStatus) {
200
- eventStatusToBuildCount[eventStatus] += 1;
201
- }
202
- }
203
-
204
- if (eventStatusToBuildCount.IN_PROGRESS) {
205
- newEventStatus = 'IN_PROGRESS';
206
- } else if (eventStatusToBuildCount.ABORTED) {
207
- newEventStatus = 'ABORTED';
208
- } else if (eventStatusToBuildCount.FAILURE) {
209
- newEventStatus = 'FAILURE';
210
- } else if (eventStatusToBuildCount.SUCCESS) {
211
- newEventStatus = 'SUCCESS';
212
- }
213
-
214
- return newEventStatus;
215
- }
216
-
217
167
  /**
218
168
  * Updates the build and trigger its downstream jobs in the workflow
219
169
  *
@@ -363,19 +313,9 @@ async function updateBuildAndTriggerDownstreamJobs(config, build, server, userna
363
313
  }
364
314
  }
365
315
 
366
- // update event status
367
- const latestBuilds = await newEvent.getBuilds();
368
- const newEventStatus = deriveEventStatusFromBuildStatuses(latestBuilds);
369
-
370
- if (newEventStatus && newEvent.status !== newEventStatus) {
371
- newEvent.status = newEventStatus;
372
- await newEvent.update();
373
- }
374
-
375
316
  return newBuild;
376
317
  }
377
318
 
378
319
  module.exports = {
379
- updateBuildAndTriggerDownstreamJobs,
380
- deriveEventStatusFromBuildStatuses
320
+ updateBuildAndTriggerDownstreamJobs
381
321
  };