Post-step operations
Annotate your builds and run extra steps
Post-step operations are a set of optional predefined processes that can be configured on any step. These operations will be executed once the step has completed. The post-step operations allow you to annotate your builds, images, and pipelines with extra metadata or run other steps.
Result-aware post-step operations
You may execute post-step operations conditionally, based on the outcome of the step itself.
To execute operations only when the step has completed successfully, use on_success
:
To execute operations only when the step has failed, use on_fail
:
Result-agnostic post-step operations
You may execute post-step operations regardless of the outcome of the step itself.
To execute operations regardless of the result, use on_finish
:
Available Post-Step Operations
Example
Marking a Docker image with the results of unit tests:
Running other steps
If you want to run a different step in the pipeline when a step fails or succeeds, you need to use conditional execution of steps and the fail_fast
property. You can also use step hooks for dedicated post step actions.
In this example the step print_error_message
will only run if step run_tests
has failed.
See also advanced workflows.
Related articles
Conditional execution of steps
Working directories
Annotations in pipelines
Hooks in pipelines