[base] Ensure full control over APT sources for Ubuntu

Ubuntu images were occasionally failing to build due to
unavailability or slowness of the official Ubuntu security
repositories. Although Kolla uses `mirror://` URLs to
leverage Ubuntu mirror infrastructure, the original
`/etc/apt/sources.list.d/ubuntu.sources` file was still
present, causing the system to fallback to default sources.

This commit aligns Ubuntu behavior with Debian by
explicitly removing the distro `.sources` file and relying
solely on the sources configured by Kolla. This ensures
consistent and reproducible builds both in CI and
on local environments.

Closes-Bug: #2112140

Change-Id: I00bcb30662bb12ed8711b28a64ef1941dcce893a
(cherry picked from commit b5849adc45)
Signed-off-by: Bartosz Bezak <bartosz@stackhpc.com>
This commit is contained in:
Michal Arbet
2025-05-29 19:53:55 +02:00
committed by Bartosz Bezak
parent 2abe7b1d6e
commit cae3cd6192
3 changed files with 7 additions and 4 deletions

View File

@@ -236,7 +236,7 @@ RUN cat /tmp/kolla_bashrc >> /etc/bash.bashrc \
{% block base_ubuntu_package_sources_list %}
{% if base_distro == 'debian' or ( base_distro == 'ubuntu' and base_arch == 'x86_64' ) %}
RUN rm -f /etc/apt/sources.list.d/debian.sources
RUN rm -f /etc/apt/sources.list.d/{{ base_distro }}.sources
COPY sources.list.{{ base_distro }} /etc/apt/sources.list
{% else %}
COPY sources.list.{{ base_distro }}.{{ base_arch }} /etc/apt/sources.list

View File

@@ -3,11 +3,9 @@
# Default repos
deb mirror://mirrors.ubuntu.com/mirrors.txt noble main universe
deb mirror://mirrors.ubuntu.com/mirrors.txt noble-updates main universe
deb mirror://mirrors.ubuntu.com/mirrors.txt noble-backports main universe
deb mirror://mirrors.ubuntu.com/mirrors.txt noble-security main universe
# Backports have a lower priority and must be explicitly installed to be used
deb http://archive.ubuntu.com/ubuntu/ noble-backports main universe
# We need to add the repo for the updated packages they provide. The main ones
# are qemu, libvirt, and openvswitch.
deb http://ubuntu-cloud.archive.canonical.com/ubuntu noble-updates/dalmatian main

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Ensures Kolla uses only configured APT mirror on Ubuntu for full source control.
`LP#2112140 <https://launchpad.net/bugs/2112140>`__