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