screwdriver-api 6.0.34 → 6.0.35

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": "6.0.34",
3
+ "version": "6.0.35",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const schema = require('screwdriver-data-schema');
5
- const urlLib = require('url');
6
6
 
7
7
  module.exports = () => ({
8
8
  method: 'POST',
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const boom = require('@hapi/boom');
4
3
  const urlLib = require('url');
4
+ const boom = require('@hapi/boom');
5
5
  const validationSchema = require('screwdriver-data-schema');
6
6
 
7
7
  module.exports = () => ({
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const boom = require('@hapi/boom');
4
3
  const urlLib = require('url');
4
+ const boom = require('@hapi/boom');
5
5
  const validationSchema = require('screwdriver-data-schema');
6
6
 
7
7
  module.exports = () => ({
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const schema = require('screwdriver-data-schema');
5
- const urlLib = require('url');
6
6
 
7
7
  module.exports = () => ({
8
8
  method: 'POST',
@@ -2,11 +2,11 @@
2
2
 
3
3
  'use strict';
4
4
 
5
+ const urlLib = require('url');
5
6
  const boom = require('@hapi/boom');
6
7
  const schema = require('screwdriver-data-schema');
7
8
  const validator = require('screwdriver-command-validator');
8
9
  const hoek = require('@hapi/hoek');
9
- const urlLib = require('url');
10
10
  const req = require('screwdriver-request');
11
11
  const VERSION_REGEX = schema.config.regex.VERSION;
12
12
  const DEFAULT_BYTES = 1024 * 1024 * 1024; // 1GB
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const joi = require('joi');
5
6
  const schema = require('screwdriver-data-schema');
6
7
  const baseSchema = schema.models.commandTag.base;
7
- const urlLib = require('url');
8
8
  const VERSION_REGEX = schema.config.regex.VERSION;
9
9
  const exactVersionSchema = schema.models.commandTag.base.extract('version');
10
10
  const tagSchema = schema.models.commandTag.base.extract('tag');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const boom = require('@hapi/boom');
4
3
  const urlLib = require('url');
4
+ const boom = require('@hapi/boom');
5
5
  const validationSchema = require('screwdriver-data-schema');
6
6
  const ANNOT_RESTRICT_PR = 'screwdriver.cd/restrictPR';
7
7
  const { getScmUri } = require('../helper');
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const hoek = require('@hapi/hoek');
5
6
  const joi = require('joi');
6
- const urlLib = require('url');
7
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');
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const schema = require('screwdriver-data-schema');
5
- const urlLib = require('url');
6
6
  const logger = require('screwdriver-logger');
7
7
  const { formatCheckoutUrl, sanitizeRootDir } = require('./helper');
8
8
  const { getUserPermissions } = require('../helper');
@@ -33,39 +33,23 @@ module.exports = () => ({
33
33
  params: { pipelineId }
34
34
  };
35
35
 
36
- // Set groupEventId if provided
37
- if (request.query.groupEventId) {
38
- config.params.groupEventId = request.query.groupEventId;
39
- }
40
- // Get specific stages if eventId is provided
41
- else if (request.query.eventId) {
42
- const events = await eventFactory.list({ params: { id: request.query.eventId } });
43
-
44
- if (!events || Object.keys(events).length === 0) {
45
- throw boom.notFound(`Event ${request.query.eventId} does not exist`);
36
+ // Get latest stages
37
+ const latestCommitEvents = await eventFactory.list({
38
+ params: {
39
+ pipelineId,
40
+ parentEventId: null,
41
+ type: 'pipeline'
42
+ },
43
+ paginate: {
44
+ count: 1
46
45
  }
46
+ });
47
47
 
48
- config.params.groupEventId = events[0].groupEventId;
48
+ if (!latestCommitEvents || Object.keys(latestCommitEvents).length === 0) {
49
+ throw boom.notFound(`Latest event does not exist for pipeline ${pipelineId}`);
49
50
  }
50
- // Get latest stages if eventId not provided
51
- else {
52
- const latestCommitEvents = await eventFactory.list({
53
- params: {
54
- pipelineId,
55
- parentEventId: null,
56
- type: 'pipeline'
57
- },
58
- paginate: {
59
- count: 1
60
- }
61
- });
62
51
 
63
- if (!latestCommitEvents || Object.keys(latestCommitEvents).length === 0) {
64
- throw boom.notFound(`Latest event does not exist for pipeline ${pipelineId}`);
65
- }
66
-
67
- config.params.groupEventId = latestCommitEvents[0].groupEventId;
68
- }
52
+ config.params.eventId = latestCommitEvents[0].id;
69
53
 
70
54
  return stageFactory.list(config);
71
55
  })
@@ -83,8 +67,6 @@ module.exports = () => ({
83
67
  }),
84
68
  query: schema.api.pagination.concat(
85
69
  joi.object({
86
- eventId: pipelineIdSchema,
87
- groupEventId: pipelineIdSchema,
88
70
  search: joi.forbidden() // we don't support search for Pipeline list stages
89
71
  })
90
72
  )
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const joi = require('joi');
5
6
  const schema = require('screwdriver-data-schema');
6
7
  const logger = require('screwdriver-logger');
7
- const urlLib = require('url');
8
8
  const pipelineIdSchema = schema.models.pipeline.base.extract('id');
9
9
  const tokenCreateSchema = schema.models.token.create;
10
10
  const { getUserPermissions, getScmUri } = require('../../helper');
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const schema = require('screwdriver-data-schema');
5
6
  const logger = require('screwdriver-logger');
6
- const urlLib = require('url');
7
7
  const { getUserPermissions, getScmUri } = require('../helper');
8
8
 
9
9
  module.exports = () => ({
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const schema = require('screwdriver-data-schema');
5
6
  const validator = require('screwdriver-template-validator');
6
7
  const templateSchema = schema.api.templateValidator;
7
8
  const hoek = require('@hapi/hoek');
8
- const urlLib = require('url');
9
9
 
10
10
  module.exports = () => ({
11
11
  method: 'POST',
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const joi = require('joi');
5
6
  const schema = require('screwdriver-data-schema');
6
7
  const baseSchema = schema.models.templateTag.base;
7
- const urlLib = require('url');
8
8
 
9
9
  /* Currently, only build scope is allowed to tag template due to security reasons.
10
10
  * The same pipeline that publishes the template has the permission to tag it.
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const urlLib = require('url');
3
4
  const boom = require('@hapi/boom');
4
5
  const schema = require('screwdriver-data-schema');
5
- const urlLib = require('url');
6
6
 
7
7
  module.exports = () => ({
8
8
  method: 'POST',
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const checker = require('license-checker');
4
3
  const fs = require('fs');
5
4
  const path = require('path');
6
5
  const process = require('process');
6
+ const checker = require('license-checker');
7
7
  const VError = require('verror');
8
8
  const schema = require('screwdriver-data-schema');
9
9