Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Drone to scheduled builds #2111

Closed
DblK opened this issue Jul 12, 2017 · 7 comments
Closed

Allow Drone to scheduled builds #2111

DblK opened this issue Jul 12, 2017 · 7 comments

Comments

@DblK
Copy link

DblK commented Jul 12, 2017

I would like to have the opportunity to schedule a build let's say every night to build a canary version a release it.

This feature should be something like cron job with timezone and target a branch.
I would like also to be able to have severals schedule builds.

@bradrydzewski
Copy link

@tcarreon
Copy link

link

duplicate of #1525 and #287

also see http:https://readme.drone.io/questions/how-to-schedule-builds/

link is broken - Page Not Found

@bradrydzewski
Copy link

That link is outdated which is why it was removed. Drone 1.0 has native cron capabilities. Go to your repository settings screen and you will see options to schedule cron jobs, including a nightly option.

@twpedersen
Copy link

twpedersen commented Jan 25, 2020

The cron scheduler does not seem to respect the TZ environment variable, so the "daily" schedule ends up being "midnight at UTC", is this expected?

Alternately, the drone cron cli could support https://godoc.org/github.com/robfig/cron#hdr-Time_zones:

$ drone cron add $repo nightly "CRON_TZ=America/Los_Angeles 0 0 0 * * *"
client error 400: {"message":"Invalid Cronjob Expression"}

@bradrydzewski
Copy link

bradrydzewski commented Jan 25, 2020

The cron scheduler does not seem to respect the TZ environment variable, so the "daily" schedule ends up being "midnight at UTC", is this expected?

Yes, this is the expected behavior since Drone uses unix timestamps and UTC times throughout the codebase. The ability to handle different timezeones was considered out of scope for our initial cron implementation.

Alternately, the drone cron cli could support https://godoc.org/github.com/robfig/cron#hdr-Time_zones:

We only use the Parse function to parse the cron expression and calculate the next execution time. We would therefore not be able to use cron.New since we do not use the *Cron strucutre in our codebase (by design).

We might be able to cast the parsed cron expression to SpecSchedule and then set the Location to the appropriate time zone, if provided.

@bradrydzewski
Copy link

UPDATE

I did some more research and it looks like the CRON_TZ feature was added to this library a few months after we implemented cron in Drone. We are using a snapshot of the library from May 2018 and the CRON_TZ feature was added in Feb 2019. Updating to a newer version of the library may allow you to take advantage of CRON_TZ without any code changes to Drone itself.

@twpedersen
Copy link

@bradrydzewski thanks for the response! I'll try to give this a go if time allows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants