Conditions can be used to limit pipeline step execution at runtime. For example, you may want to limit step execution by branch:
|
|
You can use wildcard matching in your conditions. Note that conditions use glob pattern matching, not regular expressions.
|
|
You can also combine multiple conditions. Note that all conditions must evaluate to true when combining multiple conditions.
|
|
By Branch
The branch condition limits step execution based on the git branch. Please note that the target branch is evaluated for pull requests; and branch names are not available for tag events.
|
|
Example include syntax:
|
|
Example exclude syntax:
|
|
By Event
The event condition limits step execution based on the drone event type. This can be helpful when you want to limit steps based on push, pull request, tag and more.
|
|
Example include syntax:
|
|
Example exclude syntax:
|
|
By Reference
The reference condition limits step execution based on the git reference name. This can be helpful when you want to glob match branch or tag names.
|
|
Example include syntax:
|
|
Example exclude syntax:
|
|
By Repository
The repository condition limits step execution based on repository name. This can be useful when Drone is enabled for a repository and its forks, and you want to limit execution accordingly.
|
|
Example include syntax:
|
|
Example exclude syntax:
|
|
Example using wildcard matching:
|
|
By Instance
The instance condition limits step execution based on the Drone instance hostname. This can be useful if you have multiple Drone instances configured for a single repository, sharing the same yaml file, and want to limit steps by instance.
|
|
Example include syntax:
|
|
Example exclude syntax:
|
|
Example using wildcard matching:
|
|
By Status
The status condition limits step execution based on the pipeline status. For example, you may want to configure Slack notification only on failure.
|
|
Execute a step on failure:
|
|
Execute a step on success or failure:
|
|
The following configuration is redundant. The default behavior is for pipeline steps to only execute when the pipeline is in a passing state.
|
|
By Target
The target condition limits step execution based on the target deployment environment. This only applies to promotion and rollback events.
|
|
Example include syntax:
|
|
Example exclude syntax:
|
|
By Cron
The cron condition limits step execution based on the cron name that triggered the pipeline. This only applies to cron events.
|
|
Example include syntax:
|
|
Example exclude syntax:
|
|