screwdriver-api 4.1.176 → 4.1.180

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": "4.1.176",
3
+ "version": "4.1.180",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -270,7 +270,6 @@ async function createInternalBuild(config) {
270
270
  } else {
271
271
  job = await jobFactory.get(jobId);
272
272
  }
273
-
274
273
  const internalBuildConfig = {
275
274
  jobId: job.id,
276
275
  sha: event.sha,
@@ -410,6 +409,11 @@ function parseJobInfo({ joinObj = {}, current, nextJobName, nextPipelineId }) {
410
409
  * @return {Promise} All finished builds
411
410
  */
412
411
  async function getFinishedBuilds(event, buildFactory) {
412
+ if (!event.parentEventId) {
413
+ // FIXME: remove this flow to always use buildFactory.getLatestBuilds
414
+ return event.getBuilds();
415
+ }
416
+
413
417
  // FIXME: buildFactory.getLatestBuilds doesn't return build model
414
418
  const builds = await buildFactory.getLatestBuilds({ groupEventId: event.groupEventId });
415
419
 
@@ -32,9 +32,6 @@ server.register({
32
32
  #### Returns a list of builds associated with the event
33
33
  `GET /events/{id}/builds`
34
34
 
35
- `GET /events/{id}/builds?steps=true`
36
-
37
-
38
35
  #### Get build metrics for a single event
39
36
  `GET /events/{id}/metrics`
40
37
 
@@ -24,23 +24,14 @@ module.exports = () => ({
24
24
  handler: async (request, h) => {
25
25
  const { eventFactory } = request.server.app;
26
26
  const event = await eventFactory.get(request.params.id);
27
- const { steps } = request.query;
28
27
 
29
28
  if (!event) {
30
29
  throw boom.notFound('Event does not exist');
31
30
  }
32
31
 
33
- const buildsModel = await event.getBuilds({
34
- readOnly: true
35
- });
32
+ const buildsModel = await event.getBuilds();
36
33
 
37
- let data;
38
-
39
- if (steps) {
40
- data = await Promise.all(buildsModel.map(async buildModel => buildModel.toJsonWithSteps()));
41
- } else {
42
- data = await Promise.all(buildsModel.map(async buildModel => buildModel.toJson()));
43
- }
34
+ const data = await Promise.all(buildsModel.map(async buildModel => buildModel.toJsonWithSteps()));
44
35
 
45
36
  return h.response(data);
46
37
  },
@@ -50,16 +41,7 @@ module.exports = () => ({
50
41
  validate: {
51
42
  params: joi.object({
52
43
  id: eventIdSchema
53
- }),
54
- query: schema.api.pagination.concat(
55
- joi.object({
56
- steps: joi
57
- .boolean()
58
- .truthy('true')
59
- .falsy('false')
60
- .default(false)
61
- })
62
- )
44
+ })
63
45
  }
64
46
  }
65
47
  });
@@ -46,8 +46,6 @@ Example payload:
46
46
  #### Get list of builds for a single job
47
47
  `GET /jobs/{id}/builds`
48
48
 
49
- `GET /jobs/{id}/builds?steps=true`
50
-
51
49
  `GET /jobs/{id}/builds?page=2&count=30&sort=ascending`
52
50
 
53
51
  `GET /jobs/{id}/builds?page=2&count=30&sort=ascending&sortBy=id`
@@ -23,7 +23,7 @@ module.exports = () => ({
23
23
 
24
24
  handler: async (request, h) => {
25
25
  const factory = request.server.app.jobFactory;
26
- const { sort, sortBy, page, count, steps } = request.query;
26
+ const { sort, sortBy, page, count } = request.query;
27
27
 
28
28
  return factory
29
29
  .get(request.params.id)
@@ -32,7 +32,7 @@ module.exports = () => ({
32
32
  throw boom.notFound('Job does not exist');
33
33
  }
34
34
 
35
- const config = { sort, sortBy: 'createTime', readOnly: true };
35
+ const config = { sort, sortBy: 'createTime' };
36
36
 
37
37
  if (sortBy) {
38
38
  config.sortBy = sortBy;
@@ -45,13 +45,7 @@ module.exports = () => ({
45
45
  return job.getBuilds(config);
46
46
  })
47
47
  .then(async builds => {
48
- let data;
49
-
50
- if (steps) {
51
- data = await Promise.all(builds.map(b => b.toJsonWithSteps()));
52
- } else {
53
- data = await Promise.all(builds.map(b => b.toJson()));
54
- }
48
+ const data = await Promise.all(builds.map(b => b.toJsonWithSteps()));
55
49
 
56
50
  return h.response(data);
57
51
  })
@@ -66,15 +60,7 @@ module.exports = () => ({
66
60
  params: joi.object({
67
61
  id: jobIdSchema
68
62
  }),
69
- query: schema.api.pagination.concat(
70
- joi.object({
71
- steps: joi
72
- .boolean()
73
- .truthy('true')
74
- .falsy('false')
75
- .default(false)
76
- })
77
- )
63
+ query: schema.api.pagination
78
64
  }
79
65
  }
80
66
  });