screwdriver-api 7.0.121 → 7.0.123
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 +3 -1
- package/lib/registerPlugins.js +1 -0
- package/package.json +1 -1
- package/plugins/pipelines/README.md +3 -1
- package/plugins/pipelines/listStages.js +27 -2
- package/plugins/stages/README.md +5 -0
- package/plugins/stages/get.js +46 -0
- package/plugins/stages/index.js +2 -1
- package/plugins/stages/stageBuilds/list.js +5 -3
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ For more information about Screwdriver, check out our [homepage](http://screwdri
|
|
|
24
24
|
|
|
25
25
|
### Plugins
|
|
26
26
|
|
|
27
|
-
This API comes preloaded with
|
|
27
|
+
This API comes preloaded with 18 (eighteen) resources:
|
|
28
28
|
|
|
29
29
|
- [auth](plugins/auth/README.md)
|
|
30
30
|
- [banners](plugins/banners/README.md)
|
|
@@ -37,6 +37,8 @@ This API comes preloaded with 16 (sixteen) resources:
|
|
|
37
37
|
- [jobs](plugins/jobs/README.md)
|
|
38
38
|
- [pipelines](plugins/pipelines/README.md)
|
|
39
39
|
- [secrets](plugins/secrets/README.md)
|
|
40
|
+
- [stages](plugins/stages/README.md)
|
|
41
|
+
- [stageBuilds](plugins/stageBuilds/README.md)
|
|
40
42
|
- [templates](plugins/templates/README.md)
|
|
41
43
|
- [tokens](plugins/tokens/README.md)
|
|
42
44
|
- [webhooks](plugins/webhooks/README.md)
|
package/lib/registerPlugins.js
CHANGED
package/package.json
CHANGED
|
@@ -139,7 +139,9 @@ Arguments:
|
|
|
139
139
|
|
|
140
140
|
#### Get all stages for a single pipeline
|
|
141
141
|
|
|
142
|
-
`
|
|
142
|
+
`page`, `count`, `sort`, `sortBy`, and `name` optional
|
|
143
|
+
|
|
144
|
+
`GET /pipelines/{id}/stages?page={pageNumber}&count={countNumber}&sort={sort}&name={stageName}`
|
|
143
145
|
|
|
144
146
|
#### Get all pipeline secrets
|
|
145
147
|
|
|
@@ -4,7 +4,8 @@ const boom = require('@hapi/boom');
|
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
6
|
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
|
|
7
|
-
const
|
|
7
|
+
const nameSchema = schema.models.stage.base.extract('name');
|
|
8
|
+
const stageListSchema = schema.models.stage.list;
|
|
8
9
|
|
|
9
10
|
module.exports = () => ({
|
|
10
11
|
method: 'GET',
|
|
@@ -20,6 +21,7 @@ module.exports = () => ({
|
|
|
20
21
|
|
|
21
22
|
handler: async (request, h) => {
|
|
22
23
|
const { pipelineFactory, stageFactory } = request.server.app;
|
|
24
|
+
const { name, sort, sortBy, page, count } = request.query;
|
|
23
25
|
const pipelineId = request.params.id;
|
|
24
26
|
|
|
25
27
|
return pipelineFactory
|
|
@@ -30,9 +32,31 @@ module.exports = () => ({
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
const config = {
|
|
33
|
-
params: { pipelineId }
|
|
35
|
+
params: { pipelineId },
|
|
36
|
+
sort
|
|
34
37
|
};
|
|
35
38
|
|
|
39
|
+
if (name) {
|
|
40
|
+
config.params = {
|
|
41
|
+
...config.params,
|
|
42
|
+
name
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (sortBy) {
|
|
47
|
+
config.sortBy = sortBy;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (page) {
|
|
51
|
+
config.paginate = config.paginate || {};
|
|
52
|
+
config.paginate.page = page;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (count) {
|
|
56
|
+
config.paginate = config.paginate || {};
|
|
57
|
+
config.paginate.count = count;
|
|
58
|
+
}
|
|
59
|
+
|
|
36
60
|
return stageFactory.list(config);
|
|
37
61
|
})
|
|
38
62
|
.then(stages => h.response(stages.map(s => s.toJson())))
|
|
@@ -49,6 +73,7 @@ module.exports = () => ({
|
|
|
49
73
|
}),
|
|
50
74
|
query: schema.api.pagination.concat(
|
|
51
75
|
joi.object({
|
|
76
|
+
name: nameSchema,
|
|
52
77
|
search: joi.forbidden() // we don't support search for Pipeline list stages
|
|
53
78
|
})
|
|
54
79
|
)
|
package/plugins/stages/README.md
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const boom = require('@hapi/boom');
|
|
4
|
+
const joi = require('joi');
|
|
5
|
+
const schema = require('screwdriver-data-schema');
|
|
6
|
+
const getSchema = schema.models.stage.get;
|
|
7
|
+
const idSchema = schema.models.stage.base.extract('id');
|
|
8
|
+
|
|
9
|
+
module.exports = () => ({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/stages/{id}',
|
|
12
|
+
options: {
|
|
13
|
+
description: 'Get a single stage',
|
|
14
|
+
notes: 'Returns a stage record',
|
|
15
|
+
tags: ['api', 'stages'],
|
|
16
|
+
auth: {
|
|
17
|
+
strategies: ['token'],
|
|
18
|
+
scope: ['user', 'build', 'pipeline']
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
handler: async (request, h) => {
|
|
22
|
+
const { stageFactory } = request.server.app;
|
|
23
|
+
|
|
24
|
+
return stageFactory
|
|
25
|
+
.get(request.params.id)
|
|
26
|
+
.then(model => {
|
|
27
|
+
if (!model) {
|
|
28
|
+
throw boom.notFound(`Stage ${request.params.id} does not exist`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return h.response(model.toJson());
|
|
32
|
+
})
|
|
33
|
+
.catch(err => {
|
|
34
|
+
throw err;
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
response: {
|
|
38
|
+
schema: getSchema
|
|
39
|
+
},
|
|
40
|
+
validate: {
|
|
41
|
+
params: joi.object({
|
|
42
|
+
id: idSchema
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
package/plugins/stages/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const getStageBuildsRoute = require('./stageBuilds/list');
|
|
4
|
+
const getRoute = require('./get');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Stage API Plugin
|
|
@@ -12,7 +13,7 @@ const getStageBuildsRoute = require('./stageBuilds/list');
|
|
|
12
13
|
const stagesPlugin = {
|
|
13
14
|
name: 'stages',
|
|
14
15
|
async register(server) {
|
|
15
|
-
server.route([getStageBuildsRoute()]);
|
|
16
|
+
server.route([getStageBuildsRoute(), getRoute()]);
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
|
|
@@ -29,9 +29,9 @@ module.exports = () => ({
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
return stageFactory.get(
|
|
32
|
+
return stageFactory.get(request.params.id).then(async stage => {
|
|
33
33
|
if (!stage) {
|
|
34
|
-
throw boom.notFound(`Stage ${
|
|
34
|
+
throw boom.notFound(`Stage ${request.params.id} does not exist`);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (page || count) {
|
|
@@ -60,7 +60,9 @@ module.exports = () => ({
|
|
|
60
60
|
}),
|
|
61
61
|
query: schema.api.pagination.concat(
|
|
62
62
|
joi.object({
|
|
63
|
-
eventId: eventIdSchema
|
|
63
|
+
eventId: eventIdSchema,
|
|
64
|
+
search: joi.forbidden(), // we don't support search for Stage list stageBuilds
|
|
65
|
+
getCount: joi.forbidden()
|
|
64
66
|
})
|
|
65
67
|
)
|
|
66
68
|
}
|