Skip to content

Add mirror fallback for Debian cloud image downloads#23

Open
thrix wants to merge 1 commit into
mainfrom
debian-mirror-fallback
Open

Add mirror fallback for Debian cloud image downloads#23
thrix wants to merge 1 commit into
mainfrom
debian-mirror-fallback

Conversation

@thrix
Copy link
Copy Markdown
Contributor

@thrix thrix commented May 20, 2026

cloud.debian.org has no CDN and causes intermittent download failures in CI. Switch primary mirror to cdimage.debian.org and keep cloud.debian.org as fallback.

DEBIAN_IMG_URL now accepts either a string (backwards compatible) or a list of URL templates (priority-ordered mirrors). If the primary mirror exhausts all retries, the next mirror in the list is tried with the same retry logic.

Also fixes a pre-existing bug where calling get_debian_image_url() with arch=aarch64 permanently mutated config_data.DEBIAN_IMG_URL (replacing genericcloud with generic), corrupting subsequent x86_64 URL generation within the same process.

Assisted-by: Claude Code

`cloud.debian.org` has no CDN and causes intermittent download failures
in CI. Switch primary mirror to `cdimage.debian.org` and keep
`cloud.debian.org` as fallback.

`DEBIAN_IMG_URL` now accepts either a string (backwards compatible) or a
list of URL templates (priority-ordered mirrors). If the primary mirror
exhausts all retries, the next mirror in the list is tried with the same
retry logic.

Also fixes a pre-existing bug where calling `get_debian_image_url()` with
`arch=aarch64` permanently mutated `config_data.DEBIAN_IMG_URL` (replacing
`genericcloud` with `generic`), corrupting subsequent x86_64 URL
generation within the same process.

Assisted-by: Claude Code
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>


def get_debian_image_url(version: str, arch: str) -> str:
def get_debian_image_url(version: str, arch: str) -> list[str]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth it to have fallback mechanism though? What exactly is it meant to catch during the fallback, that it the cdn is slow, that it is unreachable?

And on top of that we only treat Debian as such a special snowflake?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

felt like a more safer approach, just in case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also it might be more sources in the future for images would be needed, so decided to go this way, it is up for dicussion

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also it might be more sources in the future for images would be needed

Would want a clear definition of what issues are being caught for the fallback and a generalization for the others as well.

For example, if a connection is slow but still responsive, then we do not address the original issue for this, we just introduce a more niche way that it could fail that is harder to find out or debug.

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