screwdriver-data-schema 25.6.0 → 25.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/config/regex.js CHANGED
@@ -44,17 +44,19 @@ module.exports = {
44
44
  // Also allow stage setup/teardown like stage@stage-name:setup
45
45
  JOB_NAME: /^(([\w-]+)|(?:stage@([\w-]+):(setup|teardown)))$/,
46
46
  // PR JOB Name can only be PR-1 or PR-1:main, group1: PR-prNum, group2: jobName
47
- PR_JOB_NAME: /^(PR-\d+)(?::([\w-]+))?$/,
47
+ PR_JOB_NAME: /^(PR-\d+)(?::([\w-]+|stage@[\w-]+:[\w-]+))?$/,
48
48
  // Stage setup or teardown job name. Can be stage@stage-name:setup or stage@stage-name:teardown
49
- STAGE_SETUP_TEARDOWN_JOB_NAME: /^stage@([\w-]+):(setup|teardown)$/,
49
+ STAGE_SETUP_TEARDOWN_JOB_NAME: /^(?:PR-\d+:)?stage@([\w-]+):(setup|teardown)$/,
50
50
  // Match all possible job name
51
51
  ALL_JOB_NAME: /^(PR-[0-9]+:)?[\w-@:]+$/,
52
52
  // Internal trigger like ~component or ~main
53
53
  INTERNAL_TRIGGER: /^~([\w-]+)$/,
54
54
  // Stages can only be named with A-Z,a-z,0-9,-,_
55
55
  STAGE_NAME: /^[\w-]+$/,
56
+ // Stages can only be named with A-Z,a-z,0-9,-,_
57
+ PR_STAGE_NAME: /^(PR-\d+):([\w-]+)$/,
56
58
  // Stage name prefixed with @stage. Ex: stage@prod
57
- QUALIFIED_STAGE_NAME: /^stage@([\w-]+)$/,
59
+ QUALIFIED_STAGE_NAME: /^(?:PR-\d+:)?stage@([\w-]+)$/,
58
60
  // Stage trigger like ~stage@deploy or ~stage@stageName:jobName or stage@deploy or stage@stageName:jobName
59
61
  STAGE_TRIGGER: /^~?stage@([\w-]+)(?::([\w-]+))?$/,
60
62
  // External Stage trigger like ~sd@26:stage@alpha:setup
@@ -124,5 +126,7 @@ module.exports = {
124
126
  // Provider Role. Can be arn:aws:iam::xxxxxx:role/some-role
125
127
  ROLE_ARN: /^arn:aws:iam::\d{12}:role\/.+/,
126
128
  // Stage setup pattern. Can be stage@stage-name:setup
127
- STAGE_SETUP_PATTERN: /^stage@([\w-]+):setup$/
129
+ STAGE_SETUP_PATTERN: /^(?:PR-\d+:)?stage@([\w-]+):setup$/,
130
+ // Stage teardown pattern. Can be stage@stage-name:teardown
131
+ STAGE_TEARDOWN_PATTERN: /^(?:PR-\d+:)?stage@([\w-]+):teardown$/
128
132
  };
@@ -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}jobs`;
7
+
8
+ module.exports = {
9
+ up: async (queryInterface, Sequelize) => {
10
+ await queryInterface.sequelize.transaction(async transaction => {
11
+ await queryInterface.addColumn(
12
+ table,
13
+ 'sha',
14
+ {
15
+ type: Sequelize.STRING(40)
16
+ },
17
+ { transaction }
18
+ );
19
+ });
20
+ }
21
+ };
package/models/job.js CHANGED
@@ -44,7 +44,14 @@ const MODEL = {
44
44
 
45
45
  archived: Joi.boolean().description('Flag if the job is archived').example(true).default(false),
46
46
 
47
- templateId: Joi.number().integer().positive().description("Identifier for this job's template").example(123345)
47
+ templateId: Joi.number().integer().positive().description("Identifier for this job's template").example(123345),
48
+
49
+ sha: Joi.string()
50
+ .hex()
51
+ .length(40)
52
+ .optional()
53
+ .description('SHA this job was built on')
54
+ .example('ccc49349d3cffbd12ea9e3d41521480b4aa5de5f')
48
55
  };
49
56
 
50
57
  const EXTENDED_MODEL = {
@@ -98,7 +105,8 @@ module.exports = {
98
105
  'title',
99
106
  'createTime',
100
107
  'url',
101
- 'userProfile'
108
+ 'userProfile',
109
+ 'sha'
102
110
  ]
103
111
  )
104
112
  ).label('Get Job'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "25.6.0",
3
+ "version": "25.8.0",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {