lxc/lxc-ci

alpine template uses out-of-date mirror

melato opened this issue · 3 comments

I wanted to get an alpine 3.16.2 image, which is not available yet from images:alpine/3.16, so I built my own using distrobuilder.
The image I built was 3.16.1. I changed the source url
from: https://mirror.csclub.uwaterloo.ca/alpine/
to: https://dl-cdn.alpinelinux.org/alpine/
and I got a 3.16.2 image.

The mirror was changed on:
commit 3beaf12
Date: Wed Jul 6 13:39:31 2022 +0200

images/alpine: Update mirror

I suggest changing the source url to: https://dl-cdn.alpinelinux.org/alpine/ (note the "https" scheme)

Steps to reproduce

On a debian VM:

  • sudo snap install distrobuilder --classic
  • sudo apt-get install xz-utils
  • mkdir build
  • cd build
  • copy github.com/lxc/lxc-ci/images/alpine.yaml
  • edit alpine.yaml and replace the "image" section with:
image:
  distribution: "alpinelinux"
  architecture: x86_64
  name: alp
  release: 3.16

  • (I am not sure if the "name" matters.)
  • sudo /snap/distrobuilder/current/bin/distrobuilder build-lxd alpine.yaml

On an LXD system:

  • Copy the resulting lxd.tar.xz and rootfs.squashfs produced by distrobuilder
  • lxc image import --alias alpine/3.16 lxd.tar.xz rootfs.squashfs
  • lxc launch alpine/3.16 a1
  • lxc shell a1
  • cat /etc/alpine-release.apk-new

Result: 3.16.1
Expected Result: 3.16.2

Alpine 3.16.2 was released several days ago, on 2022-08-09.

The main repository URL was very unreliable from IPv6 only systems. If the current mirror is deprecated we'll need to identify another North American IPv6 enabled mirror to replace it.

Now that it is documented why this mirror was chosen and how to build the image with another mirror, I'm content and have no issue.

In the meantime, https://mirror.csclub.uwaterloo.ca/alpine/ has been updated.

But the image build process ends up using alpinelinux.org anyway, as seen by the output of distrobuilder:

...
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
...

The resulting image has alpinelinux.org in /etc/apk/repositories , regardless of what mirror I start with, so I'm not sure anything is gained by not using alpinelinux.org from the start.

For reference, I looked at https://mirrors.alpinelinux.org/ and found two mirrors that are fully up-to-date, other than alpinelinux.org:
http://mirrors.neusoft.edu.cn/alpine/ (China)
http://mirror.serverion.com/alpine/ (Netherlands)

That is by design. We still want the resulting images to use the official Alpine CDN URL as the images may be used from many different networks wherever LXD/LXC is used. Whereas the distrobuilder initial image build is set to a specific mirror close to where the images are built for efficiency and reach-ability reasons (as described above).

Ideally distrobuilder would be updated to accept a custom mirror location option and then we could just use the preferred mirror for image building in our build scripts rather than hard code it into distrobuilder itself though.