dreamcat4/dh-trigger

:

: 6

A simple program to trigger dockerhub's automated builds. This is performed by enabling 'build triggers' on the setting of the target dockerhub repo, and obtaining it's 'trigger token'. Once you have the trigger token (an api key), then you can input into the dh-trigger program.

Trigger tokens are secured as chmod 0600 files sitting inside of a chmod 0700 subdirectory of the user's home folder. In the ~/.dh-trigger/ configuration folder.

The trigger command all will trigger all the tags (branches) of your repo simultaneously. However you may not wish for every one of them to be re-build every time. Then use one of the other trigger commands dh-trigger --help for more information.

It is necessary to make 2 cron lines for each command, as is shown above. To ensure the job will always execute on UTC time, irrespective of the 1 hour seasonal shift of your local daylight savings time. This is because even between machines within the same timezone, their can be a number of days when their local offsets are out of sync. Specifically, when one or more of those systems are based on busybox or ulibc. Then the seasonal change date has always been hardcoded and is never guaranteed to be consistent.

2nd example:

If your regular time is +0500 shift of UTC, and your seasonal time is +0600 shift of UTC. Then add +5 to all of the hours specified in above example. This means being run at 08:15am and 09:15am of your local time respectively. So your modified cron lines would then look like this:

But what if your computer does down or has technical problems? Then the scheduled build job will fail to get triggered.

Well since we have solved the time zone problem, we can just repeat the same steps above on other machines. And the same set of cron job(s) will trigger at the same times. Dockerhub will ignore any duplicate build requests. So long as they are all made within the same 5 minute window. Therefore, in addition to the timezone fix, be sure also that the system time on every machine is being kept in sync with ntpd. Otherwise there is likely to be a significant amount of clock drift.