screwdriver-data-schema 21.26.4 → 21.27.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.
@@ -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,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
  *
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.0",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {