about summary refs log tree commit diff
path: root/src/ci
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-11-19 13:10:09 +0100
committerGitHub <noreply@github.com>2019-11-19 13:10:09 +0100
commit49077c59a81cb1361bb41a8197cf5499d54677f0 (patch)
treeb68aec61bba9338987c3712aff778dd637f0c292 /src/ci
parent2cad8bb659066b42fc518c95def384956126bd3f (diff)
parent85132b20c4b3f6858ea273ec276c4ad9162603f8 (diff)
downloadrust-49077c59a81cb1361bb41a8197cf5499d54677f0.tar.gz
rust-49077c59a81cb1361bb41a8197cf5499d54677f0.zip
Rollup merge of #66090 - pietroalbini:ci-improvements, r=alexcrichton
Misc CI improvements

This PR contains some misc improvements to our CI configuration:

* The environment variables for MinGW builders were greatly simplified, with just `CUSTOM_MINGW=1` to tell the install scripts to install the vendored copy. All the others (`MINGW_URL`, `MINGW_DIR`, `MINGW_ARCHIVE` and `MSYS_BITS`) are detected either from the builder name or the environment.
* Collecting CPU stats and running the build were moved into scripts.
* Toolstate scripts validation was previously a separate step, ran just when `IMAGE=mingw-check`. This moves the validation code inside the actual image.
* Vendored copies are now fetched from https://ci-mirrors.rust-lang.org instead of directly from the bucket.

r? @alexcrichton
Diffstat (limited to 'src/ci')
-rw-r--r--src/ci/azure-pipelines/auto.yml41
-rw-r--r--src/ci/azure-pipelines/steps/run.yml55
-rw-r--r--src/ci/azure-pipelines/try.yml1
-rw-r--r--src/ci/docker/armhf-gnu/Dockerfile2
-rw-r--r--src/ci/docker/dist-armv7-linux/crosstool-ng.sh2
-rwxr-xr-xsrc/ci/docker/dist-various-1/install-mips-musl.sh2
-rwxr-xr-xsrc/ci/docker/dist-various-1/install-mipsel-musl.sh2
-rwxr-xr-xsrc/ci/docker/dist-various-2/build-wasi-toolchain.sh2
-rwxr-xr-xsrc/ci/docker/dist-x86_64-linux/build-curl.sh3
-rwxr-xr-xsrc/ci/docker/dist-x86_64-linux/build-openssl.sh4
-rwxr-xr-xsrc/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh2
-rw-r--r--src/ci/docker/mingw-check/Dockerfile5
-rwxr-xr-xsrc/ci/docker/mingw-check/validate-toolstate.sh19
-rwxr-xr-xsrc/ci/docker/scripts/freebsd-toolchain.sh2
-rw-r--r--src/ci/docker/scripts/sccache.sh2
-rwxr-xr-xsrc/ci/scripts/collect-cpu-stats.sh9
-rwxr-xr-xsrc/ci/scripts/install-clang.sh2
-rwxr-xr-xsrc/ci/scripts/install-mingw.sh37
-rwxr-xr-xsrc/ci/scripts/run-build-from-ci.sh21
-rw-r--r--src/ci/shared.sh2
20 files changed, 114 insertions, 101 deletions
diff --git a/src/ci/azure-pipelines/auto.yml b/src/ci/azure-pipelines/auto.yml
index 836f81a7816..946eb483c29 100644
--- a/src/ci/azure-pipelines/auto.yml
+++ b/src/ci/azure-pipelines/auto.yml
@@ -223,25 +223,21 @@ jobs:
     matrix:
       # 32/64 bit MSVC tests
       x86_64-msvc-1:
-        MSYS_BITS: 64
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
         SCRIPT: make ci-subset-1
         # FIXME(#59637)
         NO_DEBUG_ASSERTIONS: 1
         NO_LLVM_ASSERTIONS: 1
       x86_64-msvc-2:
-        MSYS_BITS: 64
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
         SCRIPT: make ci-subset-2
       i686-msvc-1:
-        MSYS_BITS: 32
         RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
         SCRIPT: make ci-subset-1
         # FIXME(#59637)
         NO_DEBUG_ASSERTIONS: 1
         NO_LLVM_ASSERTIONS: 1
       i686-msvc-2:
-        MSYS_BITS: 32
         RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
         SCRIPT: make ci-subset-2
         # FIXME(#59637)
@@ -249,11 +245,9 @@ jobs:
         NO_LLVM_ASSERTIONS: 1
       # MSVC aux tests
       x86_64-msvc-aux:
-        MSYS_BITS: 64
         RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
       x86_64-msvc-cargo:
-        MSYS_BITS: 64
         SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
         VCVARS_BAT: vcvars64.bat
@@ -262,10 +256,8 @@ jobs:
         NO_LLVM_ASSERTIONS: 1
       # MSVC tools tests
       x86_64-msvc-tools:
-        MSYS_BITS: 64
         SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
-        DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
 
       # 32/64-bit MinGW builds.
       #
@@ -281,43 +273,30 @@ jobs:
       # came from the mingw-w64 SourceForge download site. Unfortunately
       # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
       i686-mingw-1:
-        MSYS_BITS: 32
         RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
         SCRIPT: make ci-mingw-subset-1
-        MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
-        MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
-        MINGW_DIR: mingw32
+        CUSTOM_MINGW: 1
         # FIXME(#59637)
         NO_DEBUG_ASSERTIONS: 1
         NO_LLVM_ASSERTIONS: 1
       i686-mingw-2:
-        MSYS_BITS: 32
         RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
         SCRIPT: make ci-mingw-subset-2
-        MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
-        MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
-        MINGW_DIR: mingw32
+        CUSTOM_MINGW: 1
       x86_64-mingw-1:
-        MSYS_BITS: 64
         SCRIPT: make ci-mingw-subset-1
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
-        MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
-        MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
-        MINGW_DIR: mingw64
+        CUSTOM_MINGW: 1
         # FIXME(#59637)
         NO_DEBUG_ASSERTIONS: 1
         NO_LLVM_ASSERTIONS: 1
       x86_64-mingw-2:
-        MSYS_BITS: 64
         SCRIPT: make ci-mingw-subset-2
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
-        MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
-        MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
-        MINGW_DIR: mingw64
+        CUSTOM_MINGW: 1
 
       # 32/64 bit MSVC and GNU deployment
       dist-x86_64-msvc:
-        MSYS_BITS: 64
         RUST_CONFIGURE_ARGS: >-
           --build=x86_64-pc-windows-msvc
           --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
@@ -327,7 +306,6 @@ jobs:
         DIST_REQUIRE_ALL_TOOLS: 1
         DEPLOY: 1
       dist-i686-msvc:
-        MSYS_BITS: 32
         RUST_CONFIGURE_ARGS: >-
           --build=i686-pc-windows-msvc
           --target=i586-pc-windows-msvc
@@ -337,27 +315,20 @@ jobs:
         DIST_REQUIRE_ALL_TOOLS: 1
         DEPLOY: 1
       dist-i686-mingw:
-        MSYS_BITS: 32
         RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
         SCRIPT: python x.py dist
-        MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
-        MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
-        MINGW_DIR: mingw32
+        CUSTOM_MINGW: 1
         DIST_REQUIRE_ALL_TOOLS: 1
         DEPLOY: 1
       dist-x86_64-mingw:
-        MSYS_BITS: 64
         SCRIPT: python x.py dist
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
-        MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
-        MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
-        MINGW_DIR: mingw64
+        CUSTOM_MINGW: 1
         DIST_REQUIRE_ALL_TOOLS: 1
         DEPLOY: 1
 
       # "alternate" deployment, see .travis.yml for more info
       dist-x86_64-msvc-alt:
-        MSYS_BITS: 64
         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
         SCRIPT: python x.py dist
         DEPLOY_ALT: 1
diff --git a/src/ci/azure-pipelines/steps/run.yml b/src/ci/azure-pipelines/steps/run.yml
index cef2d235602..214c11fd690 100644
--- a/src/ci/azure-pipelines/steps/run.yml
+++ b/src/ci/azure-pipelines/steps/run.yml
@@ -8,6 +8,13 @@
 
 steps:
 
+# Configure our CI_JOB_NAME variable which log analyzers can use for the main
+# step to see what's going on.
+- bash: |
+    builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
+    echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
+  displayName: Configure Job Name
+
 # Disable automatic line ending conversion, which is enabled by default on
 # Azure's Windows image. Having the conversion enabled caused regressions both
 # in our test suite (it broke miri tests) and in the ecosystem, since we
@@ -24,11 +31,8 @@ steps:
 - bash: src/ci/scripts/should-skip-this.sh
   displayName: Decide whether to run this job
 
-# Spawn a background process to collect CPU usage statistics which we'll upload
-# at the end of the build. See the comments in the script here for more
-# information.
-- bash: python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
-  displayName: "Collect CPU-usage statistics in the background"
+- bash: src/ci/scripts/collect-cpu-stats.sh
+  displayName: Collect CPU-usage statistics in the background
 
 - bash: src/ci/scripts/dump-environment.sh
   displayName: Show the current environment
@@ -135,48 +139,9 @@ steps:
   condition: and(succeeded(), not(variables.SKIP_JOB))
   displayName: Install awscli
 
-# Configure our CI_JOB_NAME variable which log analyzers can use for the main
-# step to see what's going on.
-- bash: |
-    builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
-    echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
-  displayName: Configure Job Name
-
-# As a quick smoke check on the otherwise very fast mingw-check linux builder
-# check our own internal scripts.
-- bash: |
-    set -e
-    git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
-    cd rust-toolstate
-    python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
-    # Only check maintainers if this build is supposed to publish toolstate.
-    # Builds that are not supposed to publish don't have the access token.
-    if [ -n "${TOOLSTATE_PUBLISH+is_set}" ]; then
-      TOOLSTATE_VALIDATE_MAINTAINERS_REPO=rust-lang/rust python2.7 "${BUILD_SOURCESDIRECTORY}/src/tools/publish_toolstate.py"
-    fi
-    cd ..
-    rm -rf rust-toolstate
-  env:
-    TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
-  condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
-  displayName: Verify the publish_toolstate script works
-
-- bash: |
-    set -e
-    # Remove any preexisting rustup installation since it can interfere
-    # with the cargotest step and its auto-detection of things like Clippy in
-    # the environment
-    rustup self uninstall -y || true
-    if [ "$IMAGE" = "" ]; then
-      src/ci/run.sh
-    else
-      src/ci/docker/run.sh $IMAGE
-    fi
-  #timeoutInMinutes: 180
+- bash: src/ci/scripts/run-build-from-ci.sh
   timeoutInMinutes: 600
   env:
-    CI: true
-    SRC: .
     AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID)
     AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY)
     TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
diff --git a/src/ci/azure-pipelines/try.yml b/src/ci/azure-pipelines/try.yml
index c919b1023a0..fe39ce3e241 100644
--- a/src/ci/azure-pipelines/try.yml
+++ b/src/ci/azure-pipelines/try.yml
@@ -72,7 +72,6 @@ jobs:
 #         DEPLOY: 1
 #
 #       dist-x86_64-msvc-alt:
-#         MSYS_BITS: 64
 #         RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
 #         SCRIPT: python x.py dist
 #         DEPLOY_ALT: 1
diff --git a/src/ci/docker/armhf-gnu/Dockerfile b/src/ci/docker/armhf-gnu/Dockerfile
index 9493b336987..5373612279b 100644
--- a/src/ci/docker/armhf-gnu/Dockerfile
+++ b/src/ci/docker/armhf-gnu/Dockerfile
@@ -72,7 +72,7 @@ RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
 
 # TODO: What is this?!
 # Source of the file: https://github.com/vfdev-5/qemu-rpi2-vexpress/raw/master/vexpress-v2p-ca15-tc1.dtb
-RUN curl -O https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/vexpress-v2p-ca15-tc1.dtb
+RUN curl -O https://ci-mirrors.rust-lang.org/rustc/vexpress-v2p-ca15-tc1.dtb
 
 COPY scripts/sccache.sh /scripts/
 RUN sh /scripts/sccache.sh
diff --git a/src/ci/docker/dist-armv7-linux/crosstool-ng.sh b/src/ci/docker/dist-armv7-linux/crosstool-ng.sh
index ae737d9677d..fb067a79a5c 100644
--- a/src/ci/docker/dist-armv7-linux/crosstool-ng.sh
+++ b/src/ci/docker/dist-armv7-linux/crosstool-ng.sh
@@ -1,7 +1,7 @@
 set -ex
 
 # Mirrored from https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.24.0.tar.gz
-url="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/crosstool-ng-1.24.0.tar.gz"
+url="https://ci-mirrors.rust-lang.org/rustc/crosstool-ng-1.24.0.tar.gz"
 curl -Lf $url | tar xzf -
 cd crosstool-ng-crosstool-ng-1.24.0
 ./bootstrap
diff --git a/src/ci/docker/dist-various-1/install-mips-musl.sh b/src/ci/docker/dist-various-1/install-mips-musl.sh
index 29cfb5d9608..9584258d234 100755
--- a/src/ci/docker/dist-various-1/install-mips-musl.sh
+++ b/src/ci/docker/dist-various-1/install-mips-musl.sh
@@ -5,7 +5,7 @@ mkdir /usr/local/mips-linux-musl
 # originally from
 # https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/
 # OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2
-URL="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
+URL="https://ci-mirrors.rust-lang.org/rustc"
 FILE="OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2"
 curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mips-linux-musl --strip-components=2
 
diff --git a/src/ci/docker/dist-various-1/install-mipsel-musl.sh b/src/ci/docker/dist-various-1/install-mipsel-musl.sh
index de8c359d167..50a8e554b16 100755
--- a/src/ci/docker/dist-various-1/install-mipsel-musl.sh
+++ b/src/ci/docker/dist-various-1/install-mipsel-musl.sh
@@ -5,7 +5,7 @@ mkdir /usr/local/mipsel-linux-musl
 # Note that this originally came from:
 # https://downloads.openwrt.org/snapshots/trunk/malta/generic/
 # OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
-URL="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
+URL="https://ci-mirrors.rust-lang.org/rustc"
 FILE="OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2"
 curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
 
diff --git a/src/ci/docker/dist-various-2/build-wasi-toolchain.sh b/src/ci/docker/dist-various-2/build-wasi-toolchain.sh
index c63ea6facca..17aa78945cf 100755
--- a/src/ci/docker/dist-various-2/build-wasi-toolchain.sh
+++ b/src/ci/docker/dist-various-2/build-wasi-toolchain.sh
@@ -5,7 +5,7 @@
 set -ex
 
 # Originally from https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
-curl https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/clang%2Bllvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz | \
+curl https://ci-mirrors.rust-lang.org/rustc/clang%2Bllvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz | \
   tar xJf -
 export PATH=`pwd`/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04/bin:$PATH
 
diff --git a/src/ci/docker/dist-x86_64-linux/build-curl.sh b/src/ci/docker/dist-x86_64-linux/build-curl.sh
index 8200bbe2fdc..0c7eb5fdac9 100755
--- a/src/ci/docker/dist-x86_64-linux/build-curl.sh
+++ b/src/ci/docker/dist-x86_64-linux/build-curl.sh
@@ -5,6 +5,9 @@ source shared.sh
 
 VERSION=7.66.0
 
+# This needs to be downloaded directly from S3, it can't go through the CDN.
+# That's because the CDN is backed by CloudFront, which requires SNI and TLSv1
+# (without paying an absurd amount of money).
 curl https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/curl-$VERSION.tar.xz \
   | xz --decompress \
   | tar xf -
diff --git a/src/ci/docker/dist-x86_64-linux/build-openssl.sh b/src/ci/docker/dist-x86_64-linux/build-openssl.sh
index be8a6c93945..d8f6bdb51b8 100755
--- a/src/ci/docker/dist-x86_64-linux/build-openssl.sh
+++ b/src/ci/docker/dist-x86_64-linux/build-openssl.sh
@@ -4,6 +4,10 @@ set -ex
 source shared.sh
 
 VERSION=1.0.2k
+
+# This needs to be downloaded directly from S3, it can't go through the CDN.
+# That's because the CDN is backed by CloudFront, which requires SNI and TLSv1
+# (without paying an absurd amount of money).
 URL=https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/openssl-$VERSION.tar.gz
 
 curl $URL | tar xzf -
diff --git a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh
index 797f674b954..f8697c698b9 100755
--- a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh
+++ b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh
@@ -25,7 +25,7 @@ cd netbsd
 
 mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot
 
-URL=https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
+URL=https://ci-mirrors.rust-lang.org/rustc
 
 # Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz
 curl $URL/2018-03-01-netbsd-src.tgz | tar xzf -
diff --git a/src/ci/docker/mingw-check/Dockerfile b/src/ci/docker/mingw-check/Dockerfile
index 24e2dea4ca7..b2d96aed2a9 100644
--- a/src/ci/docker/mingw-check/Dockerfile
+++ b/src/ci/docker/mingw-check/Dockerfile
@@ -19,7 +19,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
 COPY scripts/sccache.sh /scripts/
 RUN sh /scripts/sccache.sh
 
+COPY mingw-check/validate-toolstate.sh /scripts/
+
 ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
 ENV SCRIPT python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \
            python2.7 ../x.py build --stage 0 src/tools/build-manifest && \
-           python2.7 ../x.py test --stage 0 src/tools/compiletest
+           python2.7 ../x.py test --stage 0 src/tools/compiletest && \
+           /scripts/validate-toolstate.sh
diff --git a/src/ci/docker/mingw-check/validate-toolstate.sh b/src/ci/docker/mingw-check/validate-toolstate.sh
new file mode 100755
index 00000000000..2ebf1d6d5ae
--- /dev/null
+++ b/src/ci/docker/mingw-check/validate-toolstate.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# A quick smoke test to make sure publish_tooolstate.py works.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+rm -rf rust-toolstate
+git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
+cd rust-toolstate
+python2.7 "../../src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" \
+    "$(git log --format=%s -n1 HEAD)" "" ""
+# Only check maintainers if this build is supposed to publish toolstate.
+# Builds that are not supposed to publish don't have the access token.
+if [ -n "${TOOLSTATE_PUBLISH+is_set}" ]; then
+  TOOLSTATE_VALIDATE_MAINTAINERS_REPO=rust-lang/rust python2.7 \
+      "../../src/tools/publish_toolstate.py"
+fi
+cd ..
+rm -rf rust-toolstate
diff --git a/src/ci/docker/scripts/freebsd-toolchain.sh b/src/ci/docker/scripts/freebsd-toolchain.sh
index 70155e770a9..5670e10be23 100755
--- a/src/ci/docker/scripts/freebsd-toolchain.sh
+++ b/src/ci/docker/scripts/freebsd-toolchain.sh
@@ -59,7 +59,7 @@ done
 
 # Originally downloaded from:
 # https://download.freebsd.org/ftp/releases/${freebsd_arch}/${freebsd_version}-RELEASE/base.txz
-URL=https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2019-04-04-freebsd-${freebsd_arch}-${freebsd_version}-RELEASE-base.txz
+URL=https://ci-mirrors.rust-lang.org/rustc/2019-04-04-freebsd-${freebsd_arch}-${freebsd_version}-RELEASE-base.txz
 curl "$URL" | tar xJf - -C "$sysroot" --wildcards "${files_to_extract[@]}"
 
 # Fix up absolute symlinks from the system image.  This can be removed
diff --git a/src/ci/docker/scripts/sccache.sh b/src/ci/docker/scripts/sccache.sh
index efeb0ed0d72..552afbfee7c 100644
--- a/src/ci/docker/scripts/sccache.sh
+++ b/src/ci/docker/scripts/sccache.sh
@@ -1,6 +1,6 @@
 set -ex
 
 curl -fo /usr/local/bin/sccache \
-  https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2018-04-02-sccache-x86_64-unknown-linux-musl
+  https://ci-mirrors.rust-lang.org/rustc/2018-04-02-sccache-x86_64-unknown-linux-musl
 
 chmod +x /usr/local/bin/sccache
diff --git a/src/ci/scripts/collect-cpu-stats.sh b/src/ci/scripts/collect-cpu-stats.sh
new file mode 100755
index 00000000000..08065431f98
--- /dev/null
+++ b/src/ci/scripts/collect-cpu-stats.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Spawn a background process to collect CPU usage statistics which we'll upload
+# at the end of the build. See the comments in the script here for more
+# information.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
diff --git a/src/ci/scripts/install-clang.sh b/src/ci/scripts/install-clang.sh
index b1e9bf92ca5..f0179994e8e 100755
--- a/src/ci/scripts/install-clang.sh
+++ b/src/ci/scripts/install-clang.sh
@@ -17,7 +17,7 @@ if isMacOS; then
     # Configure `AR` specifically so rustbuild doesn't try to infer it as
     # `clang-ar` by accident.
     ciCommandSetEnv AR "ar"
-elif isWindows && [[ -z ${MINGW_URL+x} ]]; then
+elif isWindows && [[ ${CUSTOM_MINGW-0} -ne 1 ]]; then
     # If we're compiling for MSVC then we, like most other distribution builders,
     # switch to clang as the compiler. This'll allow us eventually to enable LTO
     # amongst LLVM and rustc. Note that we only do this on MSVC as I don't think
diff --git a/src/ci/scripts/install-mingw.sh b/src/ci/scripts/install-mingw.sh
index b4e8b889f52..8b579587b9e 100755
--- a/src/ci/scripts/install-mingw.sh
+++ b/src/ci/scripts/install-mingw.sh
@@ -27,19 +27,38 @@ IFS=$'\n\t'
 
 source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
 
+MINGW_ARCHIVE_32="i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z"
+MINGW_ARCHIVE_64="x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z"
+
 if isWindows; then
-    if [[ -z "${MINGW_URL+x}" ]]; then
-        arch=i686
-        if [ "$MSYS_BITS" = "64" ]; then
-          arch=x86_64
-        fi
+    case "${CI_JOB_NAME}" in
+        *i686*)
+            bits=32
+            arch=i686
+            mingw_archive="${MINGW_ARCHIVE_32}"
+            ;;
+        *x86_64*)
+            bits=64
+            arch=x86_64
+            mingw_archive="${MINGW_ARCHIVE_64}"
+            ;;
+        *)
+            echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
+            echo "please tweak it to recognize the builder named '${CI_JOB_NAME}'"
+            exit 1
+            ;;
+    esac
+
+    if [[ "${CUSTOM_MINGW-0}" -ne 1 ]]; then
         pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake \
             mingw-w64-$arch-gcc mingw-w64-$arch-python2
-        ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/mingw${MSYS_BITS}/bin"
+        ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/mingw${bits}/bin"
     else
-        curl -o mingw.7z "${MINGW_URL}/${MINGW_ARCHIVE}"
+        mingw_dir="mingw${bits}"
+
+        curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
         7z x -y mingw.7z > /dev/null
-        curl -o "${MINGW_DIR}/bin/gdborig.exe" "${MINGW_URL}/2017-04-20-${MSYS_BITS}bit-gdborig.exe"
-        ciCommandAddPath "$(pwd)/${MINGW_DIR}/bin"
+        curl -o "${mingw_dir}/bin/gdborig.exe" "${MIRRORS_BASE}/2017-04-20-${bits}bit-gdborig.exe"
+        ciCommandAddPath "$(pwd)/${mingw_dir}/bin"
     fi
 fi
diff --git a/src/ci/scripts/run-build-from-ci.sh b/src/ci/scripts/run-build-from-ci.sh
new file mode 100755
index 00000000000..c02117f459d
--- /dev/null
+++ b/src/ci/scripts/run-build-from-ci.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# Start the CI build. You shouldn't run this locally: call either src/ci/run.sh
+# or src/ci/docker/run.sh instead.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+export CI="true"
+export SRC=.
+
+# Remove any preexisting rustup installation since it can interfere
+# with the cargotest step and its auto-detection of things like Clippy in
+# the environment
+rustup self uninstall -y || true
+if [ -z "${IMAGE+x}" ]; then
+    src/ci/run.sh
+else
+    src/ci/docker/run.sh "${IMAGE}"
+fi
diff --git a/src/ci/shared.sh b/src/ci/shared.sh
index 718a5379ae5..862ded0d5db 100644
--- a/src/ci/shared.sh
+++ b/src/ci/shared.sh
@@ -4,7 +4,7 @@
 # `source shared.sh`, hence the invalid shebang and not being
 # marked as an executable file in git.
 
-export MIRRORS_BASE="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
+export MIRRORS_BASE="https://ci-mirrors.rust-lang.org/rustc"
 
 # See http://unix.stackexchange.com/questions/82598
 # Duplicated in docker/dist-various-2/shared.sh