Skip to content

builders: Add apt_mirror support for Ubuntu images#71

Merged
apaolillo merged 1 commit into
mainfrom
mirrors
Apr 17, 2026
Merged

builders: Add apt_mirror support for Ubuntu images#71
apaolillo merged 1 commit into
mainfrom
mirrors

Conversation

@apaolillo

Copy link
Copy Markdown
Owner

Introduce an optional apt_mirror parameter to get_user_builder() and get_min_user_builder() to allow overriding the default archive.ubuntu.com mirror before the first apt-get update.

Add a reusable switch_apt_mirror() helper that updates APT sources in both DEB822 (ubuntu.sources) and legacy (sources.list) formats. The helper intentionally leaves security.ubuntu.com untouched so security updates continue to come from Canonical.

This is particularly useful when the default mirror is slow or under incident. A common configuration is
mirror://mirrors.ubuntu.com/mirrors.txt for automatic geographic selection.

The mirror switch is applied early in the builder lifecycle to ensure all subsequent package operations benefit from it.

Introduce an optional `apt_mirror` parameter to `get_user_builder()`
and `get_min_user_builder()` to allow overriding the default
`archive.ubuntu.com` mirror before the first `apt-get update`.

Add a reusable `switch_apt_mirror()` helper that updates APT sources
in both DEB822 (`ubuntu.sources`) and legacy (`sources.list`) formats.
The helper intentionally leaves `security.ubuntu.com` untouched so
security updates continue to come from Canonical.

This is particularly useful when the default mirror is slow or under
incident. A common configuration is
`mirror://mirrors.ubuntu.com/mirrors.txt` for automatic geographic
selection.

The mirror switch is applied early in the builder lifecycle to ensure
all subsequent package operations benefit from it.

Signed-off-by: Antonio Paolillo <apaolill@gmail.com>
@apaolillo apaolillo requested a review from EstAK April 17, 2026 09:17
@apaolillo apaolillo self-assigned this Apr 17, 2026
@apaolillo apaolillo merged commit 1f94832 into main Apr 17, 2026
5 checks passed
@apaolillo apaolillo deleted the mirrors branch April 17, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants