Skip to content

Commit 4ade365

Browse files
authored
fix(ci): add fallback Ubuntu package mirrors (#9864)
1 parent 57a6b70 commit 4ade365

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Setup APT mirrors
2+
description: Configure Ubuntu package downloads with automatic mirror failover.
3+
runs:
4+
using: composite
5+
steps:
6+
- shell: bash
7+
run: |
8+
# Replace the existing Blacksmith mirror list as well as direct sources.
9+
printf '%s\tpriority:%s\n' \
10+
https://archive.ubuntu.com/ubuntu 1 \
11+
https://mirrors.edge.kernel.org/ubuntu 2 \
12+
https://mirror.math.princeton.edu/pub/ubuntu 3 \
13+
| sudo tee /etc/apt/blacksmith-ubuntu-mirrors.txt > /dev/null
14+
15+
# APT's mirror transport retries each file against the next server.
16+
sudo find /etc/apt -maxdepth 2 -type f \( -name '*.list' -o -name '*.sources' \) \
17+
-exec sed -i -E \
18+
's#https?://(([^/]+\.)?archive|security)\.ubuntu\.com/ubuntu/?#mirror+file:/etc/apt/blacksmith-ubuntu-mirrors.txt#g' {} +
19+
20+
# Move on to a fallback before an unreachable server exhausts the job.
21+
printf '%s\n' 'Acquire::http::Timeout "15";' 'Acquire::https::Timeout "15";' \
22+
| sudo tee /etc/apt/apt.conf.d/80-mirror-timeouts > /dev/null

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
- name: Typecheck
5252
run: vpr typecheck
5353

54+
- uses: ./.github/actions/setup-apt-mirrors
55+
5456
- name: Install browser secret helper build libraries
5557
run: |
5658
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
@@ -90,6 +92,8 @@ jobs:
9092
- name: Ensure Electron runtime is installed
9193
run: vp run --filter @t3tools/desktop ensure:electron
9294

95+
- uses: ./.github/actions/setup-apt-mirrors
96+
9397
- name: Install browser secret helper build libraries
9498
run: |
9599
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources

‎.github/workflows/release.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ jobs:
216216
- name: Typecheck
217217
run: vp run typecheck
218218

219+
- uses: ./.github/actions/setup-apt-mirrors
220+
219221
- name: Install browser secret helper build libraries
220222
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
221223

@@ -527,6 +529,9 @@ jobs:
527529
exit $code
528530
}
529531
532+
- uses: ./.github/actions/setup-apt-mirrors
533+
if: matrix.platform == 'linux'
534+
530535
- name: Install Linux desktop build libraries
531536
if: matrix.platform == 'linux'
532537
shell: bash

0 commit comments

Comments
 (0)