Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Drone Cron Job Not Firing

I’ve created a cron job in Drone CI using the following command

drone cron add --branch master "foo/bar" "every-5-mins" "0 */5 * * * *"

And when I look in the UI, I can see the cron job has been created. However, it doesn’t fire, even though I have it defined in my drone yaml file.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

- name: cron-job
  pull: if-not-exists
  image: foo-image
  commands:
    - *random
    - echo "I am testing a cron job"
  when: &cron-demo
    event:
      - cron
    cron:
      - every-5-mins

Does something else need to be done to get it to work on schedule?

And also, is there a way to manually trigger a cron job? I can’t seem to find anything in the docs.

>Solution :

You might find this helpful.

https://docs.drone.io/api/cron/cron_trigger/

Basically, what you need is something like this.

curl -X POST -H "Authorization: Bearer $DRONE_TOKEN" "$DRONE_SERVER/api/repos/foo/bar/cron/every-5-mins"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading