screwdriver-api 7.0.94 → 7.0.96
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/Dockerfile
CHANGED
|
@@ -21,5 +21,11 @@ RUN ln -s /usr/src/app/node_modules/screwdriver-api/config /config
|
|
|
21
21
|
# Expose the web service port
|
|
22
22
|
EXPOSE 8080
|
|
23
23
|
|
|
24
|
+
# Add Tini
|
|
25
|
+
ENV TINI_VERSION v0.19.0
|
|
26
|
+
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
|
|
27
|
+
RUN chmod +x /tini
|
|
28
|
+
ENTRYPOINT ["/tini", "--"]
|
|
29
|
+
|
|
24
30
|
# Run the service
|
|
25
|
-
CMD [ "
|
|
31
|
+
CMD [ "node", "./bin/server" ]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screwdriver-api",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.96",
|
|
4
4
|
"description": "API server for the Screwdriver.cd service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"screwdriver-coverage-bookend": "^2.0.0",
|
|
107
107
|
"screwdriver-coverage-sonar": "^4.1.1",
|
|
108
108
|
"screwdriver-data-schema": "^v23.0.0",
|
|
109
|
-
"screwdriver-datastore-sequelize": "^8.
|
|
109
|
+
"screwdriver-datastore-sequelize": "^8.1.1",
|
|
110
110
|
"screwdriver-executor-base": "^9.0.1",
|
|
111
111
|
"screwdriver-executor-docker": "^6.0.0",
|
|
112
112
|
"screwdriver-executor-k8s": "^15.0.1",
|
|
@@ -360,4 +360,24 @@ Delete the template tag. This does not delete the template itself.
|
|
|
360
360
|
|
|
361
361
|
* `namespace` - Namespace of the template
|
|
362
362
|
* `name` - Name of the template
|
|
363
|
-
* `tag` - Tag name of the template
|
|
363
|
+
* `tag` - Tag name of the template
|
|
364
|
+
|
|
365
|
+
##### Update a pipeline template's trusted property
|
|
366
|
+
|
|
367
|
+
Update a pipeline template's trusted property
|
|
368
|
+
|
|
369
|
+
`PUT /pipeline/templates/{namespace}/{name}/trusted`
|
|
370
|
+
|
|
371
|
+
###### Arguments
|
|
372
|
+
|
|
373
|
+
'namespace', 'name'
|
|
374
|
+
|
|
375
|
+
* `namespace` - Namespace of the template
|
|
376
|
+
* `name` - Name of the template
|
|
377
|
+
|
|
378
|
+
Example payload:
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"trusted": true
|
|
382
|
+
}
|
|
383
|
+
```
|
|
@@ -41,6 +41,7 @@ const getVersionRoute = require('./templates/getVersion');
|
|
|
41
41
|
const removeTemplateRoute = require('./templates/remove');
|
|
42
42
|
const removeTemplateTagRoute = require('./templates/removeTag');
|
|
43
43
|
const removeTemplateVersionRoute = require('./templates/removeVersion');
|
|
44
|
+
const updateTrustedRoute = require('./templates/updateTrusted');
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Pipeline API Plugin
|
|
@@ -272,7 +273,8 @@ const pipelinesPlugin = {
|
|
|
272
273
|
createTagRoute(),
|
|
273
274
|
removeTemplateRoute(),
|
|
274
275
|
removeTemplateTagRoute(),
|
|
275
|
-
removeTemplateVersionRoute()
|
|
276
|
+
removeTemplateVersionRoute(),
|
|
277
|
+
updateTrustedRoute()
|
|
276
278
|
]);
|
|
277
279
|
}
|
|
278
280
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const boom = require('@hapi/boom');
|
|
4
|
+
const joi = require('joi');
|
|
5
|
+
const schema = require('screwdriver-data-schema');
|
|
6
|
+
const metaSchema = schema.models.templateMeta.base;
|
|
7
|
+
|
|
8
|
+
module.exports = () => ({
|
|
9
|
+
method: 'PUT',
|
|
10
|
+
path: '/pipeline/templates/{namespace}/{name}/trusted',
|
|
11
|
+
options: {
|
|
12
|
+
description: "Update a pipeline template's trusted property",
|
|
13
|
+
notes: 'Returns null if successful',
|
|
14
|
+
tags: ['api', 'pipeline', 'templates', 'trusted'],
|
|
15
|
+
auth: {
|
|
16
|
+
strategies: ['token'],
|
|
17
|
+
scope: ['admin', '!guest']
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
handler: async (request, h) => {
|
|
21
|
+
const { namespace, name } = request.params;
|
|
22
|
+
const { pipelineTemplateFactory } = request.server.app;
|
|
23
|
+
const { trusted } = request.payload;
|
|
24
|
+
|
|
25
|
+
const pipelineTemplateMeta = await pipelineTemplateFactory.get({
|
|
26
|
+
name,
|
|
27
|
+
namespace
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (!pipelineTemplateMeta) {
|
|
31
|
+
throw boom.notFound(`Pipeline template ${namespace}/${name} does not exist`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!trusted) {
|
|
35
|
+
pipelineTemplateMeta.trustedSinceVersion = null;
|
|
36
|
+
} else if (trusted && !pipelineTemplateMeta.trustedSinceVersion) {
|
|
37
|
+
pipelineTemplateMeta.trustedSinceVersion = pipelineTemplateMeta.latestVersion;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return pipelineTemplateMeta.update().then(
|
|
41
|
+
() => h.response().code(204),
|
|
42
|
+
err => h.response(boom.boomify(err))
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
validate: {
|
|
46
|
+
params: joi.object({
|
|
47
|
+
namespace: metaSchema.extract('namespace'),
|
|
48
|
+
name: metaSchema.extract('name')
|
|
49
|
+
}),
|
|
50
|
+
payload: joi.object({
|
|
51
|
+
trusted: joi.boolean().description('Whether pipeline template is trusted')
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|