[2024.1 only] Extend base_tag check to cover more ubuntu base image tags

https://hub.docker.com provides base Ubuntu images with two type of
namings.
For example for Ubuntu Noble, there are ``24.04``, ``noble`` and
``noble-20250127``.

Currently whenever Kolla checks base tag to determine which Ubuntu
release is being used, it only expects tag of version number.
So if users use base tag with release codename, they will not get
correct python version or other dependencies.

Fixing this by extending all base_tag checks to include case for
release codenames.

Change-Id: Iab02de97cdde79db540c7336512d7014f9b71753
This commit is contained in:
Seunghun Lee
2025-04-03 14:51:04 +01:00
committed by Bartosz Bezak
parent 6aba731d6a
commit 0bb6a65ed6
5 changed files with 15 additions and 8 deletions

View File

@@ -241,15 +241,15 @@ RUN cat /tmp/kolla_bashrc >> /etc/bash.bashrc \
RUN rm -f /etc/apt/sources.list.d/debian.sources
COPY sources.list.{{ base_distro }} /etc/apt/sources.list
{% elif ( base_distro == 'ubuntu' and base_arch == 'x86_64' ) %}
{% if base_distro_tag.startswith('22.04') %}
{% if base_distro_tag.startswith('22.04') or base_distro_tag.startswith('jammy') %}
COPY sources.list.{{ base_distro }}.jammy /etc/apt/sources.list
{% elif base_distro_tag.startswith('24.04') %}
{% elif base_distro_tag.startswith('24.04') or base_distro_tag.startswith('noble') %}
COPY sources.list.{{ base_distro }}.noble /etc/apt/sources.list
{% endif %}
{% else %}
{% if base_distro_tag.startswith('22.04') %}
{% if base_distro_tag.startswith('22.04') or base_distro_tag.startswith('jammy')%}
COPY sources.list.{{ base_distro }}.jammy.{{ base_arch }} /etc/apt/sources.list
{% elif base_distro_tag.startswith('24.04') %}
{% elif base_distro_tag.startswith('24.04') or base_distro_tag.startswith('noble')%}
COPY sources.list.{{ base_distro }}.noble.{{ base_arch }} /etc/apt/sources.list
{% endif %}
{% endif %}

View File

@@ -37,7 +37,7 @@ ENV ANSIBLE_GATHER_TIMEOUT=30
{% block bifrost_ansible_install %}
{%- if base_package_type == 'deb' %}
RUN apt-get --error-on=any update && \
{%- if base_distro_tag.startswith('24.04') %}
{%- if base_distro_tag.startswith('24.04') or base_distro_tag.startswith('noble') %}
bash -c 'export VENV=/var/lib/kolla/venv && \
{# NOTE(darmach): Bumped to ansible-core 2.16 to match Python 3.12 #}
$VENV/bin/pip install "ansible>=9,<10" && \

View File

@@ -32,7 +32,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
] %}
{% endif %}
{% if base_distro_tag.startswith('24.04') %}
{% if base_distro_tag.startswith('24.04') or base_distro_tag.startswith('noble') %}
RUN {{ macros.upper_constraints_version_change("taskflow", "5.6.0", "5.8.0") }}
{% endif %}

View File

@@ -122,7 +122,7 @@ class KollaWorker(object):
self.distro_package_manager = 'apt'
self.base_package_type = 'deb'
elif self.base in ['ubuntu']:
if self.base_tag.startswith('24.04'):
if self.base_tag.startswith(('24.04', 'noble')):
self.conf.distro_python_version = "3.12"
else:
self.conf.distro_python_version = "3.10"

View File

@@ -96,7 +96,14 @@ def handle_repos(context, reponames, mode):
repofile = context.get('repos_yaml') or (
os.path.dirname(os.path.realpath(__file__)) +
('/repos-noble.yaml' if base_distro_tag == '24.04' else '/repos.yaml')
(
'/repos-noble.yaml'
if (
base_distro_tag and
base_distro_tag.startswith(('24.04', 'noble'))
)
else '/repos.yaml'
)
)
with open(repofile, 'r') as repos_file: