- Feature Name: (irrelevant)
- Start Date: 2017-08-13
- RFC PR: (leave this empty)
- Rust Issue: (leave this empty)
Summary
Split .travis.yml into three, managed by bors, so that non-auto branches and PRs run with minimal number of builders.
Motivation
Currently each rust-lang/rust build runs 41 jobs, but outside of the bors testing branch (auto) only 1 job is
relevant. We use the ALLOW_PR and ALLOW_TRY environment variables to stop the irrelevant jobs, but still, those 40
jobs need to wake up to know they are not needed. These lead to:
- 40 slots in the queue being occupied for nothing (see rust-lang/rust#43797);
- Spurious red cross
on PR due to network issue (cannot clone the repo);
- Spurious red cross
on PR due to the VM just failed to start (happens mostly with Mac builds);
Ideally we should be able to specify that those 40 build-matrix entries can only run in the auto branch, but this
feature has been turned down by Travis. This pre-RFC proposes a
workaround by modifying how the build-bot merges the commits.
Guide-level explanation
Split .travis.yml into three
As suggested by Travis, we would create three .travis.yml files:
-
.travis.yml — used by normal PRs, and the master/beta/stable branch
-
.travis.auto.yml — used in the auto branch (for @bors r+)
-
.travis.try.yml — used in the try branch (for @bors try)
The normal .travis.yml will only run one job, the ALLOW_PR one. Similarly, .travis.try.yml will only run the
ALLOW_TRY one.
When one issues @bors r+, bors will rename .travis.auto.yml to .travis.yml on the auto branch, allowing Travis to
run all 41 jobs.
Modifying the auto branch structure
When bors begin to test a PR, it will reset the auto branch to point to the master branch (or beta/stable/etc),
and then create a merge commit with the PR.
(before this RFC)
master auto
-------A----------A+B
/
PR /
-------B---------
If the test is successful, bors will fast-forward master to the head of auto:
(before this RFC)
master
auto
-------A----------A+B
/
PR /
-------B---------
This RFC suggests to add one more commit after the merge commit:
(after this RFC)
master auto
-------A----------A+B-------C
/
PR /
-------B---------
The new commit “C” will only rename .travis.auto.yml to override .travis.yml.
// current:
$ git checkout auto
$ git reset --hard master
$ git merge --no-ff contributor/pr -m "Auto merge of #12345 ..."
// new additional:
$ git mv .travis.yml .travis.pr.yml
$ git mv .travis.auto.yml .travis.yml
$ git commit -m "Prepared #12345 for testing ..."
$ git push origin auto -f
After the test is successful, it will fast-forward master to auto^:
(after this RFC)
master auto
-------A----------A+B-------C
/
PR /
-------B---------
The head of the auto branch is then abandoned. When a new PR is tested, a new rename commit “E” is created:
(after this RFC)
(orphaned)
------C
/
master auto
-------A----------A+B-----A+B+D-----E
/
another PR /
-------D------------------
Reference-level explanation
(See the “Guide-level explanation”)
Drawbacks
-
Splitting the .travis.yml into three means the content may diverge in an incompatible way.
-
Implementing this does not increase the Travis capacity,
i.e. you still cannot add a proper a Redox builder without upgrading the Travis plan. It won’t reduce the actual
test time per PR (>2 hours) either.
-
Complicates maintenance of the CI configuration.
Rationale and Alternatives
Alternatives:
-
Instead of using 3 files, one could find a way to mark parts of .travis.yml to be included or excluded in the auto
and try branches.
-
Lobby Travis for reopening travis-ci/travis-ci#2778
.
Unresolved questions
None