Skip to content

Commit ffcceb2

Browse files
author
Alan Christie
committed
feat: Initial support for job 'replaces'
1 parent af72c20 commit ffcceb2

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

decoder/job-definition-schema.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ definitions:
8989
maxLength: 4096
9090
tests:
9191
$ref: '#/definitions/job-test'
92+
replaces:
93+
$ref: '#/definitions/replace-list'
9294
required:
9395
- name
9496
- version
@@ -328,6 +330,31 @@ definitions:
328330
maxLength: 63
329331
pattern: '^[a-z]([a-z0-9-]*[a-z0-9])?$'
330332

333+
# A 'replaces' object.
334+
# A job definition can include this 'replaces' list
335+
# to identify a Job (and collection) it replaces.
336+
# A job can replace more than one Job, but each jab that's replaced
337+
# must include the job and collection it belongs to.
338+
replace-list:
339+
type: array
340+
items:
341+
type: object
342+
additionalProperties: false
343+
properties:
344+
collection:
345+
type: string
346+
minLength: 1
347+
maxLength: 80
348+
pattern: '^[a-z]{1}[a-z0-9-]*$'
349+
job:
350+
type: string
351+
minLength: 1
352+
maxLength: 80
353+
pattern: '^[a-z]{1}[a-z0-9-]*$'
354+
required:
355+
- collection
356+
- job
357+
331358
# Test groups.
332359
# A list of groups that have a name and optional compose-file.
333360
test-groups:

tests/test_validate_job_schema.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,15 @@ def test_validate_test_run_groups_without_ordinal():
346346

347347
# Assert
348348
assert error == "'ordinal' is a required property"
349+
350+
351+
def test_validate_replaces():
352+
text: Dict[str, Any] = deepcopy(_MINIMAL)
353+
demo_job: Dict[str, Any] = text["jobs"]["demo"]
354+
demo_job["replaces"] = [{"collection": "test-collection", "job": "test-job"}]
355+
356+
# Act
357+
error = decoder.validate_job_schema(text)
358+
359+
# Assert
360+
assert error is None

0 commit comments

Comments
 (0)