screwdriver-data-schema 22.4.4 → 22.4.5

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,21 @@
1
+ /* eslint-disable new-cap */
2
+
3
+ 'use strict';
4
+
5
+ const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
6
+ const table = `${prefix}stages`;
7
+
8
+ module.exports = {
9
+ up: async (queryInterface, Sequelize) => {
10
+ await queryInterface.sequelize.transaction(async transaction => {
11
+ await queryInterface.addColumn(
12
+ table,
13
+ 'workflowGraph',
14
+ {
15
+ type: Sequelize.TEXT
16
+ },
17
+ { transaction }
18
+ );
19
+ });
20
+ }
21
+ };
package/models/stage.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const Joi = require('joi');
4
4
  const Regex = require('../config/regex');
5
+ const WorkflowGraph = require('../config/workflowGraph');
5
6
  const mutate = require('../lib/mutate');
6
7
 
7
8
  const MODEL = {
@@ -25,7 +26,15 @@ const MODEL = {
25
26
 
26
27
  description: Joi.string().max(256).description('Description of the Stage').example('Deploys canary jobs'),
27
28
 
28
- archived: Joi.boolean().description('Flag if the stage is archived').example(true).default(false)
29
+ archived: Joi.boolean().description('Flag if the stage is archived').example(true).default(false),
30
+
31
+ workflowGraph: WorkflowGraph.workflowGraph.description('Graph representation of the workflow').example({
32
+ nodes: [{ name: '~commit' }, { name: 'main' }, { name: 'publish' }],
33
+ edges: [
34
+ { src: '~commit', dest: 'main' },
35
+ { src: 'main', dest: 'publish' }
36
+ ]
37
+ })
29
38
  };
30
39
 
31
40
  module.exports = {
@@ -52,7 +61,11 @@ module.exports = {
52
61
  * @type {Joi}
53
62
  */
54
63
  get: Joi.object(
55
- mutate(MODEL, ['id', 'pipelineId', 'name', 'jobIds'], ['description', 'setup', 'teardown', 'archived'])
64
+ mutate(
65
+ MODEL,
66
+ ['id', 'pipelineId', 'name', 'jobIds'],
67
+ ['description', 'setup', 'teardown', 'archived', 'workflowGraph']
68
+ )
56
69
  ).label('Get Stage metadata'),
57
70
 
58
71
  /**
@@ -61,9 +74,9 @@ module.exports = {
61
74
  * @property update
62
75
  * @type {Joi}
63
76
  */
64
- update: Joi.object(mutate(MODEL, [], ['jobIds', 'description', 'setup', 'teardown', 'archived'])).label(
65
- 'Update Stage'
66
- ),
77
+ update: Joi.object(
78
+ mutate(MODEL, [], ['jobIds', 'description', 'setup', 'teardown', 'archived', 'workflowGraph'])
79
+ ).label('Update Stage'),
67
80
 
68
81
  /**
69
82
  * List of fields that determine a unique row
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "22.4.4",
3
+ "version": "22.4.5",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {