Travis CI cron jobs work similarly to the cron utilty, they run builds at regular scheduled intervals independently of whether any commits were pushed to the repository. Cron jobs always fetch the most recent commit on a particular branch and build the project at that state. Cron jobs can run
monthly, which in practice means up to an hour after the selected time span, and you cannot set them to run at a specific time.
Cron job builds use the same notification settings as normal push builds, and you can skip them in the same way
Configure cron jobs from the “Cron Jobs” settings tab on your Travis CI page.
If your API or cron triggered builds run on the same commit or branch over and over again, you will notice GitHub have a limit of 1000 status updates per commit, which causes the Travis CI build status displayed on GitHub to be incorrect. Avoid this problem by specifying a regularly updated branch for your automated builds.
Adding Cron Jobs #
Select the branch to run the build on, how often to run the build, and whether to run the build if there was a build in the last 24 hours, then click “Add”:
Confirm that the cron job is displayed in your settings tab:
Skipping Cron Jobs #
Because cron jobs build the latest commit to a particular branch, if that commit message includes the skip command the cron job will skip that build.
Deleting Cron Jobs #
Click the small trash icon on the right hand side of the page:
Detecting Builds Triggered by Cron #
To check whether a build was triggered by cron, examine the
TRAVIS_EVENT_TYPE environment variable to see if it has the value