Description
Our CI builders (except macOS and Windows) use Docker, and we'll cache the Docker repository on Travis. Thanks to the cache, normally the docker build
command only takes a few seconds to complete. However, when the cache is invalidated for whatever reason, the Docker image will need to be actually built, and this may take a very long time.
Recently this happened with #49246 — the Docker image cache of dist-x86_64-linux alt
became stale and thus needs to be built from scratch. One of the step involves compiling GCC. The whole docker build
command thus takes over 40 minutes. Worse, the alt
builders have assertions enabled, and thus all stage1+ rustc
invocations are slower than their normal counterpart. Together, it is impossible to complete within 3 hours. Travis will not update the cache unless the build is successful. Therefore, I need to exclude RLS, Rustfmt and Clippy from the distribution, to ensure the job is passing.
I don't think we should entirely rely on Travis's cache for speed. Ideally, the docker build
command should at most spend 10 minutes, assuming good network speed (~2 MB/s on Travis) and reasonable CPU performance (~2.3 GHz × 4 CPUs on Travis).
In the dist-x86_64-linux alt
case, if we host the precompiled GCC 4.8.5 for Centos 5, we could have trimmed 32 minutes out of the Docker build time, which allows us to complete the build without removing anything.