screwdriver-api 5.0.18 → 6.0.0
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 +1 -1
- package/Dockerfile.local +1 -1
- package/package.json +65 -64
- package/plugins/auth/index.js +8 -27
- package/plugins/auth/login.js +2 -2
- package/plugins/banners/create.js +1 -4
- package/plugins/buildClusters/create.js +2 -8
- package/plugins/buildClusters/list.js +1 -4
- package/plugins/builds/artifacts/get.js +2 -2
- package/plugins/builds/getBuildStatuses.js +1 -4
- package/plugins/builds/listSecrets.js +1 -4
- package/plugins/builds/steps/list.js +1 -4
- package/plugins/builds/steps/logs.js +2 -2
- package/plugins/collections/addPipelines.js +1 -4
- package/plugins/collections/create.js +1 -4
- package/plugins/collections/removePipelines.js +1 -4
- package/plugins/commands/create.js +1 -4
- package/plugins/commands/createTag.js +1 -4
- package/plugins/commands/list.js +2 -8
- package/plugins/commands/listTags.js +1 -4
- package/plugins/commands/listVersions.js +1 -4
- package/plugins/events/create.js +3 -13
- package/plugins/events/listBuilds.js +3 -14
- package/plugins/events/stopBuilds.js +1 -4
- package/plugins/helper.js +1 -5
- package/plugins/jobs/listBuilds.js +3 -14
- package/plugins/jobs/metrics.js +3 -6
- package/plugins/jobs/notify.js +1 -1
- package/plugins/lock.js +1 -1
- package/plugins/pipelines/caches/delete.js +2 -9
- package/plugins/pipelines/create.js +1 -4
- package/plugins/pipelines/helper.js +1 -4
- package/plugins/pipelines/list.js +2 -8
- package/plugins/pipelines/listEvents.js +1 -4
- package/plugins/pipelines/listJobs.js +2 -9
- package/plugins/pipelines/listSecrets.js +1 -4
- package/plugins/pipelines/listStages.js +1 -4
- package/plugins/pipelines/metrics.js +2 -8
- package/plugins/pipelines/tokens/create.js +1 -4
- package/plugins/secrets/create.js +1 -4
- package/plugins/templates/create.js +1 -4
- package/plugins/templates/createTag.js +1 -4
- package/plugins/templates/list.js +2 -8
- package/plugins/templates/listTags.js +1 -4
- package/plugins/templates/listVersions.js +1 -4
- package/plugins/tokens/create.js +1 -4
- package/plugins/versions.js +1 -4
- package/plugins/webhooks/helper.js +1 -1
- package/plugins/webhooks/index.js +3 -12
package/Dockerfile
CHANGED
package/Dockerfile.local
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screwdriver-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "API server for the Screwdriver.cd service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"pretest": "eslint . --quiet",
|
|
8
8
|
"test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --reporter mocha-multi-reporters --reporter-options configFile=./mocha.config.json --recursive --timeout 10000 --retries 1 --exit --allow-uncaught true --color true",
|
|
9
|
+
"test-debug": "mocha --inspect ./test/**/*.js",
|
|
9
10
|
"start": "./bin/server",
|
|
10
11
|
"debug": "node --nolazy ./bin/server",
|
|
11
12
|
"profile": "node --prof ./bin/server",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"url": "git@github.com:screwdriver-cd/screwdriver.git"
|
|
25
26
|
},
|
|
26
27
|
"engines": {
|
|
27
|
-
"node": ">=
|
|
28
|
+
"node": ">=18.0.0"
|
|
28
29
|
},
|
|
29
30
|
"greenkeeper": {
|
|
30
31
|
"ignore": [
|
|
@@ -67,68 +68,67 @@
|
|
|
67
68
|
"Jithin Emmanuel <jithin1987@gmail.com>"
|
|
68
69
|
],
|
|
69
70
|
"dependencies": {
|
|
70
|
-
"@hapi/bell": "^
|
|
71
|
-
"@hapi/boom": "^
|
|
72
|
-
"@hapi/cookie": "^
|
|
73
|
-
"@hapi/crumb": "^
|
|
71
|
+
"@hapi/bell": "^13.0.0",
|
|
72
|
+
"@hapi/boom": "^10.0.0",
|
|
73
|
+
"@hapi/cookie": "^12.0.0",
|
|
74
|
+
"@hapi/crumb": "^9.0.0",
|
|
74
75
|
"@hapi/good": "^9.0.1",
|
|
75
76
|
"@hapi/good-console": "^9.0.1",
|
|
76
77
|
"@hapi/good-squeeze": "^6.0.0",
|
|
77
|
-
"@hapi/hapi": "^
|
|
78
|
-
"@hapi/hoek": "^
|
|
79
|
-
"@hapi/inert": "^
|
|
80
|
-
"@hapi/vision": "^
|
|
81
|
-
"@promster/hapi": "^
|
|
78
|
+
"@hapi/hapi": "^21.1.0",
|
|
79
|
+
"@hapi/hoek": "^11.0.0",
|
|
80
|
+
"@hapi/inert": "^7.0.0",
|
|
81
|
+
"@hapi/vision": "^7.0.0",
|
|
82
|
+
"@promster/hapi": "^8.0.6",
|
|
82
83
|
"async": "^3.2.4",
|
|
83
84
|
"badge-maker": "^3.3.1",
|
|
84
|
-
"config": "^
|
|
85
|
-
"
|
|
86
|
-
"dayjs": "^1.11.6",
|
|
85
|
+
"config": "^3.3.8",
|
|
86
|
+
"dayjs": "^1.11.7",
|
|
87
87
|
"hapi-auth-bearer-token": "^8.0.0",
|
|
88
|
-
"hapi-auth-jwt2": "^10.
|
|
89
|
-
"hapi-rate-limit": "^
|
|
90
|
-
"hapi-swagger": "^
|
|
88
|
+
"hapi-auth-jwt2": "^10.4.0",
|
|
89
|
+
"hapi-rate-limit": "^6.0.0",
|
|
90
|
+
"hapi-swagger": "^15.0.0",
|
|
91
91
|
"ioredis": "^5.2.3",
|
|
92
92
|
"joi": "^17.7.0",
|
|
93
93
|
"js-yaml": "^3.14.1",
|
|
94
94
|
"jsonwebtoken": "^8.5.1",
|
|
95
|
-
"license-checker": "^
|
|
95
|
+
"license-checker": "^25.0.1",
|
|
96
96
|
"lodash.mergewith": "^4.6.2",
|
|
97
|
-
"ndjson": "^
|
|
97
|
+
"ndjson": "^2.0.0",
|
|
98
98
|
"node-env-file": "^0.1.8",
|
|
99
99
|
"prom-client": "^12.0.0",
|
|
100
|
-
"redlock": "^4.
|
|
101
|
-
"screwdriver-artifact-bookend": "^
|
|
102
|
-
"screwdriver-build-bookend": "^
|
|
103
|
-
"screwdriver-cache-bookend": "^
|
|
104
|
-
"screwdriver-command-validator": "^
|
|
105
|
-
"screwdriver-config-parser": "^
|
|
106
|
-
"screwdriver-coverage-bookend": "^
|
|
107
|
-
"screwdriver-coverage-sonar": "^
|
|
108
|
-
"screwdriver-data-schema": "^
|
|
109
|
-
"screwdriver-datastore-sequelize": "^
|
|
110
|
-
"screwdriver-executor-base": "^
|
|
111
|
-
"screwdriver-executor-docker": "^
|
|
112
|
-
"screwdriver-executor-k8s": "^
|
|
100
|
+
"redlock": "^4.2.0",
|
|
101
|
+
"screwdriver-artifact-bookend": "^2.0.0",
|
|
102
|
+
"screwdriver-build-bookend": "^4.0.0",
|
|
103
|
+
"screwdriver-cache-bookend": "^3.0.0",
|
|
104
|
+
"screwdriver-command-validator": "^3.0.0",
|
|
105
|
+
"screwdriver-config-parser": "^8.0.1",
|
|
106
|
+
"screwdriver-coverage-bookend": "^2.0.0",
|
|
107
|
+
"screwdriver-coverage-sonar": "^4.0.0",
|
|
108
|
+
"screwdriver-data-schema": "^22.0.1",
|
|
109
|
+
"screwdriver-datastore-sequelize": "^8.0.0",
|
|
110
|
+
"screwdriver-executor-base": "^9.0.1",
|
|
111
|
+
"screwdriver-executor-docker": "^6.0.0",
|
|
112
|
+
"screwdriver-executor-k8s": "^15.0.1",
|
|
113
113
|
"screwdriver-executor-k8s-vm": "^4.3.2",
|
|
114
|
-
"screwdriver-executor-queue": "^
|
|
115
|
-
"screwdriver-executor-router": "^
|
|
116
|
-
"screwdriver-logger": "^
|
|
117
|
-
"screwdriver-models": "^
|
|
118
|
-
"screwdriver-notifications-email": "^
|
|
119
|
-
"screwdriver-notifications-slack": "^
|
|
120
|
-
"screwdriver-request": "^
|
|
121
|
-
"screwdriver-scm-base": "^
|
|
122
|
-
"screwdriver-scm-bitbucket": "^
|
|
123
|
-
"screwdriver-scm-github": "^
|
|
124
|
-
"screwdriver-scm-gitlab": "^
|
|
125
|
-
"screwdriver-scm-router": "^
|
|
126
|
-
"screwdriver-template-validator": "^
|
|
127
|
-
"screwdriver-workflow-parser": "^
|
|
128
|
-
"sqlite3": "^5.1.
|
|
114
|
+
"screwdriver-executor-queue": "^4.0.0",
|
|
115
|
+
"screwdriver-executor-router": "^3.0.0",
|
|
116
|
+
"screwdriver-logger": "^2.0.0",
|
|
117
|
+
"screwdriver-models": "^29.0.0",
|
|
118
|
+
"screwdriver-notifications-email": "^3.0.0",
|
|
119
|
+
"screwdriver-notifications-slack": "^4.0.0",
|
|
120
|
+
"screwdriver-request": "^2.0.1",
|
|
121
|
+
"screwdriver-scm-base": "^8.0.0",
|
|
122
|
+
"screwdriver-scm-bitbucket": "^5.0.0",
|
|
123
|
+
"screwdriver-scm-github": "^12.0.0",
|
|
124
|
+
"screwdriver-scm-gitlab": "^3.0.0",
|
|
125
|
+
"screwdriver-scm-router": "^7.0.0",
|
|
126
|
+
"screwdriver-template-validator": "^6.0.0",
|
|
127
|
+
"screwdriver-workflow-parser": "^4.0.0",
|
|
128
|
+
"sqlite3": "^5.1.4",
|
|
129
129
|
"stream": "0.0.2",
|
|
130
130
|
"tinytim": "^0.1.1",
|
|
131
|
-
"uuid": "^
|
|
131
|
+
"uuid": "^9.0.0",
|
|
132
132
|
"verror": "^1.10.1"
|
|
133
133
|
},
|
|
134
134
|
"release": {
|
|
@@ -138,27 +138,28 @@
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
|
-
"@octokit/rest": "^
|
|
142
|
-
"chai": "
|
|
143
|
-
"chai-as-promised": "^
|
|
141
|
+
"@octokit/rest": "^19.0.5",
|
|
142
|
+
"chai": "^4.3.7",
|
|
143
|
+
"chai-as-promised": "^7.1.1",
|
|
144
144
|
"chai-jwt": "^2.0.0",
|
|
145
145
|
"coveralls": "^3.1.1",
|
|
146
|
-
"cucumber": "6.0.
|
|
147
|
-
"cucumber-pretty": "^6.0.
|
|
148
|
-
"eslint": "^
|
|
149
|
-
"eslint-config-screwdriver": "^
|
|
150
|
-
"form-data": "^
|
|
151
|
-
"
|
|
146
|
+
"cucumber": "^6.0.7",
|
|
147
|
+
"cucumber-pretty": "^6.0.1",
|
|
148
|
+
"eslint": "^8.28.0",
|
|
149
|
+
"eslint-config-screwdriver": "^7.0.0",
|
|
150
|
+
"form-data": "^4.0.0",
|
|
151
|
+
"import-fresh": "^3.3.0",
|
|
152
|
+
"mocha": "^10.1.0",
|
|
152
153
|
"mocha-multi-reporters": "^1.5.1",
|
|
153
154
|
"mocha-sonarqube-reporter": "^1.0.2",
|
|
154
|
-
"mockery": "^2.
|
|
155
|
-
"mz": "^2.
|
|
155
|
+
"mockery": "^2.1.0",
|
|
156
|
+
"mz": "^2.7.0",
|
|
156
157
|
"nock": "^13.2.9",
|
|
157
|
-
"node-plantuml": "^0.5.0",
|
|
158
158
|
"npm-auto-version": "^1.0.0",
|
|
159
|
-
"nyc": "^15.
|
|
160
|
-
"rewire": "^
|
|
161
|
-
"
|
|
162
|
-
"
|
|
159
|
+
"nyc": "^15.1.0",
|
|
160
|
+
"rewire": "^6.0.0",
|
|
161
|
+
"rewiremock": "^3.14.4",
|
|
162
|
+
"sinon": "^15.0.0",
|
|
163
|
+
"stream-to-promise": "^3.0.0"
|
|
163
164
|
}
|
|
164
165
|
}
|
package/plugins/auth/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const joi = require('joi');
|
|
4
4
|
const jwt = require('jsonwebtoken');
|
|
5
|
-
const
|
|
5
|
+
const { v4: uuidv4 } = require('uuid');
|
|
6
6
|
const contextsRoute = require('./contexts');
|
|
7
7
|
const crumbRoute = require('./crumb');
|
|
8
8
|
const keyRoute = require('./key');
|
|
@@ -12,10 +12,7 @@ const tokenRoute = require('./token');
|
|
|
12
12
|
|
|
13
13
|
const DEFAULT_TIMEOUT = 2 * 60; // 2h in minutes
|
|
14
14
|
const ALGORITHM = 'RS256';
|
|
15
|
-
const JOI_BOOLEAN = joi
|
|
16
|
-
.boolean()
|
|
17
|
-
.truthy('true')
|
|
18
|
-
.falsy('false');
|
|
15
|
+
const JOI_BOOLEAN = joi.boolean().truthy('true').falsy('false');
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
*
|
|
@@ -56,18 +53,9 @@ const createDefaultCollection = async function createDefaultCollection(user, col
|
|
|
56
53
|
const AUTH_PLUGIN_SCHEMA = joi.object().keys({
|
|
57
54
|
jwtEnvironment: joi.string().default(''),
|
|
58
55
|
https: JOI_BOOLEAN.required(),
|
|
59
|
-
cookiePassword: joi
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.required(),
|
|
63
|
-
encryptionPassword: joi
|
|
64
|
-
.string()
|
|
65
|
-
.min(32)
|
|
66
|
-
.required(),
|
|
67
|
-
hashingPassword: joi
|
|
68
|
-
.string()
|
|
69
|
-
.min(32)
|
|
70
|
-
.required(),
|
|
56
|
+
cookiePassword: joi.string().min(32).required(),
|
|
57
|
+
encryptionPassword: joi.string().min(32).required(),
|
|
58
|
+
hashingPassword: joi.string().min(32).required(),
|
|
71
59
|
allowGuestAccess: JOI_BOOLEAN.default(false),
|
|
72
60
|
jwtPrivateKey: joi.string().required(),
|
|
73
61
|
jwtPublicKey: joi.string().required(),
|
|
@@ -76,16 +64,9 @@ const AUTH_PLUGIN_SCHEMA = joi.object().keys({
|
|
|
76
64
|
admins: joi.array().default([]),
|
|
77
65
|
bell: joi.object().required(),
|
|
78
66
|
scm: joi.object().required(),
|
|
79
|
-
sessionTimeout: joi
|
|
80
|
-
.number()
|
|
81
|
-
.integer()
|
|
82
|
-
.positive()
|
|
83
|
-
.default(120),
|
|
67
|
+
sessionTimeout: joi.number().integer().positive().default(120),
|
|
84
68
|
oauthRedirectUri: joi.string().optional(),
|
|
85
|
-
sameSite: joi
|
|
86
|
-
.alternatives()
|
|
87
|
-
.try(JOI_BOOLEAN, joi.string())
|
|
88
|
-
.required(),
|
|
69
|
+
sameSite: joi.alternatives().try(JOI_BOOLEAN, joi.string()).required(),
|
|
89
70
|
path: joi.string().required()
|
|
90
71
|
});
|
|
91
72
|
|
|
@@ -151,7 +132,7 @@ const authPlugin = {
|
|
|
151
132
|
jwt.sign(profile, pluginOptions.jwtPrivateKey, {
|
|
152
133
|
algorithm: ALGORITHM,
|
|
153
134
|
expiresIn: buildTimeout * 60, // must be in second
|
|
154
|
-
jwtid:
|
|
135
|
+
jwtid: uuidv4()
|
|
155
136
|
})
|
|
156
137
|
);
|
|
157
138
|
|
package/plugins/auth/login.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
|
-
const
|
|
4
|
+
const { v4: uuidv4 } = require('uuid');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Add a guest route for those who want to be in read-only mode
|
|
@@ -31,7 +31,7 @@ function addGuestRoute(config) {
|
|
|
31
31
|
return boom.forbidden('Guest users are not allowed access');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const username = `guest/${
|
|
34
|
+
const username = `guest/${uuidv4()}`;
|
|
35
35
|
const profile = request.server.plugins.auth.generateProfile(username, null, ['user', 'guest'], {});
|
|
36
36
|
|
|
37
37
|
// Log that the user has authenticated
|
|
@@ -47,10 +47,7 @@ module.exports = () => ({
|
|
|
47
47
|
pathname: `${request.path}/${banner.id}`
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
return h
|
|
51
|
-
.response(banner.toJson())
|
|
52
|
-
.header('Location', location)
|
|
53
|
-
.code(201);
|
|
50
|
+
return h.response(banner.toJson()).header('Location', location).code(201);
|
|
54
51
|
})
|
|
55
52
|
.catch(err => {
|
|
56
53
|
throw err;
|
|
@@ -50,10 +50,7 @@ module.exports = () => ({
|
|
|
50
50
|
pathname: `${request.path}/${buildCluster.id}`
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
return h
|
|
54
|
-
.response(buildCluster.toJson())
|
|
55
|
-
.header('Location', location)
|
|
56
|
-
.code(201);
|
|
53
|
+
return h.response(buildCluster.toJson()).header('Location', location).code(201);
|
|
57
54
|
})
|
|
58
55
|
// something was botched
|
|
59
56
|
.catch(err => {
|
|
@@ -103,10 +100,7 @@ module.exports = () => ({
|
|
|
103
100
|
pathname: `${request.path}/${buildCluster.id}`
|
|
104
101
|
});
|
|
105
102
|
|
|
106
|
-
return h
|
|
107
|
-
.response(buildCluster.toJson())
|
|
108
|
-
.header('Location', location)
|
|
109
|
-
.code(201);
|
|
103
|
+
return h.response(buildCluster.toJson()).header('Location', location).code(201);
|
|
110
104
|
})
|
|
111
105
|
// something was botched
|
|
112
106
|
.catch(err => {
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const joi = require('joi');
|
|
4
4
|
const schema = require('screwdriver-data-schema');
|
|
5
|
-
const listSchema = joi
|
|
6
|
-
.array()
|
|
7
|
-
.items(schema.models.buildCluster.get)
|
|
8
|
-
.label('List of build clusters');
|
|
5
|
+
const listSchema = joi.array().items(schema.models.buildCluster.get).label('List of build clusters');
|
|
9
6
|
|
|
10
7
|
module.exports = () => ({
|
|
11
8
|
method: 'GET',
|
|
@@ -5,7 +5,7 @@ const joi = require('joi');
|
|
|
5
5
|
const jwt = require('jsonwebtoken');
|
|
6
6
|
const request = require('screwdriver-request');
|
|
7
7
|
const schema = require('screwdriver-data-schema');
|
|
8
|
-
const
|
|
8
|
+
const { v4: uuidv4 } = require('uuid');
|
|
9
9
|
const idSchema = schema.models.build.base.extract('id');
|
|
10
10
|
const artifactSchema = joi.string().label('Artifact Name');
|
|
11
11
|
const typeSchema = joi.string().default('preview').valid('download', 'preview').label('Flag to trigger type either to download or preview');
|
|
@@ -52,7 +52,7 @@ module.exports = config => ({
|
|
|
52
52
|
}, config.authConfig.jwtPrivateKey, {
|
|
53
53
|
algorithm: 'RS256',
|
|
54
54
|
expiresIn: '5s',
|
|
55
|
-
jwtid:
|
|
55
|
+
jwtid: uuidv4()
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
let baseUrl = `${config.ecosystem.store}/v1/builds/`
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const stringSchema = joi.string().regex(/^[0-9]+$/);
|
|
6
|
-
const jobIdsSchema = joi
|
|
7
|
-
.alternatives()
|
|
8
|
-
.try(joi.array().items(stringSchema), stringSchema)
|
|
9
|
-
.required();
|
|
6
|
+
const jobIdsSchema = joi.alternatives().try(joi.array().items(stringSchema), stringSchema).required();
|
|
10
7
|
|
|
11
8
|
module.exports = () => ({
|
|
12
9
|
method: 'GET',
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const buildListSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.secret.get)
|
|
9
|
-
.label('List of secrets');
|
|
6
|
+
const buildListSchema = joi.array().items(schema.models.secret.get).label('List of secrets');
|
|
10
7
|
const buildIdSchema = schema.models.build.base.extract('id');
|
|
11
8
|
|
|
12
9
|
module.exports = () => ({
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const listSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.build.getStep)
|
|
9
|
-
.label('List of steps');
|
|
6
|
+
const listSchema = joi.array().items(schema.models.build.getStep).label('List of steps');
|
|
10
7
|
|
|
11
8
|
module.exports = () => ({
|
|
12
9
|
method: 'GET',
|
|
@@ -6,7 +6,7 @@ const logger = require('screwdriver-logger');
|
|
|
6
6
|
const ndjson = require('ndjson');
|
|
7
7
|
const request = require('screwdriver-request');
|
|
8
8
|
const schema = require('screwdriver-data-schema');
|
|
9
|
-
const
|
|
9
|
+
const { v4: uuidv4 } = require('uuid');
|
|
10
10
|
|
|
11
11
|
const MAX_LINES_SMALL = 100;
|
|
12
12
|
const MAX_LINES_BIG = 1000;
|
|
@@ -200,7 +200,7 @@ module.exports = config => ({
|
|
|
200
200
|
{
|
|
201
201
|
algorithm: 'RS256',
|
|
202
202
|
expiresIn: '300s',
|
|
203
|
-
jwtid:
|
|
203
|
+
jwtid: uuidv4()
|
|
204
204
|
}
|
|
205
205
|
);
|
|
206
206
|
const { sort, type } = req.query;
|
|
@@ -5,10 +5,7 @@ const schema = require('screwdriver-data-schema');
|
|
|
5
5
|
const joi = require('joi');
|
|
6
6
|
const idSchema = schema.models.collection.base.extract('id');
|
|
7
7
|
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
|
|
8
|
-
const pipelineIdsSchema = joi
|
|
9
|
-
.alternatives()
|
|
10
|
-
.try(joi.array().items(pipelineIdSchema), pipelineIdSchema)
|
|
11
|
-
.required();
|
|
8
|
+
const pipelineIdsSchema = joi.alternatives().try(joi.array().items(pipelineIdSchema), pipelineIdSchema).required();
|
|
12
9
|
const IDS_KEY = 'ids[]';
|
|
13
10
|
|
|
14
11
|
module.exports = () => ({
|
|
@@ -78,10 +78,7 @@ module.exports = () => ({
|
|
|
78
78
|
pathname: `${request.path}/${collection.id}`
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
return h
|
|
82
|
-
.response(collection.toJson())
|
|
83
|
-
.header('Location', location)
|
|
84
|
-
.code(201);
|
|
81
|
+
return h.response(collection.toJson()).header('Location', location).code(201);
|
|
85
82
|
})
|
|
86
83
|
// something broke, respond with error
|
|
87
84
|
.catch(err => {
|
|
@@ -5,10 +5,7 @@ const schema = require('screwdriver-data-schema');
|
|
|
5
5
|
const joi = require('joi');
|
|
6
6
|
const idSchema = schema.models.collection.base.extract('id');
|
|
7
7
|
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
|
|
8
|
-
const pipelineIdsSchema = joi
|
|
9
|
-
.alternatives()
|
|
10
|
-
.try(joi.array().items(pipelineIdSchema), pipelineIdSchema)
|
|
11
|
-
.required();
|
|
8
|
+
const pipelineIdsSchema = joi.alternatives().try(joi.array().items(pipelineIdSchema), pipelineIdSchema).required();
|
|
12
9
|
const IDS_KEY = 'ids[]';
|
|
13
10
|
|
|
14
11
|
module.exports = () => ({
|
|
@@ -190,10 +190,7 @@ module.exports = () => ({
|
|
|
190
190
|
pathname: `${request.path}/${command.id}`
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
return h
|
|
194
|
-
.response(command.toJson())
|
|
195
|
-
.header('Location', location)
|
|
196
|
-
.code(201);
|
|
193
|
+
return h.response(command.toJson()).header('Location', location).code(201);
|
|
197
194
|
})
|
|
198
195
|
.catch(err => {
|
|
199
196
|
throw err;
|
|
@@ -81,10 +81,7 @@ module.exports = () => ({
|
|
|
81
81
|
pathname: `${request.path}/${newTag.id}`
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
return h
|
|
85
|
-
.response(newTag.toJson())
|
|
86
|
-
.header('Location', location)
|
|
87
|
-
.code(201);
|
|
84
|
+
return h.response(newTag.toJson()).header('Location', location).code(201);
|
|
88
85
|
});
|
|
89
86
|
})
|
|
90
87
|
.catch(err => {
|
package/plugins/commands/list.js
CHANGED
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const joi = require('joi');
|
|
4
4
|
const schema = require('screwdriver-data-schema');
|
|
5
|
-
const listSchema = joi
|
|
6
|
-
.array()
|
|
7
|
-
.items(schema.models.command.get)
|
|
8
|
-
.label('List of commands');
|
|
5
|
+
const listSchema = joi.array().items(schema.models.command.get).label('List of commands');
|
|
9
6
|
const listCountSchema = joi
|
|
10
7
|
.object()
|
|
11
8
|
.keys({
|
|
@@ -17,10 +14,7 @@ const distinctSchema = joi
|
|
|
17
14
|
.string()
|
|
18
15
|
.valid(...Object.keys(schema.models.command.fields))
|
|
19
16
|
.label('Field to return unique results by');
|
|
20
|
-
const compactSchema = joi
|
|
21
|
-
.string()
|
|
22
|
-
.valid('', 'false', 'true')
|
|
23
|
-
.label('Flag to return compact data');
|
|
17
|
+
const compactSchema = joi.string().valid('', 'false', 'true').label('Flag to return compact data');
|
|
24
18
|
const namespaceSchema = schema.models.command.base.extract('namespace');
|
|
25
19
|
const namespacesSchema = joi.array().items(joi.object().keys({ namespace: namespaceSchema }));
|
|
26
20
|
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const joi = require('joi');
|
|
4
4
|
const schema = require('screwdriver-data-schema');
|
|
5
|
-
const listSchema = joi
|
|
6
|
-
.array()
|
|
7
|
-
.items(schema.models.commandTag.base)
|
|
8
|
-
.label('List of command tags');
|
|
5
|
+
const listSchema = joi.array().items(schema.models.commandTag.base).label('List of command tags');
|
|
9
6
|
const namespaceSchema = schema.models.commandTag.base.extract('namespace');
|
|
10
7
|
const nameSchema = schema.models.commandTag.base.extract('name');
|
|
11
8
|
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const listSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.command.get)
|
|
9
|
-
.label('List of commands');
|
|
6
|
+
const listSchema = joi.array().items(schema.models.command.get).label('List of commands');
|
|
10
7
|
const nameSchema = schema.models.command.base.extract('name');
|
|
11
8
|
const namespaceSchema = schema.models.command.base.extract('namespace');
|
|
12
9
|
|
package/plugins/events/create.js
CHANGED
|
@@ -26,15 +26,8 @@ module.exports = () => ({
|
|
|
26
26
|
const { isValidToken } = request.server.plugins.pipelines;
|
|
27
27
|
const { updateAdmins } = request.server.plugins.events;
|
|
28
28
|
|
|
29
|
-
let {
|
|
30
|
-
|
|
31
|
-
startFrom,
|
|
32
|
-
parentBuildId,
|
|
33
|
-
parentBuilds,
|
|
34
|
-
groupEventId,
|
|
35
|
-
parentEventId,
|
|
36
|
-
prNum
|
|
37
|
-
} = request.payload;
|
|
29
|
+
let { pipelineId, startFrom, parentBuildId, parentBuilds, groupEventId, parentEventId, prNum } =
|
|
30
|
+
request.payload;
|
|
38
31
|
|
|
39
32
|
// restart case
|
|
40
33
|
if (buildId) {
|
|
@@ -245,10 +238,7 @@ module.exports = () => ({
|
|
|
245
238
|
pathname: `${request.path}/${event.id}`
|
|
246
239
|
});
|
|
247
240
|
|
|
248
|
-
return h
|
|
249
|
-
.response(event.toJson())
|
|
250
|
-
.header('Location', location)
|
|
251
|
-
.code(201);
|
|
241
|
+
return h.response(event.toJson()).header('Location', location).code(201);
|
|
252
242
|
},
|
|
253
243
|
validate: {
|
|
254
244
|
payload: validationSchema.models.event.create
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const buildListSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.build.get)
|
|
9
|
-
.label('List of builds');
|
|
6
|
+
const buildListSchema = joi.array().items(schema.models.build.get).label('List of builds');
|
|
10
7
|
const eventIdSchema = schema.models.event.base.extract('id');
|
|
11
8
|
|
|
12
9
|
module.exports = () => ({
|
|
@@ -53,16 +50,8 @@ module.exports = () => ({
|
|
|
53
50
|
}),
|
|
54
51
|
query: schema.api.pagination.concat(
|
|
55
52
|
joi.object({
|
|
56
|
-
readOnly: joi
|
|
57
|
-
|
|
58
|
-
.truthy('true')
|
|
59
|
-
.falsy('false')
|
|
60
|
-
.default(false),
|
|
61
|
-
fetchSteps: joi
|
|
62
|
-
.boolean()
|
|
63
|
-
.truthy('true')
|
|
64
|
-
.falsy('false')
|
|
65
|
-
.default(true),
|
|
53
|
+
readOnly: joi.boolean().truthy('true').falsy('false').default(false),
|
|
54
|
+
fetchSteps: joi.boolean().truthy('true').falsy('false').default(true),
|
|
66
55
|
search: joi.forbidden() // we don't support search for Event list builds
|
|
67
56
|
})
|
|
68
57
|
)
|
|
@@ -89,10 +89,7 @@ module.exports = () => ({
|
|
|
89
89
|
pathname: `${request.path}/${event.id}`
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
return h
|
|
93
|
-
.response(event.toJson())
|
|
94
|
-
.header('Location', location)
|
|
95
|
-
.code(200);
|
|
92
|
+
return h.response(event.toJson()).header('Location', location).code(200);
|
|
96
93
|
},
|
|
97
94
|
response: {
|
|
98
95
|
schema: getSchema
|
package/plugins/helper.js
CHANGED
|
@@ -13,11 +13,7 @@ const dayjs = require('dayjs');
|
|
|
13
13
|
*/
|
|
14
14
|
function setDefaultTimeRange(start, end, maxDay) {
|
|
15
15
|
const endTime = end || new Date().toISOString();
|
|
16
|
-
const startTime =
|
|
17
|
-
start ||
|
|
18
|
-
dayjs(endTime)
|
|
19
|
-
.subtract(maxDay, 'days')
|
|
20
|
-
.toISOString();
|
|
16
|
+
const startTime = start || dayjs(endTime).subtract(maxDay, 'days').toISOString();
|
|
21
17
|
|
|
22
18
|
return { startTime, endTime };
|
|
23
19
|
}
|
|
@@ -5,10 +5,7 @@ const joi = require('joi');
|
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
6
|
const jobIdSchema = schema.models.job.base.extract('id');
|
|
7
7
|
const statusSchema = schema.models.build.base.extract('status');
|
|
8
|
-
const buildListSchema = joi
|
|
9
|
-
.array()
|
|
10
|
-
.items(schema.models.build.get)
|
|
11
|
-
.label('List of builds');
|
|
8
|
+
const buildListSchema = joi.array().items(schema.models.build.get).label('List of builds');
|
|
12
9
|
|
|
13
10
|
module.exports = () => ({
|
|
14
11
|
method: 'GET',
|
|
@@ -75,16 +72,8 @@ module.exports = () => ({
|
|
|
75
72
|
}),
|
|
76
73
|
query: schema.api.pagination.concat(
|
|
77
74
|
joi.object({
|
|
78
|
-
readOnly: joi
|
|
79
|
-
|
|
80
|
-
.truthy('true')
|
|
81
|
-
.falsy('false')
|
|
82
|
-
.default(false),
|
|
83
|
-
fetchSteps: joi
|
|
84
|
-
.boolean()
|
|
85
|
-
.truthy('true')
|
|
86
|
-
.falsy('false')
|
|
87
|
-
.default(true),
|
|
75
|
+
readOnly: joi.boolean().truthy('true').falsy('false').default(false),
|
|
76
|
+
fetchSteps: joi.boolean().truthy('true').falsy('false').default(true),
|
|
88
77
|
status: statusSchema,
|
|
89
78
|
search: joi.forbidden() // we don't support search for Job list builds
|
|
90
79
|
})
|
package/plugins/jobs/metrics.js
CHANGED
|
@@ -64,12 +64,9 @@ module.exports = () => ({
|
|
|
64
64
|
query: joi.object({
|
|
65
65
|
startTime: joi.string().isoDate(),
|
|
66
66
|
endTime: joi.string().isoDate(),
|
|
67
|
-
aggregateInterval: joi
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
.messages({
|
|
71
|
-
'any.only': '{{#label}} fails because it must be one of none, day, week, month, year'
|
|
72
|
-
})
|
|
67
|
+
aggregateInterval: joi.string().valid('none', 'day', 'week', 'month', 'year').messages({
|
|
68
|
+
'any.only': '{{#label}} fails because it must be one of none, day, week, month, year'
|
|
69
|
+
})
|
|
73
70
|
})
|
|
74
71
|
}
|
|
75
72
|
}
|
package/plugins/jobs/notify.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = () => ({
|
|
|
30
30
|
throw boom.notFound(`Job ${jobId} does not exist`);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const pipelineId = job
|
|
33
|
+
const { pipelineId } = job;
|
|
34
34
|
|
|
35
35
|
if (pipelineId !== credentials.pipelineId) {
|
|
36
36
|
throw boom.forbidden('Token does not have permission for this pipeline');
|
package/plugins/lock.js
CHANGED
|
@@ -30,7 +30,7 @@ class Lock {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const redisLockConfig = config.get('redisLock.options');
|
|
33
|
-
const connectionType = redisLockConfig
|
|
33
|
+
const { connectionType } = redisLockConfig;
|
|
34
34
|
|
|
35
35
|
if (!connectionType || (connectionType !== 'redis' && connectionType !== 'redisCluster')) {
|
|
36
36
|
throw new Error(
|
|
@@ -7,15 +7,8 @@ const api = require('./request');
|
|
|
7
7
|
const { getUserPermissions, getScmUri } = require('../../helper');
|
|
8
8
|
|
|
9
9
|
const SCHEMA_SCOPE_PIPELINE_ID = schema.models.pipeline.base.extract('id');
|
|
10
|
-
const SCHEMA_SCOPE_NAME = joi
|
|
11
|
-
|
|
12
|
-
.valid('events', 'jobs', 'pipelines')
|
|
13
|
-
.label('Scope Name');
|
|
14
|
-
const SCHEMA_SCOPE_CACHE_ID = joi
|
|
15
|
-
.number()
|
|
16
|
-
.integer()
|
|
17
|
-
.positive()
|
|
18
|
-
.label('Event/Job/Pipeline ID');
|
|
10
|
+
const SCHEMA_SCOPE_NAME = joi.string().valid('events', 'jobs', 'pipelines').label('Scope Name');
|
|
11
|
+
const SCHEMA_SCOPE_CACHE_ID = joi.number().integer().positive().label('Event/Job/Pipeline ID');
|
|
19
12
|
|
|
20
13
|
module.exports = () => ({
|
|
21
14
|
method: 'DELETE',
|
|
@@ -132,10 +132,7 @@ module.exports = () => ({
|
|
|
132
132
|
});
|
|
133
133
|
const data = await results.toJson();
|
|
134
134
|
|
|
135
|
-
return h
|
|
136
|
-
.response(data)
|
|
137
|
-
.header('Location', location)
|
|
138
|
-
.code(201);
|
|
135
|
+
return h.response(data).header('Location', location).code(201);
|
|
139
136
|
},
|
|
140
137
|
validate: {
|
|
141
138
|
payload: schema.models.pipeline.create
|
|
@@ -19,10 +19,7 @@ const formatCheckoutUrl = checkoutUrl => {
|
|
|
19
19
|
// Check if branch name exists
|
|
20
20
|
// Do not convert branch name to lowercase
|
|
21
21
|
if (branchName) {
|
|
22
|
-
result = result
|
|
23
|
-
.split('#')[0]
|
|
24
|
-
.toLowerCase()
|
|
25
|
-
.concat(branchName);
|
|
22
|
+
result = result.split('#')[0].toLowerCase().concat(branchName);
|
|
26
23
|
} else {
|
|
27
24
|
result = result.toLowerCase();
|
|
28
25
|
}
|
|
@@ -3,14 +3,8 @@
|
|
|
3
3
|
const joi = require('joi');
|
|
4
4
|
const schema = require('screwdriver-data-schema');
|
|
5
5
|
const idSchema = schema.models.pipeline.base.extract('id');
|
|
6
|
-
const listSchema = joi
|
|
7
|
-
|
|
8
|
-
.items(schema.models.pipeline.get)
|
|
9
|
-
.label('List of Pipelines');
|
|
10
|
-
const pipelineIdsSchema = joi
|
|
11
|
-
.alternatives()
|
|
12
|
-
.try(joi.array().items(idSchema), idSchema)
|
|
13
|
-
.required();
|
|
6
|
+
const listSchema = joi.array().items(schema.models.pipeline.get).label('List of Pipelines');
|
|
7
|
+
const pipelineIdsSchema = joi.alternatives().try(joi.array().items(idSchema), idSchema).required();
|
|
14
8
|
const IDS_KEY = 'ids[]';
|
|
15
9
|
|
|
16
10
|
module.exports = () => ({
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const eventListSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.event.get)
|
|
9
|
-
.label('List of events');
|
|
6
|
+
const eventListSchema = joi.array().items(schema.models.event.get).label('List of events');
|
|
10
7
|
const prNumSchema = schema.models.event.base.extract('prNum');
|
|
11
8
|
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
|
|
12
9
|
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const jobListSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.job.get)
|
|
9
|
-
.label('List of jobs');
|
|
6
|
+
const jobListSchema = joi.array().items(schema.models.job.get).label('List of jobs');
|
|
10
7
|
const jobNameSchema = schema.models.job.base.extract('name');
|
|
11
8
|
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
|
|
12
9
|
|
|
@@ -62,11 +59,7 @@ module.exports = () => ({
|
|
|
62
59
|
}),
|
|
63
60
|
query: schema.api.pagination.concat(
|
|
64
61
|
joi.object({
|
|
65
|
-
archived: joi
|
|
66
|
-
.boolean()
|
|
67
|
-
.truthy('true')
|
|
68
|
-
.falsy('false')
|
|
69
|
-
.default(false),
|
|
62
|
+
archived: joi.boolean().truthy('true').falsy('false').default(false),
|
|
70
63
|
jobName: jobNameSchema,
|
|
71
64
|
search: joi.forbidden() // we don't support search for Pipeline list jobs
|
|
72
65
|
})
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const secretListSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.secret.get)
|
|
9
|
-
.label('List of secrets');
|
|
6
|
+
const secretListSchema = joi.array().items(schema.models.secret.get).label('List of secrets');
|
|
10
7
|
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
|
|
11
8
|
|
|
12
9
|
module.exports = () => ({
|
|
@@ -4,10 +4,7 @@ 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 stageListSchema = joi
|
|
8
|
-
.array()
|
|
9
|
-
.items(schema.models.stage.base)
|
|
10
|
-
.label('List of stages');
|
|
7
|
+
const stageListSchema = joi.array().items(schema.models.stage.base).label('List of stages');
|
|
11
8
|
|
|
12
9
|
module.exports = () => ({
|
|
13
10
|
method: 'GET',
|
|
@@ -10,15 +10,9 @@ const DOWNTIME_STATUSES_KEY = 'downtimeStatuses[]';
|
|
|
10
10
|
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
|
|
11
11
|
const pipelineMetricListSchema = joi.array().items(joi.object());
|
|
12
12
|
const jobIdSchema = joi.string().regex(/^[0-9]+$/);
|
|
13
|
-
const jobIdsSchema = joi
|
|
14
|
-
.alternatives()
|
|
15
|
-
.try(joi.array().items(jobIdSchema), jobIdSchema)
|
|
16
|
-
.required();
|
|
13
|
+
const jobIdsSchema = joi.alternatives().try(joi.array().items(jobIdSchema), jobIdSchema).required();
|
|
17
14
|
const statusSchema = schema.models.build.base.extract('status');
|
|
18
|
-
const statusesSchema = joi
|
|
19
|
-
.alternatives()
|
|
20
|
-
.try(joi.array().items(statusSchema), statusSchema)
|
|
21
|
-
.required();
|
|
15
|
+
const statusesSchema = joi.alternatives().try(joi.array().items(statusSchema), statusSchema).required();
|
|
22
16
|
|
|
23
17
|
module.exports = () => ({
|
|
24
18
|
method: 'GET',
|
|
@@ -69,10 +69,7 @@ module.exports = () => ({
|
|
|
69
69
|
pathname: `${request.path}/${token.id}`
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
return h
|
|
73
|
-
.response(token.toJson())
|
|
74
|
-
.header('Location', location)
|
|
75
|
-
.code(201);
|
|
72
|
+
return h.response(token.toJson()).header('Location', location).code(201);
|
|
76
73
|
},
|
|
77
74
|
validate: {
|
|
78
75
|
params: joi.object({
|
|
@@ -72,10 +72,7 @@ module.exports = () => ({
|
|
|
72
72
|
|
|
73
73
|
delete output.value;
|
|
74
74
|
|
|
75
|
-
return h
|
|
76
|
-
.response(output)
|
|
77
|
-
.header('Location', location)
|
|
78
|
-
.code(201);
|
|
75
|
+
return h.response(output).header('Location', location).code(201);
|
|
79
76
|
},
|
|
80
77
|
validate: {
|
|
81
78
|
payload: schema.models.secret.create
|
|
@@ -69,10 +69,7 @@ module.exports = () => ({
|
|
|
69
69
|
pathname: `${request.path}/${template.id}`
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
return h
|
|
73
|
-
.response(template.toJson())
|
|
74
|
-
.header('Location', location)
|
|
75
|
-
.code(201);
|
|
72
|
+
return h.response(template.toJson()).header('Location', location).code(201);
|
|
76
73
|
})
|
|
77
74
|
.catch(err => {
|
|
78
75
|
throw err;
|
|
@@ -60,10 +60,7 @@ module.exports = () => ({
|
|
|
60
60
|
pathname: `${request.path}/${newTag.id}`
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
return h
|
|
64
|
-
.response(newTag.toJson())
|
|
65
|
-
.header('Location', location)
|
|
66
|
-
.code(201);
|
|
63
|
+
return h.response(newTag.toJson()).header('Location', location).code(201);
|
|
67
64
|
});
|
|
68
65
|
})
|
|
69
66
|
.catch(err => {
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const joi = require('joi');
|
|
4
4
|
const schema = require('screwdriver-data-schema');
|
|
5
|
-
const listSchema = joi
|
|
6
|
-
.array()
|
|
7
|
-
.items(schema.models.template.get)
|
|
8
|
-
.label('List of templates');
|
|
5
|
+
const listSchema = joi.array().items(schema.models.template.get).label('List of templates');
|
|
9
6
|
const listCountSchema = joi
|
|
10
7
|
.object()
|
|
11
8
|
.keys({
|
|
@@ -17,10 +14,7 @@ const distinctSchema = joi
|
|
|
17
14
|
.string()
|
|
18
15
|
.valid(...Object.keys(schema.models.template.fields))
|
|
19
16
|
.label('Field to return unique results by');
|
|
20
|
-
const compactSchema = joi
|
|
21
|
-
.string()
|
|
22
|
-
.valid('', 'false', 'true')
|
|
23
|
-
.label('Flag to return compact data');
|
|
17
|
+
const compactSchema = joi.string().valid('', 'false', 'true').label('Flag to return compact data');
|
|
24
18
|
const namespaceSchema = schema.models.template.base.extract('namespace');
|
|
25
19
|
const namespacesSchema = joi.array().items(joi.object().keys({ namespace: namespaceSchema }));
|
|
26
20
|
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const joi = require('joi');
|
|
4
4
|
const schema = require('screwdriver-data-schema');
|
|
5
|
-
const listSchema = joi
|
|
6
|
-
.array()
|
|
7
|
-
.items(schema.models.templateTag.base)
|
|
8
|
-
.label('List of templates');
|
|
5
|
+
const listSchema = joi.array().items(schema.models.templateTag.base).label('List of templates');
|
|
9
6
|
const nameSchema = schema.models.templateTag.base.extract('name');
|
|
10
7
|
|
|
11
8
|
module.exports = () => ({
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const boom = require('@hapi/boom');
|
|
4
4
|
const joi = require('joi');
|
|
5
5
|
const schema = require('screwdriver-data-schema');
|
|
6
|
-
const listSchema = joi
|
|
7
|
-
.array()
|
|
8
|
-
.items(schema.models.template.get)
|
|
9
|
-
.label('List of templates');
|
|
6
|
+
const listSchema = joi.array().items(schema.models.template.get).label('List of templates');
|
|
10
7
|
const nameSchema = schema.models.template.base.extract('name');
|
|
11
8
|
|
|
12
9
|
module.exports = () => ({
|
package/plugins/tokens/create.js
CHANGED
|
@@ -53,10 +53,7 @@ module.exports = () => ({
|
|
|
53
53
|
pathname: `${request.path}/${token.id}`
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
return h
|
|
57
|
-
.response(token.toJson())
|
|
58
|
-
.header('Location', location)
|
|
59
|
-
.code(201);
|
|
56
|
+
return h.response(token.toJson()).header('Location', location).code(201);
|
|
60
57
|
})
|
|
61
58
|
// something broke, respond with error
|
|
62
59
|
.catch(err => {
|
package/plugins/versions.js
CHANGED
|
@@ -35,10 +35,7 @@ const versionsTemplate = {
|
|
|
35
35
|
}
|
|
36
36
|
const depArray = Object.keys(json).map(key => ({ name: key, ...json[key] }));
|
|
37
37
|
const depDisplay = depArray.map(dep => ({
|
|
38
|
-
name: dep.name
|
|
39
|
-
.split('@')
|
|
40
|
-
.slice(0, -1)
|
|
41
|
-
.join('@'),
|
|
38
|
+
name: dep.name.split('@').slice(0, -1).join('@'),
|
|
42
39
|
repository: dep.repository || 'UNKNOWN',
|
|
43
40
|
licenses: dep.licenses || 'UNKNOWN'
|
|
44
41
|
}));
|
|
@@ -22,7 +22,7 @@ function isReleaseOrTagFilteringEnabled(action, workflowGraph) {
|
|
|
22
22
|
let isFilteringEnabled = true;
|
|
23
23
|
|
|
24
24
|
workflowGraph.edges.forEach(edge => {
|
|
25
|
-
const releaseOrTagRegExp = action === 'release' ?
|
|
25
|
+
const releaseOrTagRegExp = action === 'release' ? /^~(release)$/ : /^~(tag)$/;
|
|
26
26
|
|
|
27
27
|
if (edge.src.match(releaseOrTagRegExp)) {
|
|
28
28
|
isFilteringEnabled = false;
|
|
@@ -29,19 +29,10 @@ const webhooksPlugin = {
|
|
|
29
29
|
options,
|
|
30
30
|
joi.object().keys({
|
|
31
31
|
username: joi.string().required(),
|
|
32
|
-
ignoreCommitsBy: joi
|
|
33
|
-
|
|
34
|
-
.items(joi.string())
|
|
35
|
-
.optional(),
|
|
36
|
-
restrictPR: joi
|
|
37
|
-
.string()
|
|
38
|
-
.valid('all', 'none', 'branch', 'fork')
|
|
39
|
-
.optional(),
|
|
32
|
+
ignoreCommitsBy: joi.array().items(joi.string()).optional(),
|
|
33
|
+
restrictPR: joi.string().valid('all', 'none', 'branch', 'fork').optional(),
|
|
40
34
|
chainPR: joi.boolean().optional(),
|
|
41
|
-
maxBytes: joi
|
|
42
|
-
.number()
|
|
43
|
-
.integer()
|
|
44
|
-
.optional()
|
|
35
|
+
maxBytes: joi.number().integer().optional()
|
|
45
36
|
}),
|
|
46
37
|
'Invalid config for plugin-webhooks'
|
|
47
38
|
);
|