screwdriver-data-schema 21.26.4 → 21.27.2

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')
@@ -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
+ };
@@ -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,14 @@ 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
+ .required(),
97
+
88
98
  subscribedScmUrlsWithActions: Joi.array()
89
99
  .items(
90
100
  Joi.object().keys({
@@ -123,7 +133,7 @@ module.exports = {
123
133
  get: Joi.object(
124
134
  mutate(
125
135
  MODEL,
126
- ['id', 'scmUri', 'scmContext', 'createTime', 'admins'],
136
+ ['id', 'scmUri', 'scmContext', 'createTime', 'admins', 'state'],
127
137
  [
128
138
  'workflowGraph',
129
139
  'scmRepo',
@@ -175,6 +185,14 @@ module.exports = {
175
185
  */
176
186
  allKeys: Object.keys(MODEL),
177
187
 
188
+ /**
189
+ * All the available states of Pipeline
190
+ *
191
+ * @property allStates
192
+ * @type {Array}
193
+ */
194
+ allStates: STATES,
195
+
178
196
  /**
179
197
  * Tablename to be used in the datastore
180
198
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "21.26.4",
3
+ "version": "21.27.2",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {