Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@
"description": "Whether to proceed with this step and further steps if a step named in the depends_on attribute fails",
"default": false
},
"envVarString": {
"type": "string",
"description": "An environment variable reference that will be substituted at runtime",
"pattern": "^\\$[A-Z_][A-Z0-9_]*$",
"examples": ["$PARALLELISM", "$NUMBER_OF_JOBS"]
},
"integerOrEnvVar": {
"oneOf": [
{
"type": "integer",
"description": "A literal integer value"
},
{
"$ref": "#/definitions/envVarString"
}
],
"description": "Either an integer value or an environment variable reference"
},
"image": {
"type": "string",
"description": "(Kubernetes stack only) The container image to use for this pipeline or step",
Expand Down Expand Up @@ -910,9 +928,9 @@
}
},
"parallelism": {
"type": "integer",
"$ref": "#/definitions/integerOrEnvVar",
"description": "The number of parallel jobs that will be created based on this step",
"examples": [42]
"examples": [42, "$PARALLELISM"]
},
"plugins": {
"anyOf": [
Expand Down
3 changes: 3 additions & 0 deletions test/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ describe("schema.json", function () {
it("should validate matrix", function () {
validate("matrix.yml");
});
it("should validate environment variables in parallelism field", function () {
validate("parallelism-env-vars.yml");
});

it("should verify groupStep.steps uses the same-ish items as root steps", function () {
const mainList = schema.properties.steps.items.anyOf;
Expand Down
16 changes: 16 additions & 0 deletions test/valid-pipelines/parallelism-env-vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
steps:
# Test parallelism with environment variable
- command: "echo 'Testing parallelism with env var'"
parallelism: $PARALLELISM

# Test parallelism with literal value
- command: "echo 'Testing parallelism with literal'"
parallelism: 5

# Test mixed usage (parallelism with env var, other properties with literals)
- command: "echo 'Testing mixed configuration'"
parallelism: $PARALLELISM
concurrency: 2
concurrency_group: "test-group"
timeout_in_minutes: 30
priority: 1