How to use cron triggers in drone in addition to step conditions?

Viewed 855

Say I have this drone.yaml file:

kind: pipeline
type: kubernetes
name: default

  - name: echo-hello
    image: alpine
    commands:
      - echo "hello"
    when:
      event:
        - push

  - name: echo-goodbye
    image: alpine
    commands:
      - echo "goodbye"
    when:
      event:
        - push

In addition to triggering the echo-hello and echo-goodbye step upon each push, I'd like to trigger all steps based on a cron event. I thought adding the trigger section to the bottom of the yaml file would do the trick:

trigger:
  event:
    - cron
  cron:
    - hourly 

But then, it ignores the conditions defined beneath when in the dedicated steps. Can anybody help me fixing my drone.yaml file, so that I can trigger by cron in addition to the step specific conditions?

1 Answers

Trigger mean that this whole pipeline will run only when cron runs it. You should add

event: 
  - cron
cron:
  - hourly 

to when: for each section.

Related