Skip to content

fix: fallbacks on current archive if old release not moved yet - #313

Merged
niemeyer merged 4 commits into
canonical:mainfrom
upils:fix/old-releases-not-moved
Sep 21, 2026
Merged

niemeyer merged 4 commits into
canonical:mainfrom
upils:fix/old-releases-not-moved

Conversation

@upils

@upils upils commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator
  • Have you signed the CLA?

When an Ubuntu release passes its end-of-life date, Chisel routes to old-releases.ubuntu.com. However, the physical migration of the suite to that mirror is a manual admin operation that can lag the scheduled EOL — so for recently-EOL releases (e.g. 25.04, 25.10), old-releases returns 404 and archive.Open fails, blocking rootfs cuts.

archiveURL became candidateArchiveURLs, returning the base URLs to try in order of preference (old-releases first, current archive as fallback for old releases). openUbuntu now attempts a full open against each candidate, falling back only on a missing release (404) — auth, network or signature errors still fail immediately, so a broken archive is never masked. The index-opening flow was extracted into ubuntuArchive.setupIndexes so it can be retried per candidate without duplicate downloads: the winning candidate's InRelease fetch is the one used going forward.

Fix #312

Signed-off-by: Paul Mars <paul.mars@canonical.com>
@upils upils added the Simple Nice for a quick look on a minute or two label Jul 22, 2026

@niemeyer niemeyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs some work so it's a bit more polished as well.

Comment thread internal/archive/archive.go Outdated
}

func archiveURL(pro, arch string, oldRelease bool) (string, *credentials, error) {
func archiveURL(pro, arch string, oldRelease bool) (string, string, *credentials, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's please make this a []string, and implement the feature in terms of it being fallback URLs, first one wins.

The function also needs a comment explaining this, in either new implementation. It's not just an archiveURL anymore, which is what it says on the tin.

Also, as a hint for the future: when results are naked like this (string, string), they need names so that we can tell what they are at a glimpse.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I renamed, documented and changed the signature of the function. I think the candidateArchiveURLs better convey to the caller that they must then pick one from the list and not use all of the entries.

Thanks for the hint.

Comment thread internal/archive/archive.go Outdated
}
_, err := probe.fetch(probe.distPath("InRelease"), "", fetchDefault)
if err == errNotFound {
archive.baseURL = fallbackURL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems quite hackish. Look at the logic below.. where is "InRelease"?

Let's please implement an elegant fallback mechanism using the abstractions and respecting the encapsulations we already have.

@niemeyer niemeyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great job, Paul.

// archive. For such releases both archives are returned, so that the
// caller can fall back to the regular one when the release is not found
// in the old-releases one.
func candidateArchiveURLs(pro, arch string, oldRelease bool) ([]string, *credentials, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much nicer, thanks.

}
err := archive.setupIndexes()
if err == errNotFound {
// Release not in this archive, try the next candidate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is not required, as the code is literally spelling it out:

The Indexes were errNotFound, so continue to the next candidates' baseURL.

@niemeyer
niemeyer merged commit 519479e into canonical:main Sep 21, 2026
19 checks passed
@ROCKsBot

Copy link
Copy Markdown
Command Mean [s] Min [s] Max [s] Relative
BASE 8.291 ± 0.238 8.018 8.645 1.00
HEAD 9.031 ± 0.254 8.643 9.326 1.09 ± 0.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Simple Nice for a quick look on a minute or two

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(25.10): chisel cut failing for 25.10

3 participants