From 2a0b753691f326154436fa641287e6336c19d80e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 13 Jun 2025 03:48:03 +0300 Subject: [PATCH] Use Azure mirrors of Ubuntu .deb repositories in containers. This reduces the likelihood of spurious CI failures caused by DDoS filters being triggered by massive numbers of concurrent CI jobs. --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 730f81b..6b85fb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -324,6 +324,22 @@ jobs: echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV if [ -f "/etc/debian_version" ] then + # Use Azure APT mirrors in containers to avoid HTTP errors due to DDoS filters triggered by lots of CI jobs launching concurrently. + # Note that not all Ubuntu versions support "mirror+file:..." URIs in APT sources, so just use Azure mirrors exclusively. + # Note also that on recent Ubuntu versions DEB822 format is used for source files. + APT_SOURCES=() + if [ -d "/etc/apt/sources.list.d" ] + then + readarray -t APT_SOURCES < <(find "/etc/apt/sources.list.d" -type f -name '*.sources' -print) + fi + if [ -f "/etc/apt/sources.list" ] + then + APT_SOURCES+=("/etc/apt/sources.list") + fi + if [ "${#APT_SOURCES[@]}" -gt 0 ] + then + sed -i -E -e 's!([^ ]+) (http|https)://(archive|security)\.ubuntu\.com/ubuntu[^ ]*(.*)!\1 http://azure.archive.ubuntu.com/ubuntu/\4!' "${APT_SOURCES[@]}" + fi apt-get -o Acquire::Retries=$NET_RETRY_COUNT update if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] then