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