screwdriver-data-schema 22.6.1 → 22.7.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.
@@ -0,0 +1,6 @@
1
+ trailingComma: "none"
2
+ printWidth: 100
3
+ singleQuote: true
4
+ tabWidth: 4
5
+ arrowParens: "avoid"
6
+ htmlWhitespaceSensitivity: "strict"
package/api/index.js CHANGED
@@ -9,12 +9,14 @@ const status = require('./status');
9
9
  const templateValidator = require('./templateValidator');
10
10
  const validator = require('./validator');
11
11
  const versions = require('./versions');
12
+ const pipelineUsage = require('./pipelineUsage');
12
13
 
13
14
  module.exports = {
14
15
  auth,
15
16
  commandValidator,
16
17
  loglines,
17
18
  pagination,
19
+ pipelineUsage,
18
20
  stats,
19
21
  status,
20
22
  templateValidator,
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ const Joi = require('joi');
4
+ const pipelineSchema = require('../models/pipeline').base;
5
+ const eventSchema = require('../models/event').base;
6
+
7
+ module.exports = {
8
+ get: Joi.array().items(
9
+ Joi.object({
10
+ id: pipelineSchema.extract('id').required(),
11
+ name: pipelineSchema.extract('name').required(),
12
+ scmRepo: pipelineSchema.extract('scmRepo').required(),
13
+ lastRun: Joi.alternatives().try(eventSchema.extract('createTime'), Joi.allow(null)),
14
+ admins: pipelineSchema.extract('admins').required()
15
+ })
16
+ )
17
+ };
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,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/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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "22.6.1",
3
+ "version": "22.7.1",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {