You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/architecture/step-registry.md
+75-1Lines changed: 75 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -316,10 +316,14 @@ In this example, the `ci-operator` configuration simply specifies the desired cl
316
316
example for the [`Workflow`](#workflow) section above.
317
317
318
318
Since the `ci-operator` configuration and workflows share the same fields, it is possible to override fields specified in a workflow.
319
-
In cases where both the workflow and a `ci-operator` configuration specify the same field, the `ci-operator` configuration’s field has
319
+
In cases where both the workflow and a `ci-operator` configuration specify the same field, the `ci-operator` configuration's field has
320
320
priority (i.e. the value from the `ci-operator` configuration is used). List and mapping fields have a few special rules, described
321
321
in the [hierarchical propagation](#hierarchical-propagation) section.
322
322
323
+
{{< alert title="Important" color="info" >}}
324
+
**Restriction on `pre` and `post` Step Overrides**: By default, tests cannot override `pre` and `post` steps defined in workflows to prevent accidental resource leaks. If you need to override these steps, you must explicitly set `allow_pre_post_step_overrides: true`. See [Overriding pre and post Step Definitions](#overriding-pre-and-post-step-definitions) for more details.
325
+
{{< /alert >}}
326
+
323
327
Example of a `ci-operator` configuration that overrides a workflow field:
324
328
325
329
{{< highlight yaml >}}
@@ -352,6 +356,76 @@ tests:
352
356
353
357
## Options to Change Control Flow
354
358
359
+
### Overriding `pre` and `post` Step Definitions
360
+
361
+
By default, `ci-operator` prevents tests from overriding the `pre` and `post` step definitions that are specified in a workflow. This is a safety measure to prevent accidental resource leaks that could occur when setup steps (in `pre`) or cleanup steps (in `post`) are unintentionally modified or removed.
362
+
363
+
To explicitly allow overriding of `pre` and `post` steps when using a workflow, the `allow_pre_post_step_overrides` field must be set to `true` in the test configuration. Without this flag, attempts to override `pre` or `post` steps will result in a validation error.
364
+
365
+
{{< alert title="Warning" color="warning" >}}
366
+
Overriding `pre` or `post` steps can lead to resource leaks if setup or cleanup operations are not performed correctly. Only override these steps if you fully understand the implications and have verified that all necessary setup and cleanup operations are still performed.
367
+
{{< /alert >}}
368
+
369
+
Example of allowing `pre` and `post` step overrides:
pre: # this overrides the pre steps from the workflow
379
+
- ref: custom-cluster-setup
380
+
post: # this overrides the post steps from the workflow
381
+
- ref: custom-cluster-cleanup
382
+
{{< / highlight >}}
383
+
384
+
Without the `allow_pre_post_step_overrides: true` setting, the above configuration would fail validation. When this flag is set to `true`, the test takes full responsibility for ensuring proper resource management.
385
+
386
+
#### Examples
387
+
388
+
**Attempting to override without the flag (this will fail validation):**
389
+
390
+
{{< highlight yaml >}}
391
+
tests:
392
+
- as: e2e-bad-example
393
+
steps:
394
+
cluster_profile: aws
395
+
workflow: ipi-aws
396
+
post: # ERROR: This will fail validation
397
+
- ref: custom-cleanup # because allow_pre_post_step_overrides is not set
398
+
{{< / highlight >}}
399
+
400
+
**Correctly overriding with explicit permission:**
401
+
402
+
{{< highlight yaml >}}
403
+
tests:
404
+
- as: e2e-good-example
405
+
steps:
406
+
allow_pre_post_step_overrides: true
407
+
cluster_profile: aws
408
+
workflow: ipi-aws
409
+
pre: # OK: Overrides pre steps from ipi-aws workflow
410
+
- ref: custom-pre-setup
411
+
- chain: modified-install
412
+
post: # OK: Overrides post steps from ipi-aws workflow
413
+
- ref: gather-custom-artifacts
414
+
- chain: modified-deprovision
415
+
{{< / highlight >}}
416
+
417
+
**Overriding only test steps (no flag needed):**
418
+
419
+
{{< highlight yaml >}}
420
+
tests:
421
+
- as: e2e-test-only
422
+
steps:
423
+
cluster_profile: aws
424
+
workflow: ipi-aws
425
+
test: # OK: test step overrides don't require the flag
426
+
- ref: custom-e2e-test
427
+
{{< / highlight >}}
428
+
355
429
### Skipping `post` Steps On Success
356
430
357
431
`ci-operator` can be configured to skip some or all `post` steps when all `test` steps pass. Skipping a `post` step when all tests have
0 commit comments