File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -327,6 +327,22 @@ jobs:
327327 echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV
328328 if [ -f "/etc/debian_version" ]
329329 then
330+ # Use Azure APT mirrors in containers to avoid HTTP errors due to DDoS filters triggered by lots of CI jobs launching concurrently.
331+ # Note that not all Ubuntu versions support "mirror+file:..." URIs in APT sources, so just use Azure mirrors exclusively.
332+ # Note also that on recent Ubuntu versions DEB822 format is used for source files.
333+ APT_SOURCES=()
334+ if [ -d "/etc/apt/sources.list.d" ]
335+ then
336+ readarray -t APT_SOURCES < <(find "/etc/apt/sources.list.d" -type f -name '*.sources' -print)
337+ fi
338+ if [ -f "/etc/apt/sources.list" ]
339+ then
340+ APT_SOURCES+=("/etc/apt/sources.list")
341+ fi
342+ if [ "${#APT_SOURCES[@]}" -gt 0 ]
343+ then
344+ sed -i -E -e 's!([^ ]+) (http|https)://(archive|security)\.ubuntu\.com/ubuntu[^ ]*(.*)!\1 http://azure.archive.ubuntu.com/ubuntu/\4!' "${APT_SOURCES[@]}"
345+ fi
330346 apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
331347 if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ]
332348 then
You can’t perform that action at this time.
0 commit comments