Skip to content

Commit 604fa6f

Browse files
committed
Ubuntu: add base repos to Kolla container image earlier
Previously when building Kolla container images for Ubuntu it was common to get a dependency error during apt package installation, such as: The following packages have unmet dependencies: libc6-dev : Depends: libc6 (= 2.35-0ubuntu3.1) but 2.35-0ubuntu3.4 is to be installed This is caused by the packages in the Ubuntu base image being newer than those in the release train repository snapshot. This change fixes the issue by switching to the release train repositories earlier in the build process, before the first apt command runs. It's possible that we may also need to pin the Ubuntu base container image, but that would be another thing to maintain, so let's try without for now since this approach is necessary and may be sufficient.
1 parent ec1ff05 commit 604fa6f

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

etc/kayobe/kolla.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,20 @@ base_centos_repo_overrides_post_yum_rocky_list: "{{ stackhpc_rocky_9_repos + sta
277277
base_centos_repo_overrides_post_yum_list: "{{ base_centos_repo_overrides_post_yum_centos_list if kolla_base_distro == 'centos' else base_centos_repo_overrides_post_yum_rocky_list }}"
278278
stackhpc_yum_repos: "{{ stackhpc_centos_stream_repos if kolla_base_distro == 'centos' else stackhpc_rocky_9_repos }}"
279279

280-
# List of repositories for Ubuntu focal.
281-
stackhpc_ubuntu_focal_repos:
280+
# List of base repositories for Ubuntu Focal.
281+
stackhpc_ubuntu_focal_base_repos:
282282
- "deb {{ stackhpc_repo_ubuntu_focal_url }} focal main universe"
283283
- "deb {{ stackhpc_repo_ubuntu_focal_url }} focal-updates main universe"
284284
- "deb {{ stackhpc_repo_ubuntu_focal_url }} focal-backports main universe"
285285
- "deb {{ stackhpc_repo_ubuntu_focal_security_url }} focal-security main universe"
286+
287+
# List of UCA repositories for Ubuntu Focal.
288+
stackhpc_ubuntu_focal_uca_repos:
286289
- "deb {{ stackhpc_repo_ubuntu_cloud_archive_url }} focal-updates/{{ openstack_release }} main"
287290

291+
# List of repositories for Ubuntu Focal.
292+
stackhpc_ubuntu_focal_repos: "{{ stackhpc_ubuntu_focal_base_repos + stackhpc_ubuntu_focal_uca_repos }}"
293+
288294
# Whether to revert to the upstream mirrors in built Kolla container images.
289295
stackhpc_kolla_clean_up_repo_mirrors: true
290296

@@ -304,6 +310,13 @@ kolla_build_blocks:
304310
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} && \
305311
{% endif %}
306312
{% endfor %}
313+
{% else %}
314+
RUN \
315+
rm /etc/apt/sources.list && \
316+
{% for repo in stackhpc_ubuntu_focal_base_repos %}
317+
echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
318+
{% endif %}
319+
{% endfor %}
307320
{% endif %}
308321
base_centos_repo_overrides_post_yum: |
309322
{# fixme #}
@@ -320,9 +333,13 @@ kolla_build_blocks:
320333
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
321334
{% endfor %}
322335
{% endif %}
336+
# With the UCA keyring installed we can now add all repos.
323337
base_ubuntu_package_sources_list: |
338+
{% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
339+
COPY sources.list.ubuntu /etc/apt/sources.list.backup
340+
{% endif %}
324341
RUN \
325-
mv /etc/apt/sources.list /etc/apt/sources.list.backup && \
342+
rm /etc/apt/sources.list && \
326343
{% for repo in stackhpc_ubuntu_focal_repos %}
327344
echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
328345
{% endif %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes an issue with Kolla container image builds for Ubuntu where the
5+
release train package repositories could be behind the container image,
6+
leading to image build failures.

0 commit comments

Comments
 (0)