screwdriver-api 4.1.256 → 4.1.259

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/README.md CHANGED
@@ -52,14 +52,14 @@ Three (3) options for executor:
52
52
  - Nomad (`nomad`)
53
53
 
54
54
  Three (3) options for SCM:
55
- - Github (`github`)
56
- - Gitlab (`gitlab`)
55
+ - GitHub (`github`)
56
+ - GitLab (`gitlab`)
57
57
  - Bitbucket (`bitbucket`)
58
58
 
59
59
  ### Prerequisites
60
60
  To use Screwdriver, you will need the following prerequisites:
61
61
 
62
- - Node v8.0.0 or higher
62
+ - Node v12.0.0 or higher
63
63
  - [Kubernetes][kubectl] or [Docker][docker]
64
64
 
65
65
  ### From Source
package/bin/server CHANGED
@@ -210,6 +210,10 @@ const collectionFactory = Models.CollectionFactory.getInstance({
210
210
  datastore,
211
211
  datastoreRO
212
212
  });
213
+ const stageFactory = Models.StageFactory.getInstance({
214
+ datastore,
215
+ datastoreRO
216
+ });
213
217
  const triggerFactory = Models.TriggerFactory.getInstance({
214
218
  datastore,
215
219
  datastoreRO
@@ -246,6 +250,7 @@ datastore.setup(datastoreConfig.ddlSyncEnabled).then(() =>
246
250
  tokenFactory,
247
251
  eventFactory,
248
252
  collectionFactory,
253
+ stageFactory,
249
254
  triggerFactory,
250
255
  banners: authConfig,
251
256
  builds: {
package/lib/server.js CHANGED
@@ -74,6 +74,7 @@ function prettyPrintErrors(request, h) {
74
74
  * @param {Factory} config.tokenFactory Token Factory instance
75
75
  * @param {Factory} config.eventFactory Event Factory instance
76
76
  * @param {Factory} config.collectionFactory Collection Factory instance
77
+ * @param {Factory} config.stageFactory Stage Factory instance
77
78
  * @param {Factory} config.triggerFactory Trigger Factory instance
78
79
  * @param {Object} config.builds Config to include for builds plugin
79
80
  * @param {Object} config.builds.ecosystem List of hosts in the ecosystem
@@ -124,6 +125,7 @@ module.exports = async config => {
124
125
  commandTagFactory: config.commandTagFactory,
125
126
  templateFactory: config.templateFactory,
126
127
  templateTagFactory: config.templateTagFactory,
128
+ stageFactory: config.stageFactory,
127
129
  triggerFactory: config.triggerFactory,
128
130
  pipelineFactory: config.pipelineFactory,
129
131
  jobFactory: config.jobFactory,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "4.1.256",
3
+ "version": "4.1.259",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -79,7 +79,7 @@
79
79
  "@hapi/inert": "^6.0.4",
80
80
  "@hapi/vision": "^6.1.0",
81
81
  "@promster/hapi": "^6.1.0",
82
- "async": "^3.2.2",
82
+ "async": "^3.2.4",
83
83
  "badge-maker": "^3.3.1",
84
84
  "config": "^1.31.0",
85
85
  "date-fns": "^1.30.1",
@@ -87,7 +87,7 @@
87
87
  "hapi-auth-bearer-token": "^8.0.0",
88
88
  "hapi-auth-jwt2": "^10.2.0",
89
89
  "hapi-rate-limit": "^5.0.1",
90
- "hapi-swagger": "^14.2.4",
90
+ "hapi-swagger": "^14.5.5",
91
91
  "ioredis": "^4.28.0",
92
92
  "joi": "^17.4.2",
93
93
  "js-yaml": "^3.14.1",
@@ -102,7 +102,7 @@
102
102
  "screwdriver-build-bookend": "^2.4.0",
103
103
  "screwdriver-cache-bookend": "^2.0.2",
104
104
  "screwdriver-command-validator": "^2.1.0",
105
- "screwdriver-config-parser": "^7.4.0",
105
+ "screwdriver-config-parser": "^7.6.0",
106
106
  "screwdriver-coverage-bookend": "^1.0.3",
107
107
  "screwdriver-coverage-sonar": "^3.3.3",
108
108
  "screwdriver-data-schema": "^21.22.2",
@@ -114,14 +114,14 @@
114
114
  "screwdriver-executor-queue": "^3.1.2",
115
115
  "screwdriver-executor-router": "^2.3.0",
116
116
  "screwdriver-logger": "^1.1.0",
117
- "screwdriver-models": "^28.11.0",
117
+ "screwdriver-models": "^28.17.0",
118
118
  "screwdriver-notifications-email": "^2.2.0",
119
119
  "screwdriver-notifications-slack": "^3.2.1",
120
120
  "screwdriver-request": "^1.0.3",
121
121
  "screwdriver-scm-base": "^7.3.0",
122
122
  "screwdriver-scm-bitbucket": "^4.5.1",
123
- "screwdriver-scm-github": "^11.6.3",
124
- "screwdriver-scm-gitlab": "^2.7.2",
123
+ "screwdriver-scm-github": "^11.10.0",
124
+ "screwdriver-scm-gitlab": "^2.10.0",
125
125
  "screwdriver-scm-router": "^6.3.0",
126
126
  "screwdriver-template-validator": "^5.2.0",
127
127
  "screwdriver-workflow-parser": "^3.2.1",
@@ -153,7 +153,7 @@
153
153
  "mocha-sonarqube-reporter": "^1.0.2",
154
154
  "mockery": "^2.0.0",
155
155
  "mz": "^2.6.0",
156
- "nock": "^13.2.1",
156
+ "nock": "^13.2.7",
157
157
  "node-plantuml": "^0.5.0",
158
158
  "npm-auto-version": "^1.0.0",
159
159
  "nyc": "^15.0.0",
@@ -12,6 +12,7 @@ const listRoute = require('./list');
12
12
  const badgeRoute = require('./badge');
13
13
  const jobBadgeRoute = require('./jobBadge');
14
14
  const listJobsRoute = require('./listJobs');
15
+ const listStagesRoute = require('./listStages');
15
16
  const listTriggersRoute = require('./listTriggers');
16
17
  const listSecretsRoute = require('./listSecrets');
17
18
  const listEventsRoute = require('./listEvents');
@@ -177,6 +178,7 @@ const pipelinesPlugin = {
177
178
  badgeRoute({ statusColor }),
178
179
  jobBadgeRoute({ statusColor }),
179
180
  listJobsRoute(),
181
+ listStagesRoute(),
180
182
  listTriggersRoute(),
181
183
  listSecretsRoute(),
182
184
  listEventsRoute(),
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ const boom = require('@hapi/boom');
4
+ const joi = require('joi');
5
+ const schema = require('screwdriver-data-schema');
6
+ const pipelineIdSchema = schema.models.pipeline.base.extract('id');
7
+ const stageListSchema = joi
8
+ .array()
9
+ .items(schema.models.stage.base)
10
+ .label('List of stages');
11
+
12
+ module.exports = () => ({
13
+ method: 'GET',
14
+ path: '/pipelines/{id}/stages',
15
+ options: {
16
+ description: 'Get all stages for a given pipeline',
17
+ notes: 'Returns all stages for a given pipeline',
18
+ tags: ['api', 'pipelines', 'stages'],
19
+ auth: {
20
+ strategies: ['token'],
21
+ scope: ['user', 'build', 'pipeline']
22
+ },
23
+
24
+ handler: async (request, h) => {
25
+ const { pipelineFactory, stageFactory } = request.server.app;
26
+ const pipelineId = request.params.id;
27
+
28
+ return pipelineFactory
29
+ .get(pipelineId)
30
+ .then(pipeline => {
31
+ if (!pipeline) {
32
+ throw boom.notFound('Pipeline does not exist');
33
+ }
34
+
35
+ const config = {
36
+ params: { pipelineId }
37
+ };
38
+
39
+ if (request.query.state) {
40
+ config.params.state = request.query.state;
41
+ }
42
+
43
+ return stageFactory.list(config);
44
+ })
45
+ .then(stages => h.response(stages.map(s => s.toJson())))
46
+ .catch(err => {
47
+ throw err;
48
+ });
49
+ },
50
+ response: {
51
+ schema: stageListSchema
52
+ },
53
+ validate: {
54
+ params: joi.object({
55
+ id: pipelineIdSchema
56
+ })
57
+ }
58
+ }
59
+ });
@@ -20,9 +20,9 @@ module.exports = () => ({
20
20
  method: 'GET',
21
21
  path: '/pipelines/{id}/triggers',
22
22
  options: {
23
- description: 'Get all jobs for a given pipeline',
24
- notes: 'Returns all jobs for a given pipeline',
25
- tags: ['api', 'pipelines', 'jobs'],
23
+ description: 'Get all triggers for a given pipeline',
24
+ notes: 'Returns all triggers for a given pipeline',
25
+ tags: ['api', 'pipelines', 'triggers'],
26
26
  auth: {
27
27
  strategies: ['token'],
28
28
  scope: ['user', 'build', 'pipeline']