Skip to content

Commit

Permalink
feat(circleciconfig): extend the schema of the requires stanza
Browse files Browse the repository at this point in the history
  • Loading branch information
briceicle committed Nov 27, 2024
1 parent 6b6a375 commit 8ae8569
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/negative_test/circleciconfig/invalid-workflow-job-requires.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# yaml-language-server: $schema=../../schemas/json/circleciconfig.json
version: 2.1

workflows:
test-workflow:
jobs:
- foo
- bar:
requires:
- foo: invalid_job_status
32 changes: 31 additions & 1 deletion src/schemas/json/circleciconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,37 @@
"description": "Jobs are run in parallel by default, so you must explicitly require any dependencies by their job name.",
"type": "array",
"items": {
"type": "string"
"oneOf": [
{
"description": "A dependency defined by their job name.",
"type": "string"
},
{
"description": "A dependency defined by their job name, and required statuses.",
"type": "object",
"minProperties": 1,
"maxProperties": 1,
"patternProperties": {
"^[A-Za-z][A-Za-z\\s\\d_-]*$": {
"oneOf": [
{
"description": "A status that the job must have to satisfy the dependency.",
"type": "string",
"enum": ["success", "failed", "canceled"]
},
{
"description": "A list of statuses that the job must have one of to satisfy the dependency.",
"type": "array",
"minLength": 1,
"items": {
"type": "string",
"enum": ["success", "failed", "canceled"]
}
}
]
}}
}
]
}
},
"name": {
Expand Down
16 changes: 16 additions & 0 deletions src/test/circleciconfig/workflow-job-requires.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# yaml-language-server: $schema=../../schemas/json/circleciconfig.json
version: 2.1

workflows:
test-workflow:
jobs:
- foo
- bar
- baz
- qux:
requires:
- foo
- bar: failed
- baz:
- success
- canceled

0 comments on commit 8ae8569

Please sign in to comment.