screwdriver-data-schema 21.26.2 → 21.27.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/config/settings.js +7 -1
- package/config/template.js +2 -7
- package/migrations/20220607152947-add_column_state_to_pipeline.js +23 -0
- package/migrations/20220728171252-remove_column_parameters_from_templates.js +14 -0
- package/models/pipeline.js +18 -1
- package/models/template.js +3 -4
- package/package.json +1 -1
package/config/settings.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
4
|
|
|
5
|
+
const SCHEMA_TIMESTAMP_FORMAT = Joi.string()
|
|
6
|
+
.valid('UTC', 'LOCAL_TIMEZONE', 'HUMAN_READABLE')
|
|
7
|
+
.optional()
|
|
8
|
+
.default('HUMAN_READABLE')
|
|
9
|
+
.description('User preferred timestamp');
|
|
5
10
|
const SCHEMA_DISPLAY_JOB_NAME_LENGTH = Joi.number()
|
|
6
11
|
.integer()
|
|
7
12
|
.min(20)
|
|
@@ -46,7 +51,8 @@ const SCHEMA_USER_SETTINGS = Joi.object()
|
|
|
46
51
|
/\d/,
|
|
47
52
|
Joi.object().keys({
|
|
48
53
|
displayJobNameLength: SCHEMA_DISPLAY_JOB_NAME_LENGTH,
|
|
49
|
-
showPRJobs: Joi.boolean()
|
|
54
|
+
showPRJobs: Joi.boolean(),
|
|
55
|
+
timestampFormat: SCHEMA_TIMESTAMP_FORMAT
|
|
50
56
|
})
|
|
51
57
|
)
|
|
52
58
|
.unknown();
|
package/config/template.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
4
|
const Job = require('./job');
|
|
5
5
|
const Regex = require('./regex');
|
|
6
|
-
const Parameters = require('./parameters');
|
|
7
6
|
|
|
8
7
|
const TEMPLATE_NAMESPACE = Joi.string()
|
|
9
8
|
.regex(Regex.TEMPLATE_NAMESPACE)
|
|
@@ -62,8 +61,6 @@ const TEMPLATE_IMAGES = Joi.object()
|
|
|
62
61
|
})
|
|
63
62
|
.min(1);
|
|
64
63
|
|
|
65
|
-
const SCHEMA_JOB_PARAMETERS = Parameters.parameters.optional();
|
|
66
|
-
|
|
67
64
|
const SCHEMA_TEMPLATE = Joi.object().keys({
|
|
68
65
|
namespace: TEMPLATE_NAMESPACE,
|
|
69
66
|
name: TEMPLATE_NAME.required(),
|
|
@@ -74,8 +71,7 @@ const SCHEMA_TEMPLATE = Joi.object().keys({
|
|
|
74
71
|
.required()
|
|
75
72
|
.or('image', 'template')
|
|
76
73
|
.or('steps', 'template'),
|
|
77
|
-
images: TEMPLATE_IMAGES
|
|
78
|
-
parameters: SCHEMA_JOB_PARAMETERS
|
|
74
|
+
images: TEMPLATE_IMAGES
|
|
79
75
|
});
|
|
80
76
|
|
|
81
77
|
/**
|
|
@@ -93,6 +89,5 @@ module.exports = {
|
|
|
93
89
|
maintainer: TEMPLATE_MAINTAINER,
|
|
94
90
|
config: Job.templateJob,
|
|
95
91
|
configNoDupSteps: Job.jobNoDupSteps,
|
|
96
|
-
images: TEMPLATE_IMAGES
|
|
97
|
-
parameters: SCHEMA_JOB_PARAMETERS
|
|
92
|
+
images: TEMPLATE_IMAGES
|
|
98
93
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable new-cap */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
|
|
6
|
+
const table = `${prefix}pipelines`;
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
up: async (queryInterface, Sequelize) => {
|
|
10
|
+
await queryInterface.sequelize.transaction(async transaction => {
|
|
11
|
+
await queryInterface.addColumn(
|
|
12
|
+
table,
|
|
13
|
+
'state',
|
|
14
|
+
{
|
|
15
|
+
type: Sequelize.STRING(10),
|
|
16
|
+
defaultValue: 'ACTIVE',
|
|
17
|
+
allowNull: false
|
|
18
|
+
},
|
|
19
|
+
{ transaction }
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
|
|
4
|
+
const table = `${prefix}templates`;
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
// eslint-disable-next-line no-unused-vars
|
|
8
|
+
up: async (queryInterface, Sequelize) => {
|
|
9
|
+
try {
|
|
10
|
+
await queryInterface.removeColumn(table, 'parameters');
|
|
11
|
+
// eslint-disable-next-line no-empty
|
|
12
|
+
} catch (e) {}
|
|
13
|
+
}
|
|
14
|
+
};
|
package/models/pipeline.js
CHANGED
|
@@ -10,6 +10,8 @@ const WorkflowGraph = require('../config/workflowGraph');
|
|
|
10
10
|
const Parameters = require('../config/parameters');
|
|
11
11
|
const mutate = require('../lib/mutate');
|
|
12
12
|
|
|
13
|
+
const STATES = ['ACTIVE', 'INACTIVE'];
|
|
14
|
+
|
|
13
15
|
const CREATE_MODEL = {
|
|
14
16
|
checkoutUrl: Joi.string()
|
|
15
17
|
.regex(Regex.CHECKOUT_URL)
|
|
@@ -85,6 +87,13 @@ const MODEL = {
|
|
|
85
87
|
|
|
86
88
|
settings: Settings.pipelineSettings,
|
|
87
89
|
|
|
90
|
+
state: Joi.string()
|
|
91
|
+
.valid(...STATES)
|
|
92
|
+
.max(10)
|
|
93
|
+
.description('Current state of the pipeline')
|
|
94
|
+
.example('ACTIVE')
|
|
95
|
+
.default('ACTIVE'),
|
|
96
|
+
|
|
88
97
|
subscribedScmUrlsWithActions: Joi.array()
|
|
89
98
|
.items(
|
|
90
99
|
Joi.object().keys({
|
|
@@ -123,7 +132,7 @@ module.exports = {
|
|
|
123
132
|
get: Joi.object(
|
|
124
133
|
mutate(
|
|
125
134
|
MODEL,
|
|
126
|
-
['id', 'scmUri', 'scmContext', 'createTime', 'admins'],
|
|
135
|
+
['id', 'scmUri', 'scmContext', 'createTime', 'admins', 'state'],
|
|
127
136
|
[
|
|
128
137
|
'workflowGraph',
|
|
129
138
|
'scmRepo',
|
|
@@ -175,6 +184,14 @@ module.exports = {
|
|
|
175
184
|
*/
|
|
176
185
|
allKeys: Object.keys(MODEL),
|
|
177
186
|
|
|
187
|
+
/**
|
|
188
|
+
* All the available states of Pipeline
|
|
189
|
+
*
|
|
190
|
+
* @property allStates
|
|
191
|
+
* @type {Array}
|
|
192
|
+
*/
|
|
193
|
+
allStates: STATES,
|
|
194
|
+
|
|
178
195
|
/**
|
|
179
196
|
* Tablename to be used in the datastore
|
|
180
197
|
*
|
package/models/template.js
CHANGED
|
@@ -32,8 +32,7 @@ const MODEL = {
|
|
|
32
32
|
.description('When this template was created')
|
|
33
33
|
.example('2038-01-19T03:14:08.131Z'),
|
|
34
34
|
trusted: Joi.boolean().description('Mark whether template is trusted'),
|
|
35
|
-
latest: Joi.boolean().description('Whether this is latest version')
|
|
36
|
-
parameters: Template.parameters
|
|
35
|
+
latest: Joi.boolean().description('Whether this is latest version')
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
const CREATE_MODEL = { ...MODEL, config: Template.configNoDupSteps };
|
|
@@ -65,7 +64,7 @@ module.exports = {
|
|
|
65
64
|
mutate(
|
|
66
65
|
MODEL,
|
|
67
66
|
['id', 'labels', 'name', 'version', 'description', 'maintainer', 'pipelineId'],
|
|
68
|
-
['config', 'namespace', 'images', 'createTime', 'trusted', 'latest'
|
|
67
|
+
['config', 'namespace', 'images', 'createTime', 'trusted', 'latest']
|
|
69
68
|
)
|
|
70
69
|
).label('Get Template'),
|
|
71
70
|
|
|
@@ -79,7 +78,7 @@ module.exports = {
|
|
|
79
78
|
mutate(
|
|
80
79
|
CREATE_MODEL,
|
|
81
80
|
['config', 'name', 'version', 'description', 'maintainer'],
|
|
82
|
-
['labels', 'namespace', 'images'
|
|
81
|
+
['labels', 'namespace', 'images']
|
|
83
82
|
)
|
|
84
83
|
).label('Create Template'),
|
|
85
84
|
|