Is there a way to trigger Travis CI build for repository X each time there's a push to repository Y? Specifically, I want my builds to start each time there's a push to http://github.com/tensorflow/tensorflow
Trigger Travis CI builds using the API V3 by sending a POST request to /repo/{slug|id}/requests : Get an API token from your Travis CI settings page. You'll need the token to authenticate most of these API requests.
Travis CI supports parallel testing. It can also be integrated with tools like Slack, HipChat, Email, etc. and get notifications if the build is unsuccessful. Developers can speed up their test suites by executing multiple builds in parallel, across different virtual machines.
Coveralls is a hosted analysis tool, providing statistics about your code coverage. Configuring your Travis CI build to send results to Coveralls always follows the same pattern: Add your repository to Coveralls.
Good question! Here are some solutions that I could think of:
If you have admin privileges on the repo (or know someone who does), you could create a webhook that subscribes to the push
event and when triggered, start a build on Travis CI using the Travis API.
This would entail:
Creating a new GitHub webhook over on http://github.com/tensorflow/tensorflow/settings/hooks/new. While of course, customizing the settings as you see fit, but with the information I have, I recommend using the application/json
content type and only have GitHub trigger the webhook with the push
event.
Write a small web app expecting the HTTP POST payloads from GitHub and start builds using Travis CI's API. This web app can be written in any language but it must be deployed to somewhere that is always awake and listening (to prevent missing builds).
Here's my example of that.
post "/push-webhook" do
uri = URI.parse("https://api.travis-ci.org/repo/your-org/your-repo/requests")
request = Net::HTTP::Get.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Travis-API-Version"] = "3"
request["Authorization"] = "token your-token"
body = { "request" => { "branch" => "master" } }
request.body = body.to_json
response = http.request(request)
end
Helpful documentation
However, if you do not have admin privileges on the repo, you could create a mirror of repository that is in your control and then follow the instructions above (with a few differences). From the little research I did, it's not possible (or at least not easy) to create a mirror of a repository all on GitHub without admin access of the original/official repository.
With that said, I found a workaround that should work.
Import tensorflow/tensorflow
to GitLab and use the Mirror Repository feature so it mirrors http://github.com/tensorflow/tensorflow as your GitLab repo's upstream.
From there, follow the instructions above as normal except use GitLab's webhook API instead of GitHub's to send push events to trigger our web app to start builds on Travis CI.
Helpful documentation
I hope this information was helpful. Please let me know if you have any other questions and I'd be happy to help in any way I can. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With