Set 2 separate triggers for 1 pipeline

I have a pipeline and 2 conditions when I want to run it: 1.cron job, 2.push to some repo

condition 1:

event:
- cron
cron:
- nightly

condition 2:

  repo:
  - repo-name
  branch:
  - master
  event:
  - push

Could you please tell me if I can have one pipeline with these 2 triggers at the same time? (trigger if: condition1 OR condition2)

I’ve checked this doc (Triggers | Drone), however I’m confused by this phrase:
You can also combine multiple triggers. Note that all triggers must evaluate to true when combining multiple triggers.
does it mean that OR between 2 different conditions is not possible?

I have a similar need. I want to trigger a pipeline on:

  1. push to master
trigger:
  branch:
  - master
  event:
  - push

and also on:
2) pull to a branch with a name that starts with “release”, something like:

trigger:
  branch:
  - release*
  event:
  - pull

But if I write:

trigger:
  branch:
  - master
  - release*
  event:
  - push
  - pull

then the pipeline will run in more situations than I want.

How do we write a list of “combinations” of situations in which a pipeline should be executed?

Note: this kind of thing can sometimes be achieved by writing 2 “copies” of the pipeline. Give each copy mutually-exclusive sets of trigger conditions, so that both pipelines never both trigger in the same build. But one or the other will trigger when one of the sets of trigger conditions evaluates to true. That lets you write “independent” sets of trigger conditions.

See [tests-only] [full-ci] Adjust triggers for chat-notifications pipeline by phil-davis · Pull Request #4471 · owncloud/ocis · GitHub for example. (But I had a separate challenge with that, because I want something to trigger on “pull_request” from a branch like “release*”. But when drone processes a “pull_request” event it evaluates the branch the target branch of the pull request, not the source branch. So I am also thinking about that!

1 Like