Skip to content

repositories: match on any url with the expected Alpine release version

clayton craft requested to merge alpine_repo_fix into master

Most Alpine mirrors are in the format alpine/vXX.YY, but not all. I hit this situation when upgrading to 23.12, the Alpine mirror I am using is https://mirror.math.princeton.edu/pub/alpinelinux. After this script ran it was still using the 3.18 repo when it should have been using 3.19. A quick survey of mirrors.alpinelinux.org shows that a few mirrors are like this, and there are even some mirrors that are hosted on subdomains with no path (e.g. http://alpine.mirror.far.fi)

Matching on the version will fix this for any mirror with a "non-standard" repo path. It's also not great being less specific when matching, but it seems reasonable to assume if there's a match for an Alpine version on a line in /etc/apk/repositories then it's probably an Alpine mirror and not a pmOS one.

Merge request reports