screwdriver-data-schema 23.3.2 → 23.4.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/base.js CHANGED
@@ -77,7 +77,7 @@ const SCHEMA_CONFIG_PRE_TEMPLATE_MERGE = Joi.object()
77
77
  annotations: Annotations.annotations,
78
78
  jobs: Joi.when('template', {
79
79
  is: Joi.exist(),
80
- then: Joi.object().pattern(Job.jobName, ALLOWED_JOB_FIELDS_WITH_PIPELINE_TEMPLATE).unknown(false),
80
+ then: SCHEMA_JOBS.optional(),
81
81
  otherwise: SCHEMA_JOBS.required()
82
82
  }),
83
83
  shared: Joi.when('template', {
@@ -113,6 +113,7 @@ const SCHEMA_CONFIG_POST_TEMPLATE_MERGE = Joi.object()
113
113
  * @type {Object}
114
114
  */
115
115
  module.exports = {
116
+ allowedJobFieldsWithPipelineTemplate: ALLOWED_JOB_FIELDS_WITH_PIPELINE_TEMPLATE,
116
117
  jobs: SCHEMA_JOBS,
117
118
  shared: SCHEMA_SHARED,
118
119
  prChain: SCHEMA_PR_CHAIN, // This is still used by pipeline schema.
package/config/regex.js CHANGED
@@ -51,6 +51,8 @@ module.exports = {
51
51
  INTERNAL_TRIGGER: /^~([\w-]+)$/,
52
52
  // Stages can only be named with A-Z,a-z,0-9,-,_
53
53
  STAGE_NAME: /^[\w-]+$/,
54
+ // Stage name prefixed with @stage. Ex: stage@prod
55
+ QUALIFIED_STAGE_NAME: /^stage@([\w-]+)$/,
54
56
  // Stage trigger like ~stage@deploy or ~stage@stageName:jobName or stage@deploy or stage@stageName:jobName
55
57
  STAGE_TRIGGER: /^~?stage@([\w-]+)(?::([\w-]+))?$/,
56
58
  // Don't combine EXTERNAL_TRIGGER and EXTERNAL_TRIGGER_AND for backward compatibility
package/models/event.js CHANGED
@@ -10,6 +10,7 @@ const parentBuildId = require('./build').get.extract('parentBuildId');
10
10
  const parentBuilds = require('./build').get.extract('parentBuilds');
11
11
  const buildId = require('./build').get.extract('id');
12
12
  const prNum = Scm.hook.extract('prNum');
13
+ const { QUALIFIED_STAGE_NAME } = require('../config/regex');
13
14
 
14
15
  const MODEL = {
15
16
  id: Joi.number().integer().positive().description('Identifier of this event').example(123345),
@@ -48,7 +49,7 @@ const MODEL = {
48
49
  .description('SHA of the configuration pipeline this project depends on')
49
50
  .example('ccc49349d3cffbd12ea9e3d41521480b4aa5de5f'),
50
51
  startFrom: Joi.alternatives()
51
- .try(trigger, jobName)
52
+ .try(trigger, jobName, QUALIFIED_STAGE_NAME)
52
53
  .description('Event start point - a job name or trigger name (~commit/~pr)')
53
54
  .example('~commit'),
54
55
  type: Joi.string().valid('pr', 'pipeline').max(10).description('Type of the event').example('pr'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "23.3.2",
3
+ "version": "23.4.0",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {