screwdriver-data-schema 25.12.0 → 26.1.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.
@@ -50,13 +50,12 @@ const SCHEMA_USER_SETTINGS = Joi.object()
50
50
  showPRJobs: Joi.boolean()
51
51
  })
52
52
  )
53
- .unknown();
54
-
55
- SCHEMA_USER_SETTINGS.append({
56
- displayJobNameLength: SCHEMA_DISPLAY_JOB_NAME_LENGTH,
57
- timestampFormat: SCHEMA_TIMESTAMP_FORMAT,
58
- allowNotification: SCHEMA_ALLOW_NOTIFICATION
59
- });
53
+ .keys({
54
+ displayJobNameLength: SCHEMA_DISPLAY_JOB_NAME_LENGTH,
55
+ timestampFormat: SCHEMA_TIMESTAMP_FORMAT,
56
+ allowNotification: SCHEMA_ALLOW_NOTIFICATION
57
+ })
58
+ .unknown(false);
60
59
 
61
60
  module.exports = {
62
61
  pipelineSettings: SCHEMA_PIPELINE_SETTINGS,
@@ -0,0 +1,37 @@
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
+ 'stateChanger',
14
+ {
15
+ type: Sequelize.STRING(128)
16
+ },
17
+ { transaction }
18
+ );
19
+ await queryInterface.addColumn(
20
+ table,
21
+ 'stateChangeTime',
22
+ {
23
+ type: Sequelize.STRING(32)
24
+ },
25
+ { transaction }
26
+ );
27
+ await queryInterface.addColumn(
28
+ table,
29
+ 'stateChangeMessage',
30
+ {
31
+ type: Sequelize.STRING(512)
32
+ },
33
+ { transaction }
34
+ );
35
+ });
36
+ }
37
+ };
@@ -10,7 +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', 'DELETING'];
13
+ const STATES = ['ACTIVE', 'INACTIVE', 'DELETING', 'DISABLED'];
14
+ const VALID_STATES_FOR_UPDATE = ['ACTIVE', 'DISABLED'];
14
15
  const BADGE = Joi.object({
15
16
  defaultName: Joi.string()
16
17
  .max(128)
@@ -107,6 +108,15 @@ const MODEL = {
107
108
  .default('ACTIVE')
108
109
  .required(),
109
110
 
111
+ stateChanger: Joi.string().max(128).description('Username for who changed the state'),
112
+
113
+ stateChangeTime: Joi.string().isoDate().description('When the state of the pipeline was changed'),
114
+
115
+ stateChangeMessage: Joi.string()
116
+ .max(512)
117
+ .description('Reason why disabling or enabling pipeline')
118
+ .example('Disabling pipeline for maintenance'),
119
+
110
120
  subscribedScmUrlsWithActions: Joi.array()
111
121
  .items(
112
122
  Joi.object().keys({
@@ -132,7 +142,18 @@ const MODEL = {
132
142
  .allow(null)
133
143
  };
134
144
 
135
- const UPDATE_MODEL = { ...CREATE_MODEL, settings: MODEL.settings, badges: MODEL.badges };
145
+ const UPDATE_MODEL = {
146
+ ...CREATE_MODEL,
147
+ settings: MODEL.settings,
148
+ badges: MODEL.badges,
149
+ state: Joi.string()
150
+ .valid(...VALID_STATES_FOR_UPDATE)
151
+ .max(10)
152
+ .description('New state of the pipeline')
153
+ .example('ACTIVE')
154
+ .optional(),
155
+ stateChangeMessage: MODEL.stateChangeMessage
156
+ };
136
157
 
137
158
  module.exports = {
138
159
  /**
@@ -175,7 +196,10 @@ module.exports = {
175
196
  'settings',
176
197
  'badges',
177
198
  'templateVersionId',
178
- 'adminUserIds'
199
+ 'adminUserIds',
200
+ 'stateChanger',
201
+ 'stateChangeTime',
202
+ 'stateChangeMessage'
179
203
  ]
180
204
  )
181
205
  ).label('Get Pipeline'),
@@ -197,7 +221,11 @@ module.exports = {
197
221
  * @type {Joi}
198
222
  */
199
223
  update: Joi.object(
200
- mutate(UPDATE_MODEL, [], ['checkoutUrl', 'rootDir', 'autoKeysGeneration', 'settings', 'badges'])
224
+ mutate(
225
+ UPDATE_MODEL,
226
+ [],
227
+ ['checkoutUrl', 'rootDir', 'autoKeysGeneration', 'settings', 'badges', 'state', 'stateChangeMessage']
228
+ )
201
229
  ).label('Update Pipeline'),
202
230
 
203
231
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "25.12.0",
3
+ "version": "26.1.0",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {