screwdriver-data-schema 21.26.3 → 21.27.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.
@@ -38,6 +38,7 @@ const SCHEMA_PIPELINE_SETTINGS = Joi.object()
38
38
  showEventTriggers: Joi.boolean().optional(),
39
39
  filterEventsForNoBuilds: Joi.boolean().optional(),
40
40
  aliasName: Joi.string()
41
+ .allow('')
41
42
  .max(32)
42
43
  .description('A customizable alias for pipeline name')
43
44
  .example('scwdvr-cd')
@@ -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
+ };
@@ -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
  *
@@ -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', 'parameters']
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', 'parameters']
81
+ ['labels', 'namespace', 'images']
83
82
  )
84
83
  ).label('Create Template'),
85
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "21.26.3",
3
+ "version": "21.27.1",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {