Skip to content

CI: drop the slow Azure apt mirror after a failed try (#101) - #102

Merged
compot-dev merged 2 commits into
masterfrom
ci-apt-mirror
Oct 23, 2026
Merged

compot-dev merged 2 commits into
masterfrom
ci-apt-mirror

Conversation

@compot-dev

Copy link
Copy Markdown
Collaborator

Fixes #101.

The runners' apt sources use mirror+file:/etc/apt/apt-mirrors.txt, Azure's mirror first. apt moves to the next mirror only when a download fails, not when it is slow, so every retry from #96 went back to the same slow mirror (PR #100, run 39974354242: Wine smoke / x86_64 got 4 MB of 109 MB in 15 minutes).

  • In Install MinGW and Install Wine, after a failed or timed-out try: if /etc/apt/apt-mirrors.txt has the Azure mirror and another one, the Azure line is removed and the new list printed; the next try takes archive.ubuntu.com and resumes the partial downloads.

Checked in ubuntu:24.04 set up like a runner (sources on mirror+file:/etc/apt/apt-mirrors.txt; Azure first, priority 1, pointed at an address that does not answer; archive.ubuntu.com priority 2), with the Install MinGW script from the workflow (try timeout shortened to 25 s): try 1 times out on Azure, the list becomes archive.ubuntu.com only, try 2 downloads from it and installs gcc-mingw-w64-i686-win32; the step passes in 32 s.

CI only: no-release.

…archive.ubuntu.com (#101)

The runners' apt sources use mirror+file:/etc/apt/apt-mirrors.txt with
Azure's mirror first; apt moves to the next only when a download fails,
not when it is slow, so every retry went to the same mirror (PR #100:
4 MB of 109 MB in 15 minutes). After a failed or timed-out try the
Azure line is removed (once, only if another mirror is left) and the
list printed; partial downloads resume on the next mirror.
@compot-dev compot-dev added the no-release Changes the build or the code without changing the binaries: no new version, no release label Oct 23, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

CI: Switch apt mirrors after a failed installation attempt

🐞 Bug fix ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Prevent MinGW and Wine installation retries from returning to a slow Azure mirror.
• Remove Azure only when another mirror remains, preserving a source for the next attempt.
Diagram

graph TD
  mingw["Install MinGW"] --> apt["Apt attempt"] -->|retryable failure| recovery["Repair dpkg"] --> guard{"Azure and fallback?"} -->|yes| drop["Remove Azure"] -->|retry| apt
  wine["Install Wine"] --> apt
  guard -->|no change| apt
Loading
High-Level Assessment

The guarded mirror-list change fits the existing apt retry loops and addresses slow downloads that apt's failure-based mirror fallback does not handle. It also avoids removing the only available mirror.

Files changed (1) +16 / -0

Bug fix (1) +16 / -0
build.ymlFail over from Azure between apt retries +16/-0

Fail over from Azure between apt retries

• Adds the same guarded mirror-list change to the Install MinGW and Install Wine retry loops. After a failed or timed-out attempt, each loop removes Azure entries only when another mirror remains, then prints the resulting list before retrying.

.github/workflows/build.yml

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Retries can run without a mirror ✓ Resolved
Description
Both apt_try failover guards count every line without azure.archive as an alternative mirror,
including blank and comment lines. When the list contains only an Azure entry plus those lines, the
guards allow Azure to be deleted, leaving the next MinGW or Wine retry with no usable mirror.
Code

.github/workflows/build.yml[R316-318]

+              if grep -q 'azure\.archive' "$M" 2>/dev/null &&
+                 [ "$(grep -vc 'azure\.archive' "$M")" -gt 0 ]; then
+                sudo sed -i '/azure\.archive/d' "$M"
Evidence
Both added guards use grep -vc 'azure\.archive', which counts all nonmatching lines rather than
active mirror entries. The following command deletes Azure-matching lines before the same apt_try
functions retry apt-get, so a blank or comment line can satisfy the guard without leaving a usable
mirror.

Switch apt mirrors after a failed or timed-out CI attempt
.github/workflows/build.yml[316-318]
.github/workflows/build.yml[301-327]
.github/workflows/build.yml[399-422]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Both failover guards can count blank or comment lines as alternative mirrors and remove the only usable Azure entry before retrying.
## Fix Focus Areas
- .github/workflows/build.yml[315-319]
- .github/workflows/build.yml[412-416]
## Recommended Fix
In both retry blocks, filter out blank lines and comments and check for an active non-Azure mirror URL before deleting Azure entries. Leave the list unchanged when no valid fallback remains, and print the resulting list before retrying.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread .github/workflows/build.yml
@compot-dev

Copy link
Copy Markdown
Collaborator Author

/review

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit caa06c1

@compot-dev
compot-dev merged commit 825d7f4 into master Oct 23, 2026
17 checks passed
@compot-dev
compot-dev deleted the ci-apt-mirror branch October 23, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Changes the build or the code without changing the binaries: no new version, no release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: apt retries keep using the slow Azure mirror

1 participant