screwdriver-data-schema 22.12.0 → 23.0.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
CHANGED
|
@@ -63,7 +63,7 @@ const SCHEMA_SUBSCRIBE = Joi.object().keys({
|
|
|
63
63
|
)
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
const
|
|
66
|
+
const SCHEMA_CONFIG_PRE_TEMPLATE_MERGE = Joi.object()
|
|
67
67
|
.keys({
|
|
68
68
|
template: Joi.string().regex(Regex.FULL_TEMPLATE_NAME_WITH_NAMESPACE),
|
|
69
69
|
version: Joi.number().integer().min(1).max(50),
|
|
@@ -86,6 +86,21 @@ const SCHEMA_CONFIG = Joi.object()
|
|
|
86
86
|
})
|
|
87
87
|
.unknown(false);
|
|
88
88
|
|
|
89
|
+
const SCHEMA_CONFIG_POST_TEMPLATE_MERGE = Joi.object()
|
|
90
|
+
.keys({
|
|
91
|
+
version: Joi.number().integer().min(1).max(50),
|
|
92
|
+
annotations: Annotations.annotations,
|
|
93
|
+
jobs: SCHEMA_JOBS.required(),
|
|
94
|
+
shared: SCHEMA_SHARED,
|
|
95
|
+
cache: SCHEMA_CACHE,
|
|
96
|
+
childPipelines: SCHEMA_CHILD_PIPELINES,
|
|
97
|
+
stages: SCHEMA_STAGES,
|
|
98
|
+
subscribe: SCHEMA_SUBSCRIBE,
|
|
99
|
+
parameters: Parameters.parameters.default({}),
|
|
100
|
+
templateVersionId: Joi.number().integer().positive().optional().allow(null)
|
|
101
|
+
})
|
|
102
|
+
.unknown(false);
|
|
103
|
+
|
|
89
104
|
/**
|
|
90
105
|
* Main pieces of a screwdriver.yaml
|
|
91
106
|
* @type {Object}
|
|
@@ -97,7 +112,8 @@ module.exports = {
|
|
|
97
112
|
cache: SCHEMA_CACHE,
|
|
98
113
|
cachePerm: SCHEMA_CACHE_PERMUTATION,
|
|
99
114
|
childPipelines: SCHEMA_CHILD_PIPELINES,
|
|
100
|
-
|
|
115
|
+
configBeforeMergingTemplate: SCHEMA_CONFIG_PRE_TEMPLATE_MERGE,
|
|
116
|
+
configAfterMergingTemplate: SCHEMA_CONFIG_POST_TEMPLATE_MERGE,
|
|
101
117
|
stageSetupTeardownJob: SCHEMA_SETUP_TEARDOWN_JOB,
|
|
102
118
|
stage: SCHEMA_STAGE,
|
|
103
119
|
stages: SCHEMA_STAGES,
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
'templateVersionId',
|
|
14
|
+
{
|
|
15
|
+
type: Sequelize.INTEGER.UNSIGNED
|
|
16
|
+
},
|
|
17
|
+
{ transaction }
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
await queryInterface.addIndex(table, {
|
|
21
|
+
name: `${table}_template_version_id`,
|
|
22
|
+
fields: ['templateVersionId'],
|
|
23
|
+
transaction
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
package/models/build.js
CHANGED
package/models/collection.js
CHANGED
|
@@ -3,17 +3,8 @@
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
4
|
const mutate = require('../lib/mutate');
|
|
5
5
|
|
|
6
|
-
const BUILD_MODEL = require('./build').get;
|
|
7
6
|
const PIPELINE_MODEL = require('./pipeline').get;
|
|
8
|
-
const
|
|
9
|
-
open: Joi.number().integer().min(0),
|
|
10
|
-
failing: Joi.number().integer().min(0)
|
|
11
|
-
};
|
|
12
|
-
const PIPELINE_OBJECT = PIPELINE_MODEL.keys({
|
|
13
|
-
lastBuilds: Joi.array().items(BUILD_MODEL).optional(),
|
|
14
|
-
prs: Joi.object(PRS).optional()
|
|
15
|
-
});
|
|
16
|
-
const PIPELINES_MODEL = Joi.array().items(PIPELINE_OBJECT);
|
|
7
|
+
const PIPELINES_MODEL = Joi.array().items(PIPELINE_MODEL);
|
|
17
8
|
const MODEL = {
|
|
18
9
|
id: Joi.number().integer().positive(),
|
|
19
10
|
|
package/models/pipeline.js
CHANGED
|
@@ -112,7 +112,15 @@ const MODEL = {
|
|
|
112
112
|
})
|
|
113
113
|
.description('A list of badges that pipline has')
|
|
114
114
|
.example(`{ sonar: { name: 'dashboard', uri: 'http://sonar.com/sample1' } }`)
|
|
115
|
+
.optional(),
|
|
116
|
+
|
|
117
|
+
templateVersionId: Joi.number()
|
|
118
|
+
.integer()
|
|
119
|
+
.positive()
|
|
120
|
+
.description("Identifier for this pipeline's template")
|
|
121
|
+
.example(123345)
|
|
115
122
|
.optional()
|
|
123
|
+
.allow(null)
|
|
116
124
|
};
|
|
117
125
|
|
|
118
126
|
const UPDATE_MODEL = { ...CREATE_MODEL, settings: MODEL.settings, badges: MODEL.badges };
|
|
@@ -156,7 +164,8 @@ module.exports = {
|
|
|
156
164
|
'parameters',
|
|
157
165
|
'subscribedScmUrlsWithActions',
|
|
158
166
|
'settings',
|
|
159
|
-
'badges'
|
|
167
|
+
'badges',
|
|
168
|
+
'templateVersionId'
|
|
160
169
|
]
|
|
161
170
|
)
|
|
162
171
|
).label('Get Pipeline'),
|