I need to run a step on a push event OR on a promote event with one specific target (dev). I do not want the step to run on a promote event with any other target e.g. sit.
I have tried:
- name: on_push_or_promote_to_dev
image: alpine:latest
commands:
- echo "Running on push or promote to dev"
when:
event:
- push
- promote
target:
- dev
However, this only runs when I promote dev
. The step does not run on a push event.
I have tried various combinations using include
and exclude
conditions on both the event and target conditions.
The only thing I have found that works is the following:
- name: on_push_or_promote_to_dev
image: alpine:latest
commands:
- echo "Running on push or promote to dev"
when:
event:
include:
- push
- promote
target:
exclude:
- sit
- staging
- production
- every_other_target_in_the_drone_file
- etc
Clearly, having to exclude every other promotion target is not a particularly great thing.
I’m sure there has to be a better way! What am I missing?