screwdriver-data-schema 21.28.3 → 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 -32
- 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/api/commandValidator.js
CHANGED
|
@@ -5,16 +5,12 @@ const Joi = require('joi');
|
|
|
5
5
|
// essentially a Joi.ValidationError.details object
|
|
6
6
|
const COMMAND_ERROR = Joi.object().keys({
|
|
7
7
|
context: Joi.object().label('Functional context regarding the error'),
|
|
8
|
-
message: Joi.string()
|
|
9
|
-
.label('Description of a particular validation error')
|
|
10
|
-
.required(),
|
|
8
|
+
message: Joi.string().label('Description of a particular validation error').required(),
|
|
11
9
|
path: Joi.array()
|
|
12
10
|
.items(Joi.string())
|
|
13
11
|
.label('Dot-notation path to the field that caused the validation error')
|
|
14
12
|
.required(),
|
|
15
|
-
type: Joi.string()
|
|
16
|
-
.label('The the Joi-type that categorizes the error')
|
|
17
|
-
.required()
|
|
13
|
+
type: Joi.string().label('The the Joi-type that categorizes the error').required()
|
|
18
14
|
});
|
|
19
15
|
|
|
20
16
|
const SCHEMA_OUTPUT = Joi.object()
|
|
@@ -24,16 +20,12 @@ const SCHEMA_OUTPUT = Joi.object()
|
|
|
24
20
|
.label('Array of errors encountered while validating the given command')
|
|
25
21
|
.required(),
|
|
26
22
|
// since a command could be parseable but invalid, the contents are unpredicatble
|
|
27
|
-
command: Joi.object()
|
|
28
|
-
.label('The end-result of parsing the given command')
|
|
29
|
-
.required()
|
|
23
|
+
command: Joi.object().label('The end-result of parsing the given command').required()
|
|
30
24
|
})
|
|
31
25
|
.label('Command validation output');
|
|
32
26
|
|
|
33
27
|
const SCHEMA_INPUT = Joi.object({
|
|
34
|
-
yaml: Joi.string()
|
|
35
|
-
.required()
|
|
36
|
-
.label('sd-command.yaml contents')
|
|
28
|
+
yaml: Joi.string().required().label('sd-command.yaml contents')
|
|
37
29
|
}).label('Certify input to command validator');
|
|
38
30
|
|
|
39
31
|
/**
|
package/api/loglines.js
CHANGED
|
@@ -12,16 +12,8 @@ const SCHEMA_PARAMS = Joi.object()
|
|
|
12
12
|
|
|
13
13
|
const SCHEMA_QUERY = Joi.object()
|
|
14
14
|
.keys({
|
|
15
|
-
from: Joi.number()
|
|
16
|
-
|
|
17
|
-
.min(0)
|
|
18
|
-
.default(0)
|
|
19
|
-
.description('Starting line Number'),
|
|
20
|
-
pages: Joi.number()
|
|
21
|
-
.integer()
|
|
22
|
-
.min(1)
|
|
23
|
-
.default(10)
|
|
24
|
-
.description('Max pages sent per request'),
|
|
15
|
+
from: Joi.number().integer().min(0).default(0).description('Starting line Number'),
|
|
16
|
+
pages: Joi.number().integer().min(1).default(10).description('Max pages sent per request'),
|
|
25
17
|
sort: Joi.string()
|
|
26
18
|
.lowercase()
|
|
27
19
|
.valid('ascending', 'descending')
|
|
@@ -36,20 +28,10 @@ const SCHEMA_QUERY = Joi.object()
|
|
|
36
28
|
|
|
37
29
|
const SCHEMA_LOGLINE = Joi.object()
|
|
38
30
|
.keys({
|
|
39
|
-
n: Joi.number()
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
t: Joi.number()
|
|
44
|
-
.positive()
|
|
45
|
-
.description('Unix timestamp of the log line')
|
|
46
|
-
.example(1472084645.33),
|
|
47
|
-
m: Joi.string()
|
|
48
|
-
.allow('')
|
|
49
|
-
.description('Line Message'),
|
|
50
|
-
s: Joi.string()
|
|
51
|
-
.min(1)
|
|
52
|
-
.description('Step Name')
|
|
31
|
+
n: Joi.number().integer().description('Numbered line number since the start of the step').example(15),
|
|
32
|
+
t: Joi.number().positive().description('Unix timestamp of the log line').example(1472084645.33),
|
|
33
|
+
m: Joi.string().allow('').description('Line Message'),
|
|
34
|
+
s: Joi.string().min(1).description('Step Name')
|
|
53
35
|
})
|
|
54
36
|
.label('Log Line');
|
|
55
37
|
|
package/api/pagination.js
CHANGED
|
@@ -3,30 +3,15 @@
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
4
|
|
|
5
5
|
const MODEL = {
|
|
6
|
-
page: Joi.number()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.description('Count to paginate'),
|
|
16
|
-
|
|
17
|
-
search: Joi.string()
|
|
18
|
-
.max(200)
|
|
19
|
-
.description('Keyword to search by'),
|
|
20
|
-
|
|
21
|
-
sort: Joi.string()
|
|
22
|
-
.lowercase()
|
|
23
|
-
.valid('ascending', 'descending')
|
|
24
|
-
.default('descending')
|
|
25
|
-
.description('Sorting option'),
|
|
26
|
-
|
|
27
|
-
sortBy: Joi.string()
|
|
28
|
-
.max(100)
|
|
29
|
-
.description('Field to sort by'),
|
|
6
|
+
page: Joi.number().integer().min(1).description('Page to paginate'),
|
|
7
|
+
|
|
8
|
+
count: Joi.number().integer().min(1).max(50).description('Count to paginate'),
|
|
9
|
+
|
|
10
|
+
search: Joi.string().max(200).description('Keyword to search by'),
|
|
11
|
+
|
|
12
|
+
sort: Joi.string().lowercase().valid('ascending', 'descending').default('descending').description('Sorting option'),
|
|
13
|
+
|
|
14
|
+
sortBy: Joi.string().max(100).description('Field to sort by'),
|
|
30
15
|
|
|
31
16
|
getCount: Joi.boolean().description('Return total count')
|
|
32
17
|
};
|
package/api/stats.js
CHANGED
|
@@ -4,29 +4,12 @@ const Joi = require('joi');
|
|
|
4
4
|
|
|
5
5
|
const SCHEMA_REQUESTS = Joi.object()
|
|
6
6
|
.keys({
|
|
7
|
-
total: Joi.number()
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.description('Number of timeouts')
|
|
14
|
-
.example(0),
|
|
15
|
-
success: Joi.number()
|
|
16
|
-
.integer()
|
|
17
|
-
.description('Number of successes')
|
|
18
|
-
.example(95),
|
|
19
|
-
failure: Joi.number()
|
|
20
|
-
.integer()
|
|
21
|
-
.description('Number of failures')
|
|
22
|
-
.example('5'),
|
|
23
|
-
concurrent: Joi.number()
|
|
24
|
-
.integer()
|
|
25
|
-
.description('Number of concurrent requests')
|
|
26
|
-
.example(0),
|
|
27
|
-
averageTime: Joi.number()
|
|
28
|
-
.label('Average time per request')
|
|
29
|
-
.example(5.3134)
|
|
7
|
+
total: Joi.number().integer().description('Total number of requests').example(100),
|
|
8
|
+
timeouts: Joi.number().integer().description('Number of timeouts').example(0),
|
|
9
|
+
success: Joi.number().integer().description('Number of successes').example(95),
|
|
10
|
+
failure: Joi.number().integer().description('Number of failures').example('5'),
|
|
11
|
+
concurrent: Joi.number().integer().description('Number of concurrent requests').example(0),
|
|
12
|
+
averageTime: Joi.number().label('Average time per request').example(5.3134)
|
|
30
13
|
})
|
|
31
14
|
.label('Requests Object');
|
|
32
15
|
|
package/api/templateValidator.js
CHANGED
|
@@ -5,16 +5,12 @@ const Joi = require('joi');
|
|
|
5
5
|
// essentially a Joi.ValidationError.details object
|
|
6
6
|
const TEMPLATE_ERROR = Joi.object().keys({
|
|
7
7
|
context: Joi.object().label('Functional context regarding the error'),
|
|
8
|
-
message: Joi.string()
|
|
9
|
-
.label('Description of a particular validation error')
|
|
10
|
-
.required(),
|
|
8
|
+
message: Joi.string().label('Description of a particular validation error').required(),
|
|
11
9
|
path: Joi.array()
|
|
12
10
|
.items(Joi.string(), Joi.number().integer())
|
|
13
11
|
.label('Array of path to the field that caused the validation error')
|
|
14
12
|
.required(),
|
|
15
|
-
type: Joi.string()
|
|
16
|
-
.label('The the Joi-type that categorizes the error')
|
|
17
|
-
.required()
|
|
13
|
+
type: Joi.string().label('The the Joi-type that categorizes the error').required()
|
|
18
14
|
});
|
|
19
15
|
|
|
20
16
|
const SCHEMA_OUTPUT = Joi.object()
|
|
@@ -24,17 +20,13 @@ const SCHEMA_OUTPUT = Joi.object()
|
|
|
24
20
|
.label('Array of errors encountered while validating the given template')
|
|
25
21
|
.required(),
|
|
26
22
|
// since a template could be parseable but invalid, the contents are unpredictable
|
|
27
|
-
template: Joi.object()
|
|
28
|
-
.label('The end-result of parsing the given template')
|
|
29
|
-
.required(),
|
|
23
|
+
template: Joi.object().label('The end-result of parsing the given template').required(),
|
|
30
24
|
warnMessages: Joi.array().optional()
|
|
31
25
|
})
|
|
32
26
|
.label('Template validation output');
|
|
33
27
|
|
|
34
28
|
const SCHEMA_INPUT = Joi.object({
|
|
35
|
-
yaml: Joi.string()
|
|
36
|
-
.required()
|
|
37
|
-
.label('sd-template.yaml contents')
|
|
29
|
+
yaml: Joi.string().required().label('sd-template.yaml contents')
|
|
38
30
|
}).label('Certify input to template validator');
|
|
39
31
|
|
|
40
32
|
/**
|
package/api/validator.js
CHANGED
|
@@ -17,10 +17,7 @@ const SCHEMA_JOB_COMMAND = Joi.object()
|
|
|
17
17
|
.unknown(false)
|
|
18
18
|
.label('Named command to execute');
|
|
19
19
|
|
|
20
|
-
const SCHEMA_JOB_COMMANDS = Joi.array()
|
|
21
|
-
.items(SCHEMA_JOB_COMMAND)
|
|
22
|
-
.min(1)
|
|
23
|
-
.label('List of named commands to execute');
|
|
20
|
+
const SCHEMA_JOB_COMMANDS = Joi.array().items(SCHEMA_JOB_COMMAND).min(1).label('List of named commands to execute');
|
|
24
21
|
|
|
25
22
|
const SCHEMA_JOB_PERMUTATION = Joi.object()
|
|
26
23
|
.keys({
|
|
@@ -45,9 +42,7 @@ const SCHEMA_JOB_PERMUTATION = Joi.object()
|
|
|
45
42
|
})
|
|
46
43
|
.label('Job permutation');
|
|
47
44
|
|
|
48
|
-
const SCHEMA_JOB_PERMUTATIONS = Joi.array()
|
|
49
|
-
.items(SCHEMA_JOB_PERMUTATION)
|
|
50
|
-
.label('List of job permutations');
|
|
45
|
+
const SCHEMA_JOB_PERMUTATIONS = Joi.array().items(SCHEMA_JOB_PERMUTATION).label('List of job permutations');
|
|
51
46
|
|
|
52
47
|
const SCHEMA_JOBS = Joi.object()
|
|
53
48
|
// Jobs can only be named with A-Z,a-z,0-9,-,_
|
|
@@ -59,9 +54,7 @@ const SCHEMA_JOBS = Joi.object()
|
|
|
59
54
|
const SCHEMA_OUTPUT = Joi.object()
|
|
60
55
|
.keys({
|
|
61
56
|
annotations: Annotations.annotations,
|
|
62
|
-
errors: Joi.array()
|
|
63
|
-
.items(Joi.string())
|
|
64
|
-
.optional(),
|
|
57
|
+
errors: Joi.array().items(Joi.string()).optional(),
|
|
65
58
|
jobs: SCHEMA_JOBS,
|
|
66
59
|
childPipelines: Base.childPipelines,
|
|
67
60
|
workflowGraph: WorkflowGraph.workflowGraph,
|
package/config/base.js
CHANGED
|
@@ -10,9 +10,7 @@ const SCHEMA_CACHE_VALUE = Joi.string().uri({
|
|
|
10
10
|
relativeOnly: true
|
|
11
11
|
});
|
|
12
12
|
const SCHEMA_CACHE_LIST = Joi.array().items(SCHEMA_CACHE_VALUE);
|
|
13
|
-
const SCHEMA_CACHE_JOBS = Joi.object()
|
|
14
|
-
.pattern(Job.jobName, SCHEMA_CACHE_LIST)
|
|
15
|
-
.unknown(false);
|
|
13
|
+
const SCHEMA_CACHE_JOBS = Joi.object().pattern(Job.jobName, SCHEMA_CACHE_LIST).unknown(false);
|
|
16
14
|
const SCHEMA_CACHE = Joi.object({
|
|
17
15
|
event: SCHEMA_CACHE_LIST,
|
|
18
16
|
pipeline: SCHEMA_CACHE_LIST,
|
|
@@ -32,9 +30,7 @@ const SCHEMA_JOBS = Joi.object()
|
|
|
32
30
|
.unknown(false);
|
|
33
31
|
const SCHEMA_SHARED = Job.job;
|
|
34
32
|
const SCHEMA_SCM_URL = Joi.string().regex(Regex.CHECKOUT_URL);
|
|
35
|
-
const SCHEMA_SCM_URLS = Joi.array()
|
|
36
|
-
.items(SCHEMA_SCM_URL)
|
|
37
|
-
.min(1);
|
|
33
|
+
const SCHEMA_SCM_URLS = Joi.array().items(SCHEMA_SCM_URL).min(1);
|
|
38
34
|
const SCHEMA_CHILD_PIPELINES = Joi.object()
|
|
39
35
|
.keys({
|
|
40
36
|
scmUrls: SCHEMA_SCM_URLS.required(),
|
|
@@ -45,9 +41,7 @@ const SCHEMA_CHILD_PIPELINES = Joi.object()
|
|
|
45
41
|
const SCHEMA_STAGE = Joi.object()
|
|
46
42
|
.keys({
|
|
47
43
|
description: Joi.string(),
|
|
48
|
-
jobs: Joi.array()
|
|
49
|
-
.items(Job.jobName)
|
|
50
|
-
.min(0)
|
|
44
|
+
jobs: Joi.array().items(Job.jobName).min(0)
|
|
51
45
|
})
|
|
52
46
|
.unknown(false);
|
|
53
47
|
|
|
@@ -68,10 +62,7 @@ const SCHEMA_SUBSCRIBE = Joi.object().keys({
|
|
|
68
62
|
|
|
69
63
|
const SCHEMA_CONFIG = Joi.object()
|
|
70
64
|
.keys({
|
|
71
|
-
version: Joi.number()
|
|
72
|
-
.integer()
|
|
73
|
-
.min(1)
|
|
74
|
-
.max(50),
|
|
65
|
+
version: Joi.number().integer().min(1).max(50),
|
|
75
66
|
annotations: Annotations.annotations,
|
|
76
67
|
jobs: SCHEMA_JOBS.required(),
|
|
77
68
|
shared: SCHEMA_SHARED,
|
package/config/command.js
CHANGED
|
@@ -10,11 +10,7 @@ const COMMAND_NAMESPACE = Joi.string()
|
|
|
10
10
|
.description('Namespace of the Command')
|
|
11
11
|
.example('chefdk');
|
|
12
12
|
|
|
13
|
-
const COMMAND_NAME = Joi.string()
|
|
14
|
-
.regex(Regex.COMMAND_NAME)
|
|
15
|
-
.max(64)
|
|
16
|
-
.description('Name of the Command')
|
|
17
|
-
.example('knife');
|
|
13
|
+
const COMMAND_NAME = Joi.string().regex(Regex.COMMAND_NAME).max(64).description('Name of the Command').example('knife');
|
|
18
14
|
|
|
19
15
|
const COMMAND_TAG_NAME = Joi.string()
|
|
20
16
|
.regex(Regex.COMMAND_TAG_NAME)
|
|
@@ -22,11 +18,7 @@ const COMMAND_TAG_NAME = Joi.string()
|
|
|
22
18
|
.description('Name of the Command Tag')
|
|
23
19
|
.example('latest');
|
|
24
20
|
|
|
25
|
-
const COMMAND_VERSION = Joi.string()
|
|
26
|
-
.regex(Regex.VERSION)
|
|
27
|
-
.max(16)
|
|
28
|
-
.description('Version of the Command')
|
|
29
|
-
.example('1.2');
|
|
21
|
+
const COMMAND_VERSION = Joi.string().regex(Regex.VERSION).max(16).description('Version of the Command').example('1.2');
|
|
30
22
|
|
|
31
23
|
const COMMAND_EXACT_VERSION = Joi.string()
|
|
32
24
|
.regex(Regex.EXACT_VERSION)
|
|
@@ -45,11 +37,7 @@ const COMMAND_USAGE = Joi.string()
|
|
|
45
37
|
.description('Usage and arguments of the command')
|
|
46
38
|
.example('sd_cmd exec foo/bar@1 -h <host> -d <domain>');
|
|
47
39
|
|
|
48
|
-
const COMMAND_MAINTAINER = Joi.string()
|
|
49
|
-
.email()
|
|
50
|
-
.max(64)
|
|
51
|
-
.description('Maintainer of the Command')
|
|
52
|
-
.example('foo@bar.com');
|
|
40
|
+
const COMMAND_MAINTAINER = Joi.string().email().max(64).description('Maintainer of the Command').example('foo@bar.com');
|
|
53
41
|
|
|
54
42
|
const COMMAND_FORMAT = Joi.string()
|
|
55
43
|
.valid('habitat', 'docker', 'binary')
|
package/config/commandFormat.js
CHANGED
|
@@ -2,22 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
4
|
|
|
5
|
-
const HABITAT_MODE = Joi.string()
|
|
6
|
-
.valid('remote', 'local')
|
|
7
|
-
.description('Mode of the Habitat command')
|
|
8
|
-
.example('remote');
|
|
5
|
+
const HABITAT_MODE = Joi.string().valid('remote', 'local').description('Mode of the Habitat command').example('remote');
|
|
9
6
|
|
|
10
|
-
const HABITAT_FILE = Joi.string()
|
|
11
|
-
.description('File path of the Habitat artifact')
|
|
12
|
-
.example('./foobar.hart');
|
|
7
|
+
const HABITAT_FILE = Joi.string().description('File path of the Habitat artifact').example('./foobar.hart');
|
|
13
8
|
|
|
14
|
-
const HABITAT_PACKAGE = Joi.string()
|
|
15
|
-
.description('Package of the Habitat command')
|
|
16
|
-
.example('core/git/2.14.1');
|
|
9
|
+
const HABITAT_PACKAGE = Joi.string().description('Package of the Habitat command').example('core/git/2.14.1');
|
|
17
10
|
|
|
18
|
-
const HABITAT_COMMAND = Joi.string()
|
|
19
|
-
.description('Executable of the Habitat command')
|
|
20
|
-
.example('git');
|
|
11
|
+
const HABITAT_COMMAND = Joi.string().description('Executable of the Habitat command').example('git');
|
|
21
12
|
|
|
22
13
|
const SCHEMA_HABITAT = Joi.object().keys({
|
|
23
14
|
mode: HABITAT_MODE.required(),
|
|
@@ -26,23 +17,16 @@ const SCHEMA_HABITAT = Joi.object().keys({
|
|
|
26
17
|
command: HABITAT_COMMAND.required()
|
|
27
18
|
});
|
|
28
19
|
|
|
29
|
-
const DOCKER_IMAGE = Joi.string()
|
|
30
|
-
.description('Image of the Docker command')
|
|
31
|
-
.example('chefdk:1.2.3');
|
|
20
|
+
const DOCKER_IMAGE = Joi.string().description('Image of the Docker command').example('chefdk:1.2.3');
|
|
32
21
|
|
|
33
|
-
const DOCKER_COMMAND = Joi.string()
|
|
34
|
-
.description('Executable of the Docker command')
|
|
35
|
-
.default('')
|
|
36
|
-
.example('knife');
|
|
22
|
+
const DOCKER_COMMAND = Joi.string().description('Executable of the Docker command').default('').example('knife');
|
|
37
23
|
|
|
38
24
|
const SCHEMA_DOCKER = Joi.object().keys({
|
|
39
25
|
image: DOCKER_IMAGE.required(),
|
|
40
26
|
command: DOCKER_COMMAND
|
|
41
27
|
});
|
|
42
28
|
|
|
43
|
-
const BINARY_FILE = Joi.string()
|
|
44
|
-
.description('File of the Binary command')
|
|
45
|
-
.example('./foobar.sh');
|
|
29
|
+
const BINARY_FILE = Joi.string().description('File of the Binary command').example('./foobar.sh');
|
|
46
30
|
|
|
47
31
|
const SCHEMA_BINARY = Joi.object().keys({
|
|
48
32
|
file: BINARY_FILE.required()
|
package/config/job.js
CHANGED
|
@@ -61,12 +61,8 @@ const SCHEMA_MATRIX = Joi.object()
|
|
|
61
61
|
'object.unknown': '{{#label}} only supports uppercase letters, digits, and underscore (cannot start with digit)'
|
|
62
62
|
});
|
|
63
63
|
// Secrets must be all uppercase
|
|
64
|
-
const SCHEMA_SECRET = Joi.string()
|
|
65
|
-
|
|
66
|
-
.max(64);
|
|
67
|
-
const SCHEMA_SECRETS = Joi.array()
|
|
68
|
-
.items(SCHEMA_SECRET)
|
|
69
|
-
.min(0);
|
|
64
|
+
const SCHEMA_SECRET = Joi.string().regex(Regex.ENV_NAME).max(64);
|
|
65
|
+
const SCHEMA_SECRETS = Joi.array().items(SCHEMA_SECRET).min(0);
|
|
70
66
|
const SCHEMA_ENVIRONMENT = Joi.object()
|
|
71
67
|
// IEEE Std 1003.1-2001
|
|
72
68
|
// Environment names contain uppercase letters, digits, and underscore
|
|
@@ -78,9 +74,7 @@ const SCHEMA_ENVIRONMENT = Joi.object()
|
|
|
78
74
|
.messages({
|
|
79
75
|
'object.unknown': '{{#label}} only supports uppercase letters, digits, and underscore (cannot start with digit)'
|
|
80
76
|
});
|
|
81
|
-
const SCHEMA_JOBNAME = Joi.string()
|
|
82
|
-
.max(100)
|
|
83
|
-
.regex(Regex.JOB_NAME);
|
|
77
|
+
const SCHEMA_JOBNAME = Joi.string().max(100).regex(Regex.JOB_NAME);
|
|
84
78
|
// Step can be in the following formats:
|
|
85
79
|
// npm install
|
|
86
80
|
// { init: npm install }
|
|
@@ -101,9 +95,7 @@ const SCHEMA_STEP_OBJECT = Joi.object()
|
|
|
101
95
|
// Add documentation
|
|
102
96
|
.messages({ 'object.unknown': '{{#label}} only supports the following characters A-Z,a-z,0-9,-,_' });
|
|
103
97
|
const SCHEMA_STEP = Joi.alternatives().try(SCHEMA_STEP_STRING, SCHEMA_STEP_OBJECT);
|
|
104
|
-
const SCHEMA_STEPS = Joi.array()
|
|
105
|
-
.items(SCHEMA_STEP)
|
|
106
|
-
.min(1);
|
|
98
|
+
const SCHEMA_STEPS = Joi.array().items(SCHEMA_STEP).min(1);
|
|
107
99
|
// Template steps
|
|
108
100
|
const SCHEMA_TEMPLATE_STEP_SUBOBJECT = SCHEMA_STEP_SUBOBJECT_BASE.keys({
|
|
109
101
|
locked: Joi.boolean()
|
|
@@ -118,9 +110,7 @@ const SCHEMA_TEMPLATE_STEP_OBJECT = Joi.object()
|
|
|
118
110
|
// And there can be only one command per step
|
|
119
111
|
.length(1);
|
|
120
112
|
const SCHEMA_TEMPLATE_STEP = Joi.alternatives().try(SCHEMA_STEP_STRING, SCHEMA_TEMPLATE_STEP_OBJECT);
|
|
121
|
-
const SCHEMA_TEMPLATE_STEPS = Joi.array()
|
|
122
|
-
.items(SCHEMA_TEMPLATE_STEP)
|
|
123
|
-
.min(1);
|
|
113
|
+
const SCHEMA_TEMPLATE_STEPS = Joi.array().items(SCHEMA_TEMPLATE_STEP).min(1);
|
|
124
114
|
const SCHEMA_STEPS_NO_DUPS = Joi.array()
|
|
125
115
|
.items(SCHEMA_TEMPLATE_STEP)
|
|
126
116
|
.min(1)
|
|
@@ -131,13 +121,9 @@ const SCHEMA_STEPS_NO_DUPS = Joi.array()
|
|
|
131
121
|
|
|
132
122
|
return Object.keys(a).some(key => b[key]);
|
|
133
123
|
});
|
|
134
|
-
const SCHEMA_DESCRIPTION = Joi.string()
|
|
135
|
-
.max(100)
|
|
136
|
-
.optional();
|
|
124
|
+
const SCHEMA_DESCRIPTION = Joi.string().max(100).optional();
|
|
137
125
|
const SCHEMA_IMAGE = Joi.string().regex(Regex.IMAGE_NAME);
|
|
138
|
-
const SCHEMA_ORDER = Joi.array()
|
|
139
|
-
.items(SCHEMA_STEP_STRING.regex(Regex.STEP_NAME))
|
|
140
|
-
.min(0);
|
|
126
|
+
const SCHEMA_ORDER = Joi.array().items(SCHEMA_STEP_STRING.regex(Regex.STEP_NAME)).min(0);
|
|
141
127
|
const SCHEMA_SETTINGS = Joi.object().optional();
|
|
142
128
|
|
|
143
129
|
const SCHEMA_TEMPLATE = Joi.string().regex(Regex.FULL_TEMPLATE_NAME);
|
|
@@ -151,9 +137,7 @@ const SCHEMA_TEMPLATEID = Joi.number()
|
|
|
151
137
|
// ~commit, ~commit:staging, ~commit:/^user-.*$/, ~pr, etc.
|
|
152
138
|
const SCHEMA_TRIGGER = sdJoi.string().branchFilter();
|
|
153
139
|
const SCHEMA_INTERNAL_TRIGGER = Joi.string().regex(Regex.INTERNAL_TRIGGER); // ~main, ~jobOne
|
|
154
|
-
const SCHEMA_EXTERNAL_TRIGGER = Joi.string()
|
|
155
|
-
.regex(Regex.EXTERNAL_TRIGGER_ALL)
|
|
156
|
-
.example('~sd@1234:component'); // ~sd@123:main or sd@123:main
|
|
140
|
+
const SCHEMA_EXTERNAL_TRIGGER = Joi.string().regex(Regex.EXTERNAL_TRIGGER_ALL).example('~sd@1234:component'); // ~sd@123:main or sd@123:main
|
|
157
141
|
const SCHEMA_CRON_EXPRESSION = sdCron.string().cron();
|
|
158
142
|
const SCHEMA_REQUIRES_VALUE = Joi.alternatives().try(SCHEMA_INTERNAL_TRIGGER, SCHEMA_JOBNAME, SCHEMA_TRIGGER);
|
|
159
143
|
const SCHEMA_REQUIRES = Joi.alternatives().try(Joi.array().items(SCHEMA_REQUIRES_VALUE), SCHEMA_REQUIRES_VALUE);
|
|
@@ -163,15 +147,11 @@ const SCHEMA_BLOCKEDBY_VALUE = Joi.alternatives().try(
|
|
|
163
147
|
);
|
|
164
148
|
const SCHEMA_BLOCKEDBY = Joi.alternatives().try(Joi.array().items(SCHEMA_BLOCKEDBY_VALUE), SCHEMA_BLOCKEDBY_VALUE);
|
|
165
149
|
const SCHEMA_FREEZEWINDOWS = Joi.alternatives().try(Joi.array().items(SCHEMA_CRON_EXPRESSION), SCHEMA_CRON_EXPRESSION);
|
|
166
|
-
const SCHEMA_SOURCEPATH = Joi.string()
|
|
167
|
-
.max(1024)
|
|
168
|
-
.optional();
|
|
150
|
+
const SCHEMA_SOURCEPATH = Joi.string().max(1024).optional();
|
|
169
151
|
const SCHEMA_SOURCEPATHS = Joi.alternatives().try(Joi.array().items(SCHEMA_SOURCEPATH), SCHEMA_SOURCEPATH);
|
|
170
152
|
const SCHEMA_CACHE = Joi.boolean().optional();
|
|
171
153
|
const SCHEMA_PARAMETERS = Parameters.parameters.optional();
|
|
172
|
-
const SCHEMA_PROVIDER = Joi.alternatives()
|
|
173
|
-
.try(Provider.provider, Joi.string().regex(Regex.CHECKOUT_URL))
|
|
174
|
-
.optional();
|
|
154
|
+
const SCHEMA_PROVIDER = Joi.alternatives().try(Provider.provider, Joi.string().regex(Regex.CHECKOUT_URL)).optional();
|
|
175
155
|
const SCHEMA_JOB = Joi.object()
|
|
176
156
|
.keys({
|
|
177
157
|
annotations: Annotations.annotations,
|
package/config/parameters.js
CHANGED
|
@@ -4,9 +4,7 @@ const Joi = require('joi');
|
|
|
4
4
|
|
|
5
5
|
const SCHEMA_PARAMETERS_STRING = Joi.string();
|
|
6
6
|
const SCHEMA_PARAMETERS_OBJECT = Joi.object({
|
|
7
|
-
value: Joi.alternatives()
|
|
8
|
-
.try(Joi.string(), Joi.array().items(Joi.string()))
|
|
9
|
-
.required(),
|
|
7
|
+
value: Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.string())).required(),
|
|
10
8
|
description: Joi.string()
|
|
11
9
|
}).messages({
|
|
12
10
|
'object.unknown': 'only supports string or key: {{#label}} pair as values'
|
package/config/provider.js
CHANGED
|
@@ -4,30 +4,17 @@ const Joi = require('joi');
|
|
|
4
4
|
const Regex = require('./regex');
|
|
5
5
|
|
|
6
6
|
const SCHEMA_VPC_OBJECT = Joi.object({
|
|
7
|
-
vpcId: Joi.string()
|
|
8
|
-
.regex(Regex.VPC_ID)
|
|
9
|
-
.max(128)
|
|
10
|
-
.description('VPC ID')
|
|
11
|
-
.example('vpc-1a2b3c4d')
|
|
12
|
-
.required(),
|
|
7
|
+
vpcId: Joi.string().regex(Regex.VPC_ID).max(128).description('VPC ID').example('vpc-1a2b3c4d').required(),
|
|
13
8
|
securityGroupIds: Joi.array()
|
|
14
9
|
.items(
|
|
15
|
-
Joi.string()
|
|
16
|
-
.regex(Regex.SECURITY_GROUP_ID)
|
|
17
|
-
.max(128)
|
|
18
|
-
.description('Security group ID')
|
|
19
|
-
.example('sg-51530134')
|
|
10
|
+
Joi.string().regex(Regex.SECURITY_GROUP_ID).max(128).description('Security group ID').example('sg-51530134')
|
|
20
11
|
)
|
|
21
12
|
.min(1)
|
|
22
13
|
.label('List of security group IDs')
|
|
23
14
|
.required(),
|
|
24
15
|
subnetIds: Joi.array()
|
|
25
16
|
.items(
|
|
26
|
-
Joi.string()
|
|
27
|
-
.regex(Regex.SUBNET_ID)
|
|
28
|
-
.max(128)
|
|
29
|
-
.description('Subnet ID')
|
|
30
|
-
.example('subnet-01234567890abcdef')
|
|
17
|
+
Joi.string().regex(Regex.SUBNET_ID).max(128).description('Subnet ID').example('subnet-01234567890abcdef')
|
|
31
18
|
)
|
|
32
19
|
.min(1)
|
|
33
20
|
.label('List of subnet IDs')
|
|
@@ -35,11 +22,7 @@ const SCHEMA_VPC_OBJECT = Joi.object({
|
|
|
35
22
|
});
|
|
36
23
|
|
|
37
24
|
const SCHEMA_PROVIDER = Joi.object().keys({
|
|
38
|
-
name: Joi.string()
|
|
39
|
-
.valid('aws')
|
|
40
|
-
.max(64)
|
|
41
|
-
.description('Provider name')
|
|
42
|
-
.example('aws'),
|
|
25
|
+
name: Joi.string().valid('aws').max(64).description('Provider name').example('aws'),
|
|
43
26
|
region: Joi.string()
|
|
44
27
|
.regex(Regex.REGION)
|
|
45
28
|
.max(64)
|
|
@@ -55,14 +38,7 @@ const SCHEMA_PROVIDER = Joi.object().keys({
|
|
|
55
38
|
.allow('')
|
|
56
39
|
.optional(),
|
|
57
40
|
accountId: Joi.alternatives()
|
|
58
|
-
.try(
|
|
59
|
-
Joi.string()
|
|
60
|
-
.regex(Regex.ACCOUNT_ID)
|
|
61
|
-
.max(12),
|
|
62
|
-
Joi.number()
|
|
63
|
-
.integer()
|
|
64
|
-
.min(12)
|
|
65
|
-
)
|
|
41
|
+
.try(Joi.string().regex(Regex.ACCOUNT_ID).max(12), Joi.number().integer().min(12))
|
|
66
42
|
.description('Account ID')
|
|
67
43
|
.example('123456789012'),
|
|
68
44
|
vpc: SCHEMA_VPC_OBJECT.optional(),
|
|
@@ -71,37 +47,16 @@ const SCHEMA_PROVIDER = Joi.object().keys({
|
|
|
71
47
|
.max(512)
|
|
72
48
|
.description('Role ARN')
|
|
73
49
|
.example('arn:aws:iam::123456789012:role/aws-service-role/amazonaws.com/AWSServiceRole'),
|
|
74
|
-
executor: Joi.string()
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
clusterName: Joi.string()
|
|
80
|
-
.max(128)
|
|
81
|
-
.description('Cluster name required if executor is eks')
|
|
82
|
-
.example('sd-build-eks'),
|
|
83
|
-
cpuLimit: Joi.string()
|
|
84
|
-
.max(4)
|
|
85
|
-
.description('CPU Limit for pod in EKS Cluster')
|
|
86
|
-
.example('2Gi'),
|
|
87
|
-
memoryLimit: Joi.string()
|
|
88
|
-
.max(4)
|
|
89
|
-
.description('Memory Limit for pod in EKS Cluster')
|
|
90
|
-
.example('4Gi'),
|
|
91
|
-
executorLogs: Joi.boolean()
|
|
92
|
-
.optional()
|
|
93
|
-
.default(false)
|
|
94
|
-
.description('Enable debug logs for executor codebuild'),
|
|
50
|
+
executor: Joi.string().valid('sls', 'eks').max(64).description('Executor name').example('eks'),
|
|
51
|
+
clusterName: Joi.string().max(128).description('Cluster name required if executor is eks').example('sd-build-eks'),
|
|
52
|
+
cpuLimit: Joi.string().max(4).description('CPU Limit for pod in EKS Cluster').example('2Gi'),
|
|
53
|
+
memoryLimit: Joi.string().max(4).description('Memory Limit for pod in EKS Cluster').example('4Gi'),
|
|
54
|
+
executorLogs: Joi.boolean().optional().default(false).description('Enable debug logs for executor codebuild'),
|
|
95
55
|
launcherImage: Joi.string()
|
|
96
56
|
.description('Screwdriver launcher image in user Registry')
|
|
97
57
|
.example('123456789012.dkr.ecr.us-east-2.amazonaws.com/screwdriver-hub:launcherv6.4'),
|
|
98
|
-
launcherVersion: Joi.string()
|
|
99
|
-
|
|
100
|
-
.example('v6.4'),
|
|
101
|
-
privilegedMode: Joi.boolean()
|
|
102
|
-
.optional()
|
|
103
|
-
.default(false)
|
|
104
|
-
.description('Enable privileged mode for container'),
|
|
58
|
+
launcherVersion: Joi.string().description('Screwdriver launcher version').example('v6.4'),
|
|
59
|
+
privilegedMode: Joi.boolean().optional().default(false).description('Enable privileged mode for container'),
|
|
105
60
|
computeType: Joi.string()
|
|
106
61
|
.valid(
|
|
107
62
|
'BUILD_GENERAL1_SMALL',
|
|
@@ -121,10 +76,7 @@ const SCHEMA_PROVIDER = Joi.object().keys({
|
|
|
121
76
|
.valid('ARM_CONTAINER', 'LINUX_CONTAINER', 'LINUX_GPU_CONTAINER')
|
|
122
77
|
.default('LINUX_CONTAINER')
|
|
123
78
|
.description('CodeBuild environment type'),
|
|
124
|
-
debugSession: Joi.boolean()
|
|
125
|
-
.optional()
|
|
126
|
-
.default(false)
|
|
127
|
-
.description('Enable debug session inside build container')
|
|
79
|
+
debugSession: Joi.boolean().optional().default(false).description('Enable debug session inside build container')
|
|
128
80
|
});
|
|
129
81
|
|
|
130
82
|
module.exports = {
|
package/config/regex.js
CHANGED
|
@@ -34,7 +34,8 @@ module.exports = {
|
|
|
34
34
|
FULL_TEMPLATE_NAME: /^([\w/-]+)(?:@((?:(?:\d+)(?:\.\d+)?(?:\.\d+)?)|(?:[a-zA-Z][\w-.]+)))?$/,
|
|
35
35
|
// Full name of template and version with grouping for the namespace
|
|
36
36
|
// eslint-disable-next-line max-len
|
|
37
|
-
FULL_TEMPLATE_NAME_WITH_NAMESPACE:
|
|
37
|
+
FULL_TEMPLATE_NAME_WITH_NAMESPACE:
|
|
38
|
+
/^([\w-]+)\/([\w/-]+)(?:@((?:(?:\d+)(?:\.\d+)?(?:\.\d+)?)|(?:[a-zA-Z][\w-]+)))?$/,
|
|
38
39
|
// Images cannot contain dangerous shell metacharacters '";&|><*?`$()[]!# or space; {} is allowed for matrix mode
|
|
39
40
|
IMAGE_NAME: /^[^;&|><*?`$()!#'" ]+$/,
|
|
40
41
|
// Steps can only be named with A-Z,a-z,0-9,-,_
|
|
@@ -87,7 +88,8 @@ module.exports = {
|
|
|
87
88
|
// Fourth group: branch name (e.g. #branchName)
|
|
88
89
|
// Fifth group: root dir (e.g. :path/to/source/dir)
|
|
89
90
|
// eslint-disable-next-line max-len
|
|
90
|
-
CHECKOUT_URL:
|
|
91
|
+
CHECKOUT_URL:
|
|
92
|
+
/^(?:(?:https:\/\/(?:[^@/:\s]+@)?)|git@|org-\d+@)+([^/:\s]+)(?:\/|:)([^/:\s]+)\/([^\s]+?)(?:\.git)(#[^:\s]+)?(:[^\s]+)?$/,
|
|
91
93
|
// scmUri. For example: github.com:abc-123:master or bitbucket.org:{123}:master
|
|
92
94
|
// Optionally, can have rootDir. For example: github.com:abc-123:master:src/app/component
|
|
93
95
|
SCM_URI: /^([^:]+):([^:]+):([^:]+)(?::([^:]+))?$/,
|
package/config/settings.js
CHANGED
|
@@ -16,13 +16,7 @@ const SCHEMA_DISPLAY_JOB_NAME_LENGTH = Joi.number()
|
|
|
16
16
|
.example(20);
|
|
17
17
|
const SCHEMA_METRICS_DOWNTIME_JOBS = Joi.array()
|
|
18
18
|
.items(
|
|
19
|
-
Joi.number()
|
|
20
|
-
.integer()
|
|
21
|
-
.positive()
|
|
22
|
-
.description('Identifier for this job')
|
|
23
|
-
.example(123345)
|
|
24
|
-
.optional()
|
|
25
|
-
.allow(null)
|
|
19
|
+
Joi.number().integer().positive().description('Identifier for this job').example(123345).optional().allow(null)
|
|
26
20
|
)
|
|
27
21
|
.description('Job IDs to watch for downtime');
|
|
28
22
|
const SCHEMA_METRICS_DOWNTIME_STATUSES = Joi.array()
|
package/config/template.js
CHANGED
|
@@ -15,12 +15,8 @@ const TEMPLATE_NAMESPACE = Joi.string()
|
|
|
15
15
|
const TEMPLATE_NAME = Joi.alternatives()
|
|
16
16
|
.conditional('namespace', {
|
|
17
17
|
is: Joi.exist(),
|
|
18
|
-
then: Joi.string()
|
|
19
|
-
|
|
20
|
-
.max(64),
|
|
21
|
-
otherwise: Joi.string()
|
|
22
|
-
.regex(Regex.TEMPLATE_NAME_ALLOW_SLASH)
|
|
23
|
-
.max(64)
|
|
18
|
+
then: Joi.string().regex(Regex.TEMPLATE_NAME_NO_SLASH).max(64),
|
|
19
|
+
otherwise: Joi.string().regex(Regex.TEMPLATE_NAME_ALLOW_SLASH).max(64)
|
|
24
20
|
})
|
|
25
21
|
.description('Name of the Template')
|
|
26
22
|
.example('node/npm-install');
|
|
@@ -67,10 +63,7 @@ const SCHEMA_TEMPLATE = Joi.object().keys({
|
|
|
67
63
|
version: TEMPLATE_VERSION.required(),
|
|
68
64
|
description: TEMPLATE_DESCRIPTION.required(),
|
|
69
65
|
maintainer: TEMPLATE_MAINTAINER.required(),
|
|
70
|
-
config: Job.templateJob
|
|
71
|
-
.required()
|
|
72
|
-
.or('image', 'template')
|
|
73
|
-
.or('steps', 'template'),
|
|
66
|
+
config: Job.templateJob.required().or('image', 'template').or('steps', 'template'),
|
|
74
67
|
images: TEMPLATE_IMAGES
|
|
75
68
|
});
|
|
76
69
|
|