Create custom builds from the web UI
Let me tell you a secret: There is a way to create a build on Travis CI without pushing code to GitHub.
Intrigued? Read on!
Request Build API
The request build API has been around for quite some time. Originally part of our API v2 and available through the Travis CLI, we also ported the functionality over to our recently released v3 API.
You can find documentation in our user docs and in the developer docs.
The best is yet to come, though: using it from our web client!
In the web client
We’ve placed an additional button in the ‘More options’.
When you click it, a modal window appears that needs some input from you:
What branch should the build be created on? This defaults to the repository’s default branch.
Do you want a custom message? This will replace the commit message of the branch’s HEAD commit (that is what the new build will be based on). If you leave this empty Travis will use the original commit message.
And for the most exciting part: the config. This allows you to send along a custom config that we will merge with the existing config that Travis receives through the .travis.yml
file.
There are different merge modes available for how Travis should treat the new config information. We chose the default merge
mode for you, this means we will overwrite an existing config key with a new value if provided.
One thing to note: The config field takes YAML, so you can enter values just like you would in the regular .travis.yml
. It’s perfect for tinkering with your setup!
In case you enter keys or other stuff that doesn’t make sense to Travis: we’ll ignore it. So the worst case is that you build the same commit again with the same config under a different build number.
What happens to the request?
We’ll send along the build request and receive the request id. With that id we can ask for more information, for example if the request was accepted or rejected.
If the request was accepted we’ll redirect you directly to the fresh build.
In case there is an error you can consult the repository’s requests page which gives you more information.
And with this you’re done!
My Pull Request failed because of CI, will this fix it?
Well, not instantly. Changes you make in the config of a triggered build are not persisted in your .travis.yml
.
This means that the push build to the branch may pass with new config, but the PR build will not be re-triggered.
Making a PR pass with a not-persisted change would be cheating anyway ;)
How to go forward then? Once you found a config that makes the push build pass, commit that change as usual and push it to GitHub. This will create a new build on the branch based on the new commit and a PR build as well. If those pass you’re good to go!
What about triggering build on the Dashboard?
I’m glad you asked!
If you tried the Dashboard UI you may have noticed that there already was an option called Trigger build
available.
This is using the same API but with just the default values for the request.
We will replace the all-default version with the same modal-window I have discussed here shortly. Exciting!
That’s it, folks!
The days of pushing empty commits are over!
Have some feedback for us? We’ve opened a feedback issue in our beta features repository for you!