What problem does it solve?
Sometimes we specify dependencies as "compatible" versions rather than fixed ones because we like to have all the security fixes and minor changes from our dependency maintainers without releasing our projects over and over again. But sometimes it happens that one of our dependency introduces a breaking change by accident and we must know about it. So, for that this small script was created that just restarts specified Travis builds in some interval to make sure our app/library are still working even if its dependencies have changed.
What does it do?
This is a Docker image that you can configure and run in any environment. Running container does following:
- Restarts last builds for a specified list of projects on Travis
- Checks if the last build was started recently and in this case does not touch it
- Uses your personal token on Github for authentication on Travis
This is written in bare bash therefore the image size is small as possible.
The script requires following environment variables defined:
- GITHUB_TOKEN - your personal GitHub token, that you can generate in Settings->Personal Acess Tokens->Generate new token. Needed scopes are: "read:org", "user:email", "repo:deployment", "repo:status", "write:repo_hook". It's a requirement from Travis.
- REPO_SLUGS - a slug is a
johndoe/coole-repo. The variable should contain a list of these slugs separated by comma (
,). A last build of each slug mentioned on the list will be restarted unless it already happened recently
- RESTART_INTERVAL - (hours, 0-23, used in crontab like */$RESTART_INTERVAL) the interval when to restart the builds
- TIME_SINCE_LAST_BUILD - (hours) the period of time after a build finished and is assumed to be recent
sudo docker run -d \ -e GITHUB_TOKEN='catsruletheworld' \ -e REPO_SLUGS='catberry/catberry,catberry/catberry-todomvc' \ -e RESTART_INTERVAL='24' \ -e TIME_SINCE_LAST_BUILD='12' \ --name travis-restart pragmader/travis-restart