Skip to content

Commit 686553d

Browse files
committed
ci: add a check for clock drift
Recently we encountered multiple spurious failures where the crates.io certificate was reported as expired, even though it's currently due to expire in a few months. This adds some code to our CI to check for clock drifts, to possibly find the cause or rule out a bad VM clock.
1 parent 60960a2 commit 686553d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/ci/run.sh

+15
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ if [ "$RUST_RELEASE_CHANNEL" = "nightly" ] || [ "$DIST_REQUIRE_ALL_TOOLS" = "" ]
7878
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-missing-tools"
7979
fi
8080

81+
# Print the date from the local machine and the date from an external source to
82+
# check for clock drifts. An HTTP URL is used instead of HTTPS since on Azure
83+
# Pipelines it happened that the certificates were marked as expired.
84+
datecheck() {
85+
echo "== clock drift check =="
86+
echo -n " local time: "
87+
date
88+
echo -n " network time: "
89+
curl -fs --head http://detectportal.firefox.com/success.txt | grep ^Date: \
90+
| sed 's/Date: //g' || true
91+
echo "== end clock drift check =="
92+
}
93+
datecheck
94+
trap datecheck EXIT
95+
8196
# We've had problems in the past of shell scripts leaking fds into the sccache
8297
# server (#48192) which causes Cargo to erroneously think that a build script
8398
# hasn't finished yet. Try to solve that problem by starting a very long-lived

0 commit comments

Comments
 (0)