screwdriver-data-schema 21.28.4 → 22.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/api/commandValidator.js +4 -12
- package/api/loglines.js +6 -24
- package/api/pagination.js +9 -24
- package/api/stats.js +6 -23
- package/api/templateValidator.js +4 -12
- package/api/validator.js +3 -10
- package/config/base.js +4 -13
- package/config/command.js +3 -15
- package/config/commandFormat.js +7 -23
- package/config/job.js +10 -30
- package/config/parameters.js +1 -3
- package/config/provider.js +13 -61
- package/config/regex.js +4 -2
- package/config/settings.js +1 -7
- package/config/template.js +3 -10
- package/core/scm.js +29 -112
- package/models/banner.js +4 -15
- package/models/build.js +16 -58
- package/models/buildCluster.js +5 -20
- package/models/collection.js +10 -36
- package/models/command.js +1 -5
- package/models/commandTag.js +1 -5
- package/models/event.js +6 -26
- package/models/job.js +7 -29
- package/models/pipeline.js +4 -16
- package/models/secret.js +3 -13
- package/models/stage.js +6 -30
- package/models/step.js +12 -34
- package/models/template.js +3 -13
- package/models/templateTag.js +2 -9
- package/models/token.js +6 -23
- package/models/trigger.js +5 -16
- package/models/user.js +2 -9
- package/package.json +11 -11
- package/plugins/datastore.js +10 -38
- package/plugins/executor.js +4 -14
- package/plugins/notifications.js +2 -6
- package/plugins/scm.js +6 -22
package/core/scm.js
CHANGED
|
@@ -12,15 +12,9 @@ const SCHEMA_USER = Joi.object()
|
|
|
12
12
|
.label('Link to Profile')
|
|
13
13
|
.example('https://github.com/stjohnjohnson'),
|
|
14
14
|
|
|
15
|
-
name: Joi.string()
|
|
16
|
-
.required()
|
|
17
|
-
.label('Display Name')
|
|
18
|
-
.example('Dao Lam'),
|
|
15
|
+
name: Joi.string().required().label('Display Name').example('Dao Lam'),
|
|
19
16
|
|
|
20
|
-
username: Joi.string()
|
|
21
|
-
.required()
|
|
22
|
-
.label('Username')
|
|
23
|
-
.example('d2lam'),
|
|
17
|
+
username: Joi.string().required().label('Username').example('d2lam'),
|
|
24
18
|
|
|
25
19
|
avatar: Joi.string()
|
|
26
20
|
.uri()
|
|
@@ -47,10 +41,7 @@ const SCHEMA_REPO = Joi.object()
|
|
|
47
41
|
.keys({
|
|
48
42
|
name: REPO_NAME,
|
|
49
43
|
|
|
50
|
-
branch: Joi.string()
|
|
51
|
-
.required()
|
|
52
|
-
.label('Branch of the repository')
|
|
53
|
-
.example('master'),
|
|
44
|
+
branch: Joi.string().required().label('Branch of the repository').example('master'),
|
|
54
45
|
|
|
55
46
|
url: Joi.string()
|
|
56
47
|
.uri()
|
|
@@ -58,9 +49,7 @@ const SCHEMA_REPO = Joi.object()
|
|
|
58
49
|
.label('Link to Repository')
|
|
59
50
|
.example('https://github.com/screwdriver-cd/screwdriver/tree/master'),
|
|
60
51
|
|
|
61
|
-
private: Joi.boolean()
|
|
62
|
-
.optional()
|
|
63
|
-
.label('Whether or not the pipeline is private'),
|
|
52
|
+
private: Joi.boolean().optional().label('Whether or not the pipeline is private'),
|
|
64
53
|
|
|
65
54
|
rootDir: ROOT_DIR
|
|
66
55
|
})
|
|
@@ -68,23 +57,15 @@ const SCHEMA_REPO = Joi.object()
|
|
|
68
57
|
|
|
69
58
|
const SCHEMA_COMMAND = Joi.object()
|
|
70
59
|
.keys({
|
|
71
|
-
name: Joi.equal('sd-checkout-code')
|
|
72
|
-
.required()
|
|
73
|
-
.label('Command name')
|
|
74
|
-
.example('sd-checkout-code'),
|
|
60
|
+
name: Joi.equal('sd-checkout-code').required().label('Command name').example('sd-checkout-code'),
|
|
75
61
|
|
|
76
|
-
command: Joi.string()
|
|
77
|
-
.required()
|
|
78
|
-
.label('Checkout command to run')
|
|
62
|
+
command: Joi.string().required().label('Checkout command to run')
|
|
79
63
|
})
|
|
80
64
|
.label('SCM Command');
|
|
81
65
|
|
|
82
66
|
const SCHEMA_COMMIT = Joi.object()
|
|
83
67
|
.keys({
|
|
84
|
-
message: Joi.string()
|
|
85
|
-
.required()
|
|
86
|
-
.label('Commit message')
|
|
87
|
-
.example('Fixing a bug with signing'),
|
|
68
|
+
message: Joi.string().required().label('Commit message').example('Fixing a bug with signing'),
|
|
88
69
|
|
|
89
70
|
author: SCHEMA_USER.required().label('Author of the commit'),
|
|
90
71
|
|
|
@@ -100,39 +81,15 @@ const SCHEMA_COMMIT = Joi.object()
|
|
|
100
81
|
|
|
101
82
|
const SCHEMA_PR = Joi.object()
|
|
102
83
|
.keys({
|
|
103
|
-
url: Joi.string()
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.optional()
|
|
113
|
-
.label('Ref of the pull request'),
|
|
114
|
-
prSource: Joi.string()
|
|
115
|
-
.allow('')
|
|
116
|
-
.optional()
|
|
117
|
-
.label('Origin of the pull request'),
|
|
118
|
-
prBranchName: Joi.string()
|
|
119
|
-
.allow('')
|
|
120
|
-
.optional()
|
|
121
|
-
.label('Branch name of the pull request'),
|
|
122
|
-
createTime: Joi.date()
|
|
123
|
-
.iso()
|
|
124
|
-
.label('Creation Time of the pull request')
|
|
125
|
-
.example('2018-10-10T21:35:31Z'),
|
|
126
|
-
username: Joi.string()
|
|
127
|
-
.label('Username')
|
|
128
|
-
.example('d2lam'),
|
|
129
|
-
userProfile: Joi.string()
|
|
130
|
-
.uri()
|
|
131
|
-
.label('Link to Profile')
|
|
132
|
-
.example('https://github.com/anonymous'),
|
|
133
|
-
baseBranch: Joi.string()
|
|
134
|
-
.label('Base branch of the pull request')
|
|
135
|
-
.example('master')
|
|
84
|
+
url: Joi.string().uri().label('Link to PR').example('https://github.com/screwdriver-cd/screwdriver/pull/1'),
|
|
85
|
+
title: Joi.string().max(512).label('Title of the pull request'),
|
|
86
|
+
ref: Joi.string().allow('').optional().label('Ref of the pull request'),
|
|
87
|
+
prSource: Joi.string().allow('').optional().label('Origin of the pull request'),
|
|
88
|
+
prBranchName: Joi.string().allow('').optional().label('Branch name of the pull request'),
|
|
89
|
+
createTime: Joi.date().iso().label('Creation Time of the pull request').example('2018-10-10T21:35:31Z'),
|
|
90
|
+
username: Joi.string().label('Username').example('d2lam'),
|
|
91
|
+
userProfile: Joi.string().uri().label('Link to Profile').example('https://github.com/anonymous'),
|
|
92
|
+
baseBranch: Joi.string().label('Base branch of the pull request').example('master')
|
|
136
93
|
})
|
|
137
94
|
.label('SCM Pull Request');
|
|
138
95
|
|
|
@@ -158,26 +115,13 @@ const SCHEMA_HOOK = Joi.object()
|
|
|
158
115
|
.example('git@github.com:screwdriver-cd/data-schema.git#master')
|
|
159
116
|
.example('https://github.com/screwdriver-cd/data-schema.git#master'),
|
|
160
117
|
|
|
161
|
-
hookId: Joi.string()
|
|
162
|
-
.allow('')
|
|
163
|
-
.optional()
|
|
164
|
-
.label('Uuid of the event'),
|
|
118
|
+
hookId: Joi.string().allow('').optional().label('Uuid of the event'),
|
|
165
119
|
|
|
166
|
-
lastCommitMessage: Joi.string()
|
|
167
|
-
.allow('')
|
|
168
|
-
.optional()
|
|
169
|
-
.label('Last commit message'),
|
|
120
|
+
lastCommitMessage: Joi.string().allow('').optional().label('Last commit message'),
|
|
170
121
|
|
|
171
|
-
prNum: Joi.number()
|
|
172
|
-
.integer()
|
|
173
|
-
.positive()
|
|
174
|
-
.optional()
|
|
175
|
-
.label('PR number'),
|
|
122
|
+
prNum: Joi.number().integer().positive().optional().label('PR number'),
|
|
176
123
|
|
|
177
|
-
prRef: Joi.string()
|
|
178
|
-
.allow('')
|
|
179
|
-
.optional()
|
|
180
|
-
.label('PR reference of the repository'),
|
|
124
|
+
prRef: Joi.string().allow('').optional().label('PR reference of the repository'),
|
|
181
125
|
|
|
182
126
|
ref: Joi.string()
|
|
183
127
|
.when('action', {
|
|
@@ -196,10 +140,7 @@ const SCHEMA_HOOK = Joi.object()
|
|
|
196
140
|
.optional()
|
|
197
141
|
.label('PR original source'),
|
|
198
142
|
|
|
199
|
-
prTitle: Joi.string()
|
|
200
|
-
.allow('')
|
|
201
|
-
.optional()
|
|
202
|
-
.label('PR title'),
|
|
143
|
+
prTitle: Joi.string().allow('').optional().label('PR title'),
|
|
203
144
|
|
|
204
145
|
scmContext: Joi.string()
|
|
205
146
|
.regex(Regex.SCM_CONTEXT)
|
|
@@ -226,47 +167,23 @@ const SCHEMA_HOOK = Joi.object()
|
|
|
226
167
|
.label('Commit SHA')
|
|
227
168
|
.example('ccc49349d3cffbd12ea9e3d41521480b4aa5de5f'),
|
|
228
169
|
|
|
229
|
-
type: Joi.string()
|
|
230
|
-
.valid('pr', 'repo', 'ping')
|
|
231
|
-
.required()
|
|
232
|
-
.label('Type of the event'),
|
|
170
|
+
type: Joi.string().valid('pr', 'repo', 'ping').required().label('Type of the event'),
|
|
233
171
|
|
|
234
172
|
username: SCHEMA_USER.extract('username'),
|
|
235
173
|
|
|
236
|
-
commitAuthors: Joi.array()
|
|
237
|
-
.items(Joi.string().allow(''))
|
|
238
|
-
.optional()
|
|
239
|
-
.label('Commit authors'),
|
|
174
|
+
commitAuthors: Joi.array().items(Joi.string().allow('')).optional().label('Commit authors'),
|
|
240
175
|
|
|
241
|
-
releaseId: Joi.string()
|
|
242
|
-
.allow('')
|
|
243
|
-
.optional()
|
|
244
|
-
.label('Release id'),
|
|
176
|
+
releaseId: Joi.string().allow('').optional().label('Release id'),
|
|
245
177
|
|
|
246
|
-
releaseName: Joi.string()
|
|
247
|
-
.allow('')
|
|
248
|
-
.optional()
|
|
249
|
-
.label('Name of the event'),
|
|
178
|
+
releaseName: Joi.string().allow('').optional().label('Name of the event'),
|
|
250
179
|
|
|
251
|
-
releaseAuthor: Joi.string()
|
|
252
|
-
.allow('')
|
|
253
|
-
.optional()
|
|
254
|
-
.label('Author of the event'),
|
|
180
|
+
releaseAuthor: Joi.string().allow('').optional().label('Author of the event'),
|
|
255
181
|
|
|
256
|
-
addedFiles: Joi.array()
|
|
257
|
-
.items(Joi.string().allow(''))
|
|
258
|
-
.optional()
|
|
259
|
-
.label('Added files of head commit'),
|
|
182
|
+
addedFiles: Joi.array().items(Joi.string().allow('')).optional().label('Added files of head commit'),
|
|
260
183
|
|
|
261
|
-
modifiedFiles: Joi.array()
|
|
262
|
-
.items(Joi.string().allow(''))
|
|
263
|
-
.optional()
|
|
264
|
-
.label('Modified files of head commit'),
|
|
184
|
+
modifiedFiles: Joi.array().items(Joi.string().allow('')).optional().label('Modified files of head commit'),
|
|
265
185
|
|
|
266
|
-
removedFiles: Joi.array()
|
|
267
|
-
.items(Joi.string().allow(''))
|
|
268
|
-
.optional()
|
|
269
|
-
.label('Removed files of head commit')
|
|
186
|
+
removedFiles: Joi.array().items(Joi.string().allow('')).optional().label('Removed files of head commit')
|
|
270
187
|
})
|
|
271
188
|
.label('SCM Hook');
|
|
272
189
|
|
package/models/banner.js
CHANGED
|
@@ -4,18 +4,14 @@ const Joi = require('joi');
|
|
|
4
4
|
const mutate = require('../lib/mutate');
|
|
5
5
|
|
|
6
6
|
const MODEL = {
|
|
7
|
-
id: Joi.number()
|
|
8
|
-
.integer()
|
|
9
|
-
.positive(),
|
|
7
|
+
id: Joi.number().integer().positive(),
|
|
10
8
|
|
|
11
9
|
message: Joi.string()
|
|
12
10
|
.max(512)
|
|
13
11
|
.description('Body of banner to display')
|
|
14
12
|
.example('Due to planned upgrade of Kubernetes, Screwdriver will be down'),
|
|
15
13
|
|
|
16
|
-
isActive: Joi.boolean()
|
|
17
|
-
.description('Flag if the banner is active')
|
|
18
|
-
.example(true),
|
|
14
|
+
isActive: Joi.boolean().description('Flag if the banner is active').example(true),
|
|
19
15
|
|
|
20
16
|
createTime: Joi.string()
|
|
21
17
|
.max(32)
|
|
@@ -23,16 +19,9 @@ const MODEL = {
|
|
|
23
19
|
.description('When this banner was created')
|
|
24
20
|
.example('2017-01-06T01:49:50.384359267Z'),
|
|
25
21
|
|
|
26
|
-
createdBy: Joi.string()
|
|
27
|
-
.max(128)
|
|
28
|
-
.description('Username of user creating the banner')
|
|
29
|
-
.example('batman123'),
|
|
22
|
+
createdBy: Joi.string().max(128).description('Username of user creating the banner').example('batman123'),
|
|
30
23
|
|
|
31
|
-
type: Joi.string()
|
|
32
|
-
.valid('info', 'warn')
|
|
33
|
-
.max(32)
|
|
34
|
-
.description('Type/Severity of the banner message')
|
|
35
|
-
.example('info')
|
|
24
|
+
type: Joi.string().valid('info', 'warn').max(32).description('Type/Severity of the banner message').example('info')
|
|
36
25
|
};
|
|
37
26
|
|
|
38
27
|
module.exports = {
|
package/models/build.js
CHANGED
|
@@ -6,9 +6,7 @@ const Scm = require('../core/scm');
|
|
|
6
6
|
const Regex = require('../config/regex');
|
|
7
7
|
const Job = require('../config/job');
|
|
8
8
|
const Step = require('./step');
|
|
9
|
-
const ID = Joi.number()
|
|
10
|
-
.integer()
|
|
11
|
-
.positive();
|
|
9
|
+
const ID = Joi.number().integer().positive();
|
|
12
10
|
const PARENT_BUILD_ID = ID;
|
|
13
11
|
const PARENT_BUILDS_ID = Joi.alternatives().try(ID, Joi.valid(null));
|
|
14
12
|
const buildClusterSchema = require('./buildCluster');
|
|
@@ -27,25 +25,13 @@ const STATUSES = [
|
|
|
27
25
|
];
|
|
28
26
|
|
|
29
27
|
const MODEL = {
|
|
30
|
-
id: Joi.number()
|
|
31
|
-
.integer()
|
|
32
|
-
.positive()
|
|
33
|
-
.description('Identifier of this build')
|
|
34
|
-
.example(123345),
|
|
28
|
+
id: Joi.number().integer().positive().description('Identifier of this build').example(123345),
|
|
35
29
|
|
|
36
30
|
environment: Job.environment,
|
|
37
31
|
|
|
38
|
-
eventId: Joi.number()
|
|
39
|
-
.integer()
|
|
40
|
-
.positive()
|
|
41
|
-
.description('Identifier of the parent event')
|
|
42
|
-
.example(123345),
|
|
32
|
+
eventId: Joi.number().integer().positive().description('Identifier of the parent event').example(123345),
|
|
43
33
|
|
|
44
|
-
jobId: Joi.number()
|
|
45
|
-
.integer()
|
|
46
|
-
.positive()
|
|
47
|
-
.description('Identifier of the parent job')
|
|
48
|
-
.example(123345),
|
|
34
|
+
jobId: Joi.number().integer().positive().description('Identifier of the parent job').example(123345),
|
|
49
35
|
|
|
50
36
|
parentBuildId: Joi.array()
|
|
51
37
|
.items(PARENT_BUILD_ID)
|
|
@@ -65,18 +51,11 @@ const MODEL = {
|
|
|
65
51
|
222: { eventId: 3, jobs: { jobC: 555 } }
|
|
66
52
|
}),
|
|
67
53
|
|
|
68
|
-
number: Joi.number()
|
|
69
|
-
.positive()
|
|
70
|
-
.description('Timestamp of create time')
|
|
71
|
-
.example(1473900790309),
|
|
54
|
+
number: Joi.number().positive().description('Timestamp of create time').example(1473900790309),
|
|
72
55
|
|
|
73
|
-
container: Joi.string()
|
|
74
|
-
.description('Container this build is running in')
|
|
75
|
-
.example('node:4'),
|
|
56
|
+
container: Joi.string().description('Container this build is running in').example('node:4'),
|
|
76
57
|
|
|
77
|
-
cause: Joi.string()
|
|
78
|
-
.description('Reason why this build started')
|
|
79
|
-
.example('pull request opened'),
|
|
58
|
+
cause: Joi.string().description('Reason why this build started').example('pull request opened'),
|
|
80
59
|
|
|
81
60
|
sha: Joi.string()
|
|
82
61
|
.hex()
|
|
@@ -90,24 +69,15 @@ const MODEL = {
|
|
|
90
69
|
|
|
91
70
|
commit: Scm.commit,
|
|
92
71
|
|
|
93
|
-
createTime: Joi.string()
|
|
94
|
-
.isoDate()
|
|
95
|
-
.max(32)
|
|
96
|
-
.description('When this build was created'),
|
|
72
|
+
createTime: Joi.string().isoDate().max(32).description('When this build was created'),
|
|
97
73
|
|
|
98
|
-
startTime: Joi.string()
|
|
99
|
-
.isoDate()
|
|
100
|
-
.description('When this build started on a build machine'),
|
|
74
|
+
startTime: Joi.string().isoDate().description('When this build started on a build machine'),
|
|
101
75
|
|
|
102
|
-
endTime: Joi.string()
|
|
103
|
-
.isoDate()
|
|
104
|
-
.description('When this build stopped running'),
|
|
76
|
+
endTime: Joi.string().isoDate().description('When this build stopped running'),
|
|
105
77
|
|
|
106
78
|
parameters: Joi.object().description('Input parameters that defined this build'),
|
|
107
79
|
|
|
108
|
-
meta: Joi.object()
|
|
109
|
-
.default({})
|
|
110
|
-
.description('Key=>Value information from the build itself'),
|
|
80
|
+
meta: Joi.object().default({}).description('Key=>Value information from the build itself'),
|
|
111
81
|
|
|
112
82
|
status: Joi.string()
|
|
113
83
|
.valid(...STATUSES)
|
|
@@ -120,25 +90,15 @@ const MODEL = {
|
|
|
120
90
|
|
|
121
91
|
stats: Joi.object()
|
|
122
92
|
.keys({
|
|
123
|
-
queueEnterTime: Joi.string()
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
blockedStartTime: Joi.string()
|
|
127
|
-
.isoDate()
|
|
128
|
-
.description('When this build is blocked'),
|
|
129
|
-
imagePullStartTime: Joi.string()
|
|
130
|
-
.isoDate()
|
|
131
|
-
.description('When this build starts pulling image'),
|
|
93
|
+
queueEnterTime: Joi.string().isoDate().description('When this build enters queue'),
|
|
94
|
+
blockedStartTime: Joi.string().isoDate().description('When this build is blocked'),
|
|
95
|
+
imagePullStartTime: Joi.string().isoDate().description('When this build starts pulling image'),
|
|
132
96
|
hostname: Joi.string().description('Where this build is run')
|
|
133
97
|
})
|
|
134
98
|
.unknown(true) // allow other fields
|
|
135
99
|
.description('Stats for this build'),
|
|
136
100
|
|
|
137
|
-
templateId: Joi.number()
|
|
138
|
-
.integer()
|
|
139
|
-
.positive()
|
|
140
|
-
.description("Identifier for this job's template")
|
|
141
|
-
.example(123345),
|
|
101
|
+
templateId: Joi.number().integer().positive().description("Identifier for this job's template").example(123345),
|
|
142
102
|
|
|
143
103
|
buildClusterName
|
|
144
104
|
};
|
|
@@ -150,9 +110,7 @@ const parentBuildIdSchema = Joi.alternatives()
|
|
|
150
110
|
|
|
151
111
|
const environmentSchema = Joi.alternatives().try(Joi.array().items(Job.environment), Job.environment);
|
|
152
112
|
|
|
153
|
-
const stepsSchema = Joi.array()
|
|
154
|
-
.items(Step.get)
|
|
155
|
-
.description('List of steps');
|
|
113
|
+
const stepsSchema = Joi.array().items(Step.get).description('List of steps');
|
|
156
114
|
|
|
157
115
|
const GET_MODEL = { ...MODEL, parentBuildId: parentBuildIdSchema, environment: environmentSchema, steps: stepsSchema };
|
|
158
116
|
|
package/models/buildCluster.js
CHANGED
|
@@ -5,17 +5,10 @@ const mutate = require('../lib/mutate');
|
|
|
5
5
|
const Command = require('../config/command');
|
|
6
6
|
const pipelineBaseSchema = require('./pipeline').base;
|
|
7
7
|
const scmContext = pipelineBaseSchema.extract('scmContext');
|
|
8
|
-
const scmOrganization = Joi.string()
|
|
9
|
-
.max(100)
|
|
10
|
-
.description('SCM organization name')
|
|
11
|
-
.example('screwdriver-cd');
|
|
8
|
+
const scmOrganization = Joi.string().max(100).description('SCM organization name').example('screwdriver-cd');
|
|
12
9
|
|
|
13
10
|
const MODEL = {
|
|
14
|
-
id: Joi.number()
|
|
15
|
-
.integer()
|
|
16
|
-
.positive()
|
|
17
|
-
.description('Identifier of this Job')
|
|
18
|
-
.example(123345),
|
|
11
|
+
id: Joi.number().integer().positive().description('Identifier of this Job').example(123345),
|
|
19
12
|
|
|
20
13
|
name: Joi.string()
|
|
21
14
|
.regex(/^[\w-]+$/)
|
|
@@ -32,21 +25,13 @@ const MODEL = {
|
|
|
32
25
|
|
|
33
26
|
scmOrganizations: Joi.array().items(scmOrganization),
|
|
34
27
|
|
|
35
|
-
isActive: Joi.boolean()
|
|
36
|
-
.description('Flag if the the build cluster is active')
|
|
37
|
-
.example(true),
|
|
28
|
+
isActive: Joi.boolean().description('Flag if the the build cluster is active').example(true),
|
|
38
29
|
|
|
39
|
-
managedByScrewdriver: Joi.boolean()
|
|
40
|
-
.description('Flag if the cluster is managed by screwdriver team')
|
|
41
|
-
.example(true),
|
|
30
|
+
managedByScrewdriver: Joi.boolean().description('Flag if the cluster is managed by screwdriver team').example(true),
|
|
42
31
|
|
|
43
32
|
maintainer: Command.maintainer,
|
|
44
33
|
|
|
45
|
-
weightage: Joi.number()
|
|
46
|
-
.min(0)
|
|
47
|
-
.max(100)
|
|
48
|
-
.description('Weight percentage for build cluster')
|
|
49
|
-
.example(20)
|
|
34
|
+
weightage: Joi.number().min(0).max(100).description('Weight percentage for build cluster').example(20)
|
|
50
35
|
};
|
|
51
36
|
|
|
52
37
|
module.exports = {
|
package/models/collection.js
CHANGED
|
@@ -6,34 +6,20 @@ const mutate = require('../lib/mutate');
|
|
|
6
6
|
const BUILD_MODEL = require('./build').get;
|
|
7
7
|
const PIPELINE_MODEL = require('./pipeline').get;
|
|
8
8
|
const PRS = {
|
|
9
|
-
open: Joi.number()
|
|
10
|
-
|
|
11
|
-
.min(0),
|
|
12
|
-
failing: Joi.number()
|
|
13
|
-
.integer()
|
|
14
|
-
.min(0)
|
|
9
|
+
open: Joi.number().integer().min(0),
|
|
10
|
+
failing: Joi.number().integer().min(0)
|
|
15
11
|
};
|
|
16
12
|
const PIPELINE_OBJECT = PIPELINE_MODEL.keys({
|
|
17
|
-
lastBuilds: Joi.array()
|
|
18
|
-
.items(BUILD_MODEL)
|
|
19
|
-
.optional(),
|
|
13
|
+
lastBuilds: Joi.array().items(BUILD_MODEL).optional(),
|
|
20
14
|
prs: Joi.object(PRS).optional()
|
|
21
15
|
});
|
|
22
16
|
const PIPELINES_MODEL = Joi.array().items(PIPELINE_OBJECT);
|
|
23
17
|
const MODEL = {
|
|
24
|
-
id: Joi.number()
|
|
25
|
-
.integer()
|
|
26
|
-
.positive(),
|
|
18
|
+
id: Joi.number().integer().positive(),
|
|
27
19
|
|
|
28
|
-
userId: Joi.number()
|
|
29
|
-
.integer()
|
|
30
|
-
.positive()
|
|
31
|
-
.description('User ID'),
|
|
20
|
+
userId: Joi.number().integer().positive().description('User ID'),
|
|
32
21
|
|
|
33
|
-
name: Joi.string()
|
|
34
|
-
.max(128)
|
|
35
|
-
.description('Collection name')
|
|
36
|
-
.example('Favorites'),
|
|
22
|
+
name: Joi.string().max(128).description('Collection name').example('Favorites'),
|
|
37
23
|
|
|
38
24
|
description: Joi.string()
|
|
39
25
|
.max(256)
|
|
@@ -41,26 +27,14 @@ const MODEL = {
|
|
|
41
27
|
.description('Collection description')
|
|
42
28
|
.example('List of my favorite pipelines'),
|
|
43
29
|
|
|
44
|
-
pipelineIds: Joi.array().items(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.positive()
|
|
48
|
-
),
|
|
49
|
-
|
|
50
|
-
type: Joi.string()
|
|
51
|
-
.max(32)
|
|
52
|
-
.valid('', 'default', 'normal')
|
|
53
|
-
.description('Collection type')
|
|
54
|
-
.example('default')
|
|
30
|
+
pipelineIds: Joi.array().items(Joi.number().integer().positive()),
|
|
31
|
+
|
|
32
|
+
type: Joi.string().max(32).valid('', 'default', 'normal').description('Collection type').example('default')
|
|
55
33
|
};
|
|
56
34
|
const GET_MODEL = {
|
|
57
35
|
...MODEL,
|
|
58
36
|
pipelines: PIPELINES_MODEL,
|
|
59
|
-
type: Joi.string()
|
|
60
|
-
.max(32)
|
|
61
|
-
.valid('default', 'normal', 'shared')
|
|
62
|
-
.description('Collection type')
|
|
63
|
-
.example('default')
|
|
37
|
+
type: Joi.string().max(32).valid('default', 'normal', 'shared').description('Collection type').example('default')
|
|
64
38
|
};
|
|
65
39
|
|
|
66
40
|
module.exports = {
|
package/models/command.js
CHANGED
|
@@ -6,11 +6,7 @@ const Command = require('../config/command');
|
|
|
6
6
|
const pipelineId = require('./pipeline').base.extract('id');
|
|
7
7
|
|
|
8
8
|
const MODEL = {
|
|
9
|
-
id: Joi.number()
|
|
10
|
-
.integer()
|
|
11
|
-
.positive()
|
|
12
|
-
.description('Identifier of this command')
|
|
13
|
-
.example(123345),
|
|
9
|
+
id: Joi.number().integer().positive().description('Identifier of this command').example(123345),
|
|
14
10
|
namespace: Command.namespace,
|
|
15
11
|
version: Command.version,
|
|
16
12
|
description: Command.description,
|
package/models/commandTag.js
CHANGED
|
@@ -4,11 +4,7 @@ const Joi = require('joi');
|
|
|
4
4
|
const Command = require('../config/command');
|
|
5
5
|
|
|
6
6
|
const MODEL = {
|
|
7
|
-
id: Joi.number()
|
|
8
|
-
.integer()
|
|
9
|
-
.positive()
|
|
10
|
-
.description('Identifier of this command tag')
|
|
11
|
-
.example(123345),
|
|
7
|
+
id: Joi.number().integer().positive().description('Identifier of this command tag').example(123345),
|
|
12
8
|
createTime: Joi.string()
|
|
13
9
|
.isoDate()
|
|
14
10
|
.max(32)
|
package/models/event.js
CHANGED
|
@@ -12,21 +12,13 @@ const buildId = require('./build').get.extract('id');
|
|
|
12
12
|
const prNum = Scm.hook.extract('prNum');
|
|
13
13
|
|
|
14
14
|
const MODEL = {
|
|
15
|
-
id: Joi.number()
|
|
16
|
-
.integer()
|
|
17
|
-
.positive()
|
|
18
|
-
.description('Identifier of this event')
|
|
19
|
-
.example(123345),
|
|
15
|
+
id: Joi.number().integer().positive().description('Identifier of this event').example(123345),
|
|
20
16
|
parentEventId: Joi.number()
|
|
21
17
|
.integer()
|
|
22
18
|
.positive()
|
|
23
19
|
.description('Identifier of the direct parent event')
|
|
24
20
|
.example(123344),
|
|
25
|
-
groupEventId: Joi.number()
|
|
26
|
-
.integer()
|
|
27
|
-
.positive()
|
|
28
|
-
.description('Identifier of the group parent event')
|
|
29
|
-
.example(123344),
|
|
21
|
+
groupEventId: Joi.number().integer().positive().description('Identifier of the group parent event').example(123344),
|
|
30
22
|
causeMessage: Joi.string()
|
|
31
23
|
.max(512)
|
|
32
24
|
.truncate()
|
|
@@ -40,14 +32,8 @@ const MODEL = {
|
|
|
40
32
|
.description('When this event was created')
|
|
41
33
|
.example('2038-01-19T03:14:08.131Z'),
|
|
42
34
|
creator: Scm.user.description('Creator of the event'),
|
|
43
|
-
meta: Joi.object()
|
|
44
|
-
|
|
45
|
-
.description('Key=>Value information from the event itself'),
|
|
46
|
-
pipelineId: Joi.number()
|
|
47
|
-
.integer()
|
|
48
|
-
.positive()
|
|
49
|
-
.description('Identifier of this pipeline')
|
|
50
|
-
.example(123345),
|
|
35
|
+
meta: Joi.object().default({}).description('Key=>Value information from the event itself'),
|
|
36
|
+
pipelineId: Joi.number().integer().positive().description('Identifier of this pipeline').example(123345),
|
|
51
37
|
sha: Joi.string()
|
|
52
38
|
.hex()
|
|
53
39
|
.length(40)
|
|
@@ -62,11 +48,7 @@ const MODEL = {
|
|
|
62
48
|
.try(trigger, jobName)
|
|
63
49
|
.description('Event start point - a job name or trigger name (~commit/~pr)')
|
|
64
50
|
.example('~commit'),
|
|
65
|
-
type: Joi.string()
|
|
66
|
-
.valid('pr', 'pipeline')
|
|
67
|
-
.max(10)
|
|
68
|
-
.description('Type of the event')
|
|
69
|
-
.example('pr'),
|
|
51
|
+
type: Joi.string().valid('pr', 'pipeline').max(10).description('Type of the event').example('pr'),
|
|
70
52
|
workflowGraph: WorkflowGraph.workflowGraph.description('Graph representation of the workflow').example({
|
|
71
53
|
nodes: [{ name: '~commit' }, { name: 'main' }, { name: 'publish' }],
|
|
72
54
|
edges: [
|
|
@@ -76,9 +58,7 @@ const MODEL = {
|
|
|
76
58
|
}),
|
|
77
59
|
pr: Scm.pr.description('Pull request object that holds information about the pull request'),
|
|
78
60
|
prNum: prNum.description('Pull request number if it is a PR event'),
|
|
79
|
-
baseBranch: Joi.string()
|
|
80
|
-
.description('build base branch')
|
|
81
|
-
.example('develop')
|
|
61
|
+
baseBranch: Joi.string().description('build base branch').example('develop')
|
|
82
62
|
};
|
|
83
63
|
|
|
84
64
|
const CREATE_MODEL = { ...MODEL, buildId, parentBuildId, parentBuilds, prNum };
|
package/models/job.js
CHANGED
|
@@ -6,11 +6,7 @@ const validator = require('../api/validator');
|
|
|
6
6
|
const SCM_PR_SCHEMA = require('../core/scm').pr;
|
|
7
7
|
|
|
8
8
|
const MODEL = {
|
|
9
|
-
id: Joi.number()
|
|
10
|
-
.integer()
|
|
11
|
-
.positive()
|
|
12
|
-
.description('Identifier of this Job')
|
|
13
|
-
.example(123345),
|
|
9
|
+
id: Joi.number().integer().positive().description('Identifier of this Job').example(123345),
|
|
14
10
|
|
|
15
11
|
name: Joi.string()
|
|
16
12
|
.regex(/^(PR-[0-9]+:)?[\w-]+$/)
|
|
@@ -26,16 +22,9 @@ const MODEL = {
|
|
|
26
22
|
|
|
27
23
|
permutations: validator.jobPermutations,
|
|
28
24
|
|
|
29
|
-
description: Joi.string()
|
|
30
|
-
.max(100)
|
|
31
|
-
.description('Description of the Job')
|
|
32
|
-
.example('builds and tests the code'),
|
|
25
|
+
description: Joi.string().max(100).description('Description of the Job').example('builds and tests the code'),
|
|
33
26
|
|
|
34
|
-
pipelineId: Joi.number()
|
|
35
|
-
.integer()
|
|
36
|
-
.positive()
|
|
37
|
-
.description('Identifier of this Pipeline')
|
|
38
|
-
.example(123345),
|
|
27
|
+
pipelineId: Joi.number().integer().positive().description('Identifier of this Pipeline').example(123345),
|
|
39
28
|
|
|
40
29
|
state: Joi.string()
|
|
41
30
|
.valid('ENABLED', 'DISABLED')
|
|
@@ -44,29 +33,18 @@ const MODEL = {
|
|
|
44
33
|
.example('ENABLED')
|
|
45
34
|
.default('ENABLED'),
|
|
46
35
|
|
|
47
|
-
stateChanger: Joi.string()
|
|
48
|
-
.max(128)
|
|
49
|
-
.description('Username for who changed the state'),
|
|
36
|
+
stateChanger: Joi.string().max(128).description('Username for who changed the state'),
|
|
50
37
|
|
|
51
|
-
stateChangeTime: Joi.string()
|
|
52
|
-
.isoDate()
|
|
53
|
-
.description('When the state of the job was changed'),
|
|
38
|
+
stateChangeTime: Joi.string().isoDate().description('When the state of the job was changed'),
|
|
54
39
|
|
|
55
40
|
stateChangeMessage: Joi.string()
|
|
56
41
|
.max(512)
|
|
57
42
|
.description('Reason why disabling or enabling job')
|
|
58
43
|
.example('Testing out new feature change in beta only'),
|
|
59
44
|
|
|
60
|
-
archived: Joi.boolean()
|
|
61
|
-
.description('Flag if the job is archived')
|
|
62
|
-
.example(true)
|
|
63
|
-
.default(false),
|
|
45
|
+
archived: Joi.boolean().description('Flag if the job is archived').example(true).default(false),
|
|
64
46
|
|
|
65
|
-
templateId: Joi.number()
|
|
66
|
-
.integer()
|
|
67
|
-
.positive()
|
|
68
|
-
.description("Identifier for this job's template")
|
|
69
|
-
.example(123345)
|
|
47
|
+
templateId: Joi.number().integer().positive().description("Identifier for this job's template").example(123345)
|
|
70
48
|
};
|
|
71
49
|
|
|
72
50
|
const EXTENDED_MODEL = {
|