screwdriver-data-schema 21.25.0 → 21.26.1
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/base.js +1 -2
- package/config/regex.js +0 -2
- package/config/settings.js +6 -1
- package/migrations/20220607-initdb-stages.js +1 -1
- package/migrations/20220628-remove_pr_jobs_invalid_name.js +23 -0
- package/migrations/20220705-upd-stage-color-eventId-createTime.js +51 -0
- package/models/stage.js +11 -14
- package/package.json +3 -3
package/config/base.js
CHANGED
package/config/regex.js
CHANGED
|
@@ -49,8 +49,6 @@ module.exports = {
|
|
|
49
49
|
INTERNAL_TRIGGER: /^~([\w-]+)$/,
|
|
50
50
|
// Stages can only be named with A-Z,a-z,0-9,-,_
|
|
51
51
|
STAGE_NAME: /^[\w-]+$/,
|
|
52
|
-
// Stages can only be named with valid hex CSS color
|
|
53
|
-
STAGE_COLOR: /^#(?:[0-9a-fA-F]{3}){1,2}$/,
|
|
54
52
|
|
|
55
53
|
// Don't combine EXTERNAL_TRIGGER and EXTERNAL_TRIGGER_AND for backward compatibility
|
|
56
54
|
// BlockBy does not support EXTERNAL_TRIGGER_AND
|
package/config/settings.js
CHANGED
|
@@ -31,7 +31,12 @@ const SCHEMA_PIPELINE_SETTINGS = Joi.object()
|
|
|
31
31
|
public: Joi.boolean(),
|
|
32
32
|
groupedEvents: Joi.boolean().optional(),
|
|
33
33
|
showEventTriggers: Joi.boolean().optional(),
|
|
34
|
-
filterEventsForNoBuilds: Joi.boolean().optional()
|
|
34
|
+
filterEventsForNoBuilds: Joi.boolean().optional(),
|
|
35
|
+
aliasName: Joi.string()
|
|
36
|
+
.max(32)
|
|
37
|
+
.description('A customizable alias for pipeline name')
|
|
38
|
+
.example('scwdvr-cd')
|
|
39
|
+
.optional()
|
|
35
40
|
})
|
|
36
41
|
.default({});
|
|
37
42
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
|
|
4
|
+
const table = `${prefix}jobs`;
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
// eslint-disable-next-line no-unused-vars
|
|
8
|
+
async up(queryInterface, Sequelize) {
|
|
9
|
+
await queryInterface.sequelize.transaction(async transaction => {
|
|
10
|
+
const dialect = queryInterface.sequelize.getDialect();
|
|
11
|
+
// sqlite
|
|
12
|
+
let query = `DELETE FROM "${table}" WHERE "name" LIKE 'PR-%' AND INSTR(name, ':') = 0`;
|
|
13
|
+
|
|
14
|
+
if (dialect === 'postgres') {
|
|
15
|
+
query = `DELETE FROM "${table}" WHERE "name" LIKE 'PR-%' AND POSITION(':' IN "name") = 0`;
|
|
16
|
+
} else if (dialect === 'mysql') {
|
|
17
|
+
query = `DELETE FROM \`${table}\` WHERE name LIKE 'PR-%' AND POSITION(':' IN name) = 0`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
await queryInterface.sequelize.query(query, { transaction });
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable new-cap */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
|
|
6
|
+
const table = `${prefix}stages`;
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
// eslint-disable-next-line no-unused-vars
|
|
10
|
+
up: async (queryInterface, Sequelize) => {
|
|
11
|
+
await queryInterface.sequelize.transaction(async transaction => {
|
|
12
|
+
try {
|
|
13
|
+
await queryInterface.removeColumn(table, 'color');
|
|
14
|
+
|
|
15
|
+
await queryInterface.removeColumn(table, 'state');
|
|
16
|
+
|
|
17
|
+
await queryInterface.addColumn(
|
|
18
|
+
table,
|
|
19
|
+
'groupEventId',
|
|
20
|
+
{
|
|
21
|
+
type: Sequelize.DOUBLE
|
|
22
|
+
},
|
|
23
|
+
{ transaction }
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
await queryInterface.addColumn(
|
|
27
|
+
table,
|
|
28
|
+
'createTime',
|
|
29
|
+
{
|
|
30
|
+
type: Sequelize.STRING(32)
|
|
31
|
+
},
|
|
32
|
+
{ transaction }
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
await queryInterface.addConstraint(table, {
|
|
36
|
+
name: `${table}_pipeline_id_name_group_event_id_key`,
|
|
37
|
+
fields: ['pipelineId', 'name', 'groupEventId'],
|
|
38
|
+
type: 'unique',
|
|
39
|
+
transaction
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
await queryInterface.addIndex(table, {
|
|
43
|
+
name: `${table}_group_event_id_create_time`,
|
|
44
|
+
fields: ['groupEventId', 'createTime'],
|
|
45
|
+
transaction
|
|
46
|
+
});
|
|
47
|
+
// eslint-disable-next-line no-empty
|
|
48
|
+
} catch (e) {}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
package/models/stage.js
CHANGED
|
@@ -33,23 +33,20 @@ const MODEL = {
|
|
|
33
33
|
)
|
|
34
34
|
.description('Job IDs in this Stage'),
|
|
35
35
|
|
|
36
|
-
state: Joi.string()
|
|
37
|
-
.valid('ARCHIVED', 'ACTIVE')
|
|
38
|
-
.max(10)
|
|
39
|
-
.description('Current state of the Stage')
|
|
40
|
-
.example('ARCHIVED')
|
|
41
|
-
.default('ACTIVE'),
|
|
42
|
-
|
|
43
36
|
description: Joi.string()
|
|
44
37
|
.max(256)
|
|
45
38
|
.description('Description of the Stage')
|
|
46
39
|
.example('Deploys canary jobs'),
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
.
|
|
50
|
-
.
|
|
51
|
-
.description('
|
|
52
|
-
.example(
|
|
41
|
+
groupEventId: Joi.number()
|
|
42
|
+
.integer()
|
|
43
|
+
.positive()
|
|
44
|
+
.description('Identifier of the group event')
|
|
45
|
+
.example(123345),
|
|
46
|
+
|
|
47
|
+
createTime: Joi.string()
|
|
48
|
+
.isoDate()
|
|
49
|
+
.description('When this stage was created')
|
|
53
50
|
};
|
|
54
51
|
|
|
55
52
|
module.exports = {
|
|
@@ -75,7 +72,7 @@ module.exports = {
|
|
|
75
72
|
* @property keys
|
|
76
73
|
* @type {Array}
|
|
77
74
|
*/
|
|
78
|
-
keys: ['pipelineId', 'name'],
|
|
75
|
+
keys: ['pipelineId', 'name', 'groupEventId'],
|
|
79
76
|
|
|
80
77
|
/**
|
|
81
78
|
* List of all fields in the model
|
|
@@ -98,5 +95,5 @@ module.exports = {
|
|
|
98
95
|
* @property indexes
|
|
99
96
|
* @type {Array}
|
|
100
97
|
*/
|
|
101
|
-
indexes: [{ fields: ['pipelineId'] }]
|
|
98
|
+
indexes: [{ fields: ['pipelineId'] }, { fields: ['groupEventId', 'createTime'] }]
|
|
102
99
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screwdriver-data-schema",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.26.1",
|
|
4
4
|
"description": "Internal Data Schema of Screwdriver",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"npx": "^10.2.2",
|
|
51
51
|
"nyc": "^15.0.0",
|
|
52
52
|
"pg": "^7.18.2",
|
|
53
|
-
"sequelize": "^6.21.
|
|
53
|
+
"sequelize": "^6.21.3",
|
|
54
54
|
"sequelize-cli": "^6.4.1",
|
|
55
55
|
"sqlite3": "^4.2.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"cron-parser": "^4.
|
|
58
|
+
"cron-parser": "^4.5.0",
|
|
59
59
|
"joi": "^17.6.0"
|
|
60
60
|
}
|
|
61
61
|
}
|