screwdriver-data-schema 22.7.0 → 22.8.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.
package/api/validator.js CHANGED
@@ -36,7 +36,11 @@ const SCHEMA_JOB_PERMUTATION = Joi.object()
36
36
  secrets: Job.secrets,
37
37
  settings: Job.settings,
38
38
  sourcePaths: Job.sourcePaths,
39
- stages: Base.stages,
39
+ stage: Joi.object()
40
+ .keys({
41
+ name: Joi.string().regex(Regex.STAGE_NAME).required()
42
+ })
43
+ .unknown(false),
40
44
  subscribe: Base.subscribe,
41
45
  templateId: Job.templateId
42
46
  })
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ const Joi = require('joi');
4
+
5
+ const compatibilities = Joi.object({
6
+ clouds: Joi.array()
7
+ .items(Joi.string())
8
+ .description('A list of cloud that template supports')
9
+ .example(['aws', 'gcp', 'azure'])
10
+ .optional(),
11
+ architectures: Joi.array()
12
+ .items(Joi.string())
13
+ .description('A list of architectures that template supports')
14
+ .example(['x86', 'x86_64', 'arm64'])
15
+ .optional()
16
+ });
17
+
18
+ module.exports = {
19
+ compatibilities
20
+ };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
4
+ const stagesTable = `${prefix}stages`;
5
+ const stageBuildsTable = `${prefix}stageBuilds`;
6
+
7
+ module.exports = {
8
+ // eslint-disable-next-line no-unused-vars
9
+ async up(queryInterface, Sequelize) {
10
+ await queryInterface.sequelize.transaction(async transaction => {
11
+ await queryInterface.removeColumn(stagesTable, 'workflowGraph', { transaction });
12
+ await queryInterface.removeColumn(stageBuildsTable, 'workflowGraph', { transaction });
13
+ });
14
+ }
15
+ };
package/models/command.js CHANGED
@@ -4,6 +4,9 @@ const Joi = require('joi');
4
4
  const mutate = require('../lib/mutate');
5
5
  const Command = require('../config/command');
6
6
  const pipelineId = require('./pipeline').base.extract('id');
7
+ const Compatibilities = require('../config/compatibilities');
8
+
9
+ const { compatibilities } = Compatibilities;
7
10
 
8
11
  const MODEL = {
9
12
  id: Joi.number().integer().positive().description('Identifier of this command').example(123345),
@@ -24,7 +27,8 @@ const MODEL = {
24
27
  .example('2038-01-19T03:14:08.131Z'),
25
28
  usage: Command.usage,
26
29
  trusted: Joi.boolean().description('Mark whether command is trusted'),
27
- latest: Joi.boolean().description('Whether this is latest version')
30
+ latest: Joi.boolean().description('Whether this is latest version'),
31
+ compatibilities
28
32
  };
29
33
 
30
34
  module.exports = {
@@ -54,7 +58,7 @@ module.exports = {
54
58
  mutate(
55
59
  MODEL,
56
60
  ['id', 'namespace', 'name', 'version', 'description', 'maintainer', 'format', 'pipelineId'],
57
- ['habitat', 'docker', 'binary', 'createTime', 'usage', 'trusted', 'latest']
61
+ ['habitat', 'docker', 'binary', 'createTime', 'usage', 'trusted', 'latest', 'compatibilities']
58
62
  )
59
63
  ).label('Get Command'),
60
64
 
package/models/stage.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  const Joi = require('joi');
4
4
  const Regex = require('../config/regex');
5
- const WorkflowGraph = require('../config/workflowGraph');
6
5
  const mutate = require('../lib/mutate');
7
6
 
8
7
  const MODEL = {
@@ -26,15 +25,7 @@ const MODEL = {
26
25
 
27
26
  description: Joi.string().max(256).description('Description of the Stage').example('Deploys canary jobs'),
28
27
 
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
- })
28
+ archived: Joi.boolean().description('Flag if the stage is archived').example(true).default(false)
38
29
  };
39
30
 
40
31
  module.exports = {
@@ -61,11 +52,7 @@ module.exports = {
61
52
  * @type {Joi}
62
53
  */
63
54
  get: Joi.object(
64
- mutate(
65
- MODEL,
66
- ['id', 'pipelineId', 'name', 'jobIds'],
67
- ['description', 'setup', 'teardown', 'archived', 'workflowGraph']
68
- )
55
+ mutate(MODEL, ['id', 'pipelineId', 'name', 'jobIds'], ['description', 'setup', 'teardown', 'archived'])
69
56
  ).label('Get Stage metadata'),
70
57
 
71
58
  /**
@@ -74,9 +61,9 @@ module.exports = {
74
61
  * @property update
75
62
  * @type {Joi}
76
63
  */
77
- update: Joi.object(
78
- mutate(MODEL, [], ['jobIds', 'description', 'setup', 'teardown', 'archived', 'workflowGraph'])
79
- ).label('Update Stage'),
64
+ update: Joi.object(mutate(MODEL, [], ['jobIds', 'description', 'setup', 'teardown', 'archived'])).label(
65
+ 'Update Stage'
66
+ ),
80
67
 
81
68
  /**
82
69
  * List of fields that determine a unique row
@@ -2,7 +2,6 @@
2
2
 
3
3
  const Joi = require('joi');
4
4
  const mutate = require('../lib/mutate');
5
- const WorkflowGraph = require('../config/workflowGraph');
6
5
  const status = require('./build').base.extract('status');
7
6
 
8
7
  const MODEL = {
@@ -12,14 +11,6 @@ const MODEL = {
12
11
 
13
12
  eventId: Joi.number().integer().positive().description('Identifier of the event').example(123345),
14
13
 
15
- workflowGraph: WorkflowGraph.workflowGraph.description('Graph representation of the workflow').example({
16
- nodes: [{ name: '~commit' }, { name: 'main' }, { name: 'publish' }],
17
- edges: [
18
- { src: '~commit', dest: 'main' },
19
- { src: 'main', dest: 'publish' }
20
- ]
21
- }),
22
-
23
14
  status
24
15
  };
25
16
 
@@ -46,9 +37,7 @@ module.exports = {
46
37
  * @property get
47
38
  * @type {Joi}
48
39
  */
49
- get: Joi.object(mutate(MODEL, ['id', 'stageId', 'eventId'], ['workflowGraph', 'status'])).label(
50
- 'Get Stage Build metadata'
51
- ),
40
+ get: Joi.object(mutate(MODEL, ['id', 'stageId', 'eventId'], ['status'])).label('Get Stage Build metadata'),
52
41
 
53
42
  /**
54
43
  * List of fields that determine a unique row
@@ -4,6 +4,9 @@ const Joi = require('joi');
4
4
  const mutate = require('../lib/mutate');
5
5
  const Template = require('../config/template');
6
6
  const pipelineId = require('./pipeline').base.extract('id');
7
+ const Compatibilities = require('../config/compatibilities');
8
+
9
+ const { compatibilities } = Compatibilities;
7
10
 
8
11
  const MODEL = {
9
12
  id: Joi.number().integer().positive().description('Identifier of this template').example(123345),
@@ -22,7 +25,8 @@ const MODEL = {
22
25
  .description('When this template was created')
23
26
  .example('2038-01-19T03:14:08.131Z'),
24
27
  trusted: Joi.boolean().description('Mark whether template is trusted'),
25
- latest: Joi.boolean().description('Whether this is latest version')
28
+ latest: Joi.boolean().description('Whether this is latest version'),
29
+ compatibilities
26
30
  };
27
31
 
28
32
  const CREATE_MODEL = { ...MODEL, config: Template.configNoDupSteps };
@@ -54,7 +58,7 @@ module.exports = {
54
58
  mutate(
55
59
  MODEL,
56
60
  ['id', 'labels', 'name', 'version', 'description', 'maintainer', 'pipelineId'],
57
- ['config', 'namespace', 'images', 'createTime', 'trusted', 'latest']
61
+ ['config', 'namespace', 'images', 'createTime', 'trusted', 'latest', 'compatibilities']
58
62
  )
59
63
  ).label('Get Template'),
60
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "22.7.0",
3
+ "version": "22.8.0",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {