Skip to content

Commit adda1cb

Browse files
ehussMark-Simulacrum
authored andcommitted
Update CI and toolstate docs.
1 parent fac142c commit adda1cb

File tree

2 files changed

+56
-63
lines changed

2 files changed

+56
-63
lines changed

src/infra/docs/rustc-ci.md

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Which jobs we run
44

5-
The `rust-lang/rust` repository uses Azure Pipelines to test [all the other
5+
The `rust-lang/rust` repository uses GitHub Actions to test [all the other
66
platforms][platforms] we support. We currently have two kinds of jobs running
77
for each commit we want to merge to master:
88

@@ -26,14 +26,14 @@ platform’s custom Docker container. This has a lot of advantages for us:
2626
underlying image (switching from the trusty image to xenial was painless for
2727
us).
2828
- We can use ancient build environments to ensure maximum binary compatibility,
29-
for example [using CentOS 5][dist-x86_64-linux] on our Linux builders.
29+
for example [using CentOS 7][dist-x86_64-linux] on our Linux builders.
3030
- We can avoid reinstalling tools (like QEMU or the Android emulator) every
3131
time thanks to Docker image caching.
3232
- Users can run the same tests in the same environment locally by just running
3333
`src/ci/docker/run.sh image-name`, which is awesome to debug failures.
3434

3535
We also run tests for less common architectures (mainly Tier 2 and Tier 3
36-
platforms) on Azure Pipelines. Since those platforms are not x86 we either run
36+
platforms) in CI. Since those platforms are not x86 we either run
3737
everything inside QEMU or just cross-compile if we don’t want to run the tests
3838
for that platform.
3939

@@ -63,10 +63,10 @@ Since the merge commit is based on the latest master and only one can be tested
6363
at the same time, when the results are green master is fast-forwarded to that
6464
merge commit.
6565

66-
Unfortunately testing a single PR at the time, combined with our long CI (~3.5
66+
Unfortunately testing a single PR at the time, combined with our long CI (~3
6767
hours for a full run), means we can’t merge too many PRs in a single day, and a
6868
single failure greatly impacts our throughput for the day. The maximum number
69-
of PRs we can merge in a day is 7.
69+
of PRs we can merge in a day is around 8.
7070

7171
[bors]: https://github.com/bors
7272
[homu]: https://github.com/rust-lang/homu
@@ -96,31 +96,26 @@ same time, even if there is a normal PR in progress.
9696

9797
## Which branches we test
9898

99-
Our builders are defined in `src/ci/azure-pipelines/`, and they depend on the
100-
branch used for the build. Each job is configured in one of the top `.yml`
101-
files.
99+
Our builders are defined in [`src/ci/github-actions/ci.yml`].
100+
101+
[`src/ci/github-actions/ci.yml`]: https://github.com/rust-lang/rust/blob/master/src/ci/github-actions/ci.yml
102102

103103
### PR builds
104104

105105
All the commits pushed in a PR run a limited set of tests: a job containing a
106106
bunch of lints plus a cross-compile check build to Windows mingw (without
107-
producing any artifacts) and the `x86_64-gnu-llvm-6.0` non-dist builder. Those
107+
producing any artifacts) and the `x86_64-gnu-llvm-13` non-dist builder. Those
108108
two builders are enough to catch most of the common errors introduced in a PR,
109109
but they don’t cover other platforms at all. Unfortunately it would take too
110110
many resources to run the full test suite for each commit on every PR.
111111

112-
Additionally, if the PR changes submodules the `x86_64-gnu-tools` non-dist
112+
Additionally, if the PR changes certain tools, the `x86_64-gnu-tools` non-dist
113113
builder is run.
114114

115115
### The `try` branch
116116

117-
On the main rust repo try builds produce just a Linux toolchain. Builds on
118-
those branches run a job containing the lint builder and both the dist and
119-
non-dist builders for `linux-x86_64`. Usually we don’t need `try` builds for
120-
other platforms, but on the rare cases when this is needed we just add a
121-
temporary commit that changes the `src/ci/azure-pipelines/try.yml` file to
122-
enable the builders we need on that platform (disabling Linux to avoid wasting
123-
CI resources).
117+
On the main rust repo, `try` builds produce just a Linux toolchain using the
118+
`dist-x86_64-linux` image.
124119

125120
### The `auto` branch
126121

@@ -138,23 +133,19 @@ below).
138133
### Other branches
139134

140135
Other branches are just disabled and don’t run any kind of builds, since all
141-
the in-progress branches will eventually be tested in a PR. We try to encourage
142-
contributors to create branches on their own fork, but there is no way for us
143-
to disable that.
136+
the in-progress branches will eventually be tested in a PR.
144137

145138
## Caching
146139

147-
The main rust repository doesn’t use the native Azure Pipelines caching tools.
140+
The main rust repository doesn’t use the native GitHub Actions caching tools.
148141
All our caching is uploaded to an S3 bucket we control
149142
(`rust-lang-ci-sccache2`), and it’s used mainly for two things:
150143

151144
### Docker images caching
152145

153146
The Docker images we use to run most of the Linux-based builders take a *long*
154-
time to fully build: every time we need to build them (for example when the CI
155-
scripts change) we consistently reach the build timeout, forcing us to retry
156-
the merge. To avoid the timeouts we cache the exported images on the S3 bucket
157-
(with `docker save`/`docker load`).
147+
time to fully build. To speed up the build, we cache the exported images on the
148+
S3 bucket (with `docker save`/`docker load`).
158149

159150
Since we test multiple, diverged branches (`master`, `beta` and `stable`) we
160151
can’t rely on a single cache for the images, otherwise builds on a branch would
@@ -175,17 +166,6 @@ we do with our S3 bucket.
175166

176167
During the years we developed some custom tooling to improve our CI experience.
177168

178-
### Cancelbot to keep the queue short
179-
180-
We have limited CI capacity on Azure Pipelines, and while that’s enough for a
181-
single build we can’t run more than one at the time. Unfortunately when a job
182-
fails the other jobs on the same build will continue to run, limiting the
183-
available capacity. To avoid the issue we have a tool called [cancelbot] that
184-
runs in cron every 2 minutes and kills all the jobs not related to a running
185-
build through the API.
186-
187-
[cancelbot]: https://github.com/rust-lang/rust-central-station/tree/master/cancelbot
188-
189169
### Rust Log Analyzer to show the error message in PRs
190170

191171
The build logs for `rust-lang/rust` are huge, and it’s not practical to find
@@ -204,19 +184,18 @@ saw before.
204184

205185
### Toolstate to support allowed failures
206186

207-
The `rust-lang/rust` repo doesn’t only test the compiler on its CI, but also
208-
all the tools distributed through rustup (like miri). Since
209-
those tools rely on the compiler internals (which don’t have any kind of
210-
stability guarantee) they often break after the compiler code is changed.
187+
The `rust-lang/rust` repo doesn’t only test the compiler on its CI, but also a
188+
variety of tools and documentation. Some documentation is pulled in via git
189+
submodules. If we blocked merging rustc PRs on the documentation being fixed,
190+
we would be stuck in a chicken-and-egg problem, because the documentation's CI
191+
would not pass since updating it would need the not-yet-merged version of
192+
rustc to test against (and we usually require CI to be passing).
211193

212-
If we blocked merging rustc PRs on the tools being fixed we would be stuck in a
213-
chicken-and-egg problem, because the tools need the new rustc to be fixed but
214-
we can’t merge the rustc change until the tools are fixed. To avoid the problem
215-
most of the tools are allowed to fail, and their status is recorded in
216-
[rust-toolstate]. When a tool breaks a bot automatically pings the tool authors
217-
so they know about the breakage, and it records the failure on the toolstate
218-
repository. The release process will then ignore broken tools on nightly,
219-
removing them from the shipped nightlies.
194+
To avoid the problem, submodules are allowed to fail, and their status is
195+
recorded in [rust-toolstate]. When a submodule breaks, a bot automatically
196+
pings the maintainers so they know about the breakage, and it records the
197+
failure on the toolstate repository. The release process will then ignore
198+
broken tools on nightly, removing them from the shipped nightlies.
220199

221200
While tool failures are allowed most of the time, they’re automatically
222201
forbidden a week before a release: we don’t care if tools are broken on nightly
@@ -226,4 +205,4 @@ few days before we promote nightly to beta.
226205
More information is available in the [toolstate documentation].
227206

228207
[rust-toolstate]: https://rust-lang-nursery.github.io/rust-toolstate
229-
[toolstate documentation]: https://forge.rust-lang.org/infra/toolstate.html
208+
[toolstate documentation]: ../toolstate.md

src/infra/toolstate.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
# Handling of tools embedded in the rustc repo ("toolstate")
22

3-
The Rust repository contains several external tools and documents as git
4-
submodules (e.g. miri, the [Book], the [Reference]). Some of those are
5-
very tightly coupled to the compiler and depend on internal APIs that change all
6-
the time, but they are not actually essential to get the compiler itself to
7-
work. To make API changes less painful, these tools are allowed to "break"
8-
temporarily. PRs can still land and nightlies still get released even when some
9-
tools are broken. Their current status is managed by the
10-
[toolstate system][toolstate]. (Cargo is not subject to the toolstate system and
11-
instead just has to always work.)
12-
13-
The three possible states of a "tool" (this includes the documentation managed
14-
by the toolstate system, where we run doctests) are: `test-pass`, `test-fail`,
3+
The Rust repository contains several external git submodules (e.g. the [Book],
4+
the [Reference]). The [toolstate system][toolstate] is used to allow these
5+
submodules to be in a broken state, except for beta releases.
6+
7+
This is necessary because the documentation is tested both on the
8+
`rust-lang/rust` CI, and on the CI of the documentation repo. If there is a
9+
change to `rustc` that breaks the documentation, it would not be possible to
10+
update the documentation since the not-yet-merged version of rustc that breaks
11+
it doesn't exist, yet. We usually require CI to be in a passing state in both
12+
repos.
13+
14+
The toolstate system solves this problem by temporarily allowing the
15+
documentation to be in a "failing" state on `rust-lang/rust`. When the tests
16+
start failing, the maintainers of the submodule will be notified. They will
17+
then be responsible for getting it fixed.
18+
19+
The three possible states of a "tool" are: `test-pass`, `test-fail`,
1520
`build-fail`.
1621

1722
This page gives a rough overview how the toolstate system works, and what the
1823
rules are for when which tools are (not) allowed to break.
1924

25+
> **Note**: Historically, the toolstate system was used for managing tools
26+
> that were closely coupled with the compiler (like rustfmt or miri). However,
27+
> those have since been transitioned to use git subtrees instead, so that
28+
> those tools must always pass their tests, and any failures must be resolved
29+
> within the PR that breaks them.
30+
>
31+
> This document uses the term "tool", but as of this writing, the only thing
32+
> tracked is external documentation.
33+
2034
## Toolstate Rules
2135

2236
* For all tools, if a PR changes that tool (if it changes the commit used by the
@@ -32,7 +46,7 @@ rules are for when which tools are (not) allowed to break.
3246
happening.)
3347

3448
At the time of writing, the following tools are "nightly only":
35-
miri, embedded-book.
49+
embedded-book.
3650

3751
## Updating the toolstate repository
3852

@@ -57,7 +71,7 @@ Tools can be updated by updating the submodule to the proper commit.
5771
Run `git submodule update --remote path/to/submodule`, add the updates, make
5872
sure the tests pass, commit, and send a pull request. The path is from the
5973
root of the rust repository, so for example, the reference is
60-
`src/doc/reference` and miri is `src/tools/miri`.
74+
`src/doc/reference`.
6175

6276
While not required, [subup] may assist you with this.
6377

0 commit comments

Comments
 (0)