Skip to content

Commit ac86491

Browse files
authored
Merge pull request #483 from stackhpc/wallaby-restore-upstream-repos
Restore upstream mirrors in container image package repos
2 parents 3d5cff7 + 0599453 commit ac86491

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

etc/kayobe/kolla.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,18 @@ stackhpc_ubuntu_focal_repos:
204204
- "deb {{ stackhpc_repo_ubuntu_focal_security_url }} focal-security main universe"
205205
- "deb {{ stackhpc_repo_ubuntu_cloud_archive_url }} focal-updates/wallaby main"
206206

207+
# Whether to revert to the upstream mirrors in built Kolla container images.
208+
stackhpc_kolla_clean_up_repo_mirrors: true
209+
207210
# Dict mapping Jinja2 block names in kolla's Docker images to their contents.
208211
kolla_build_blocks:
209212
base_header: |
210213
{% if kolla_base_distro == 'centos' %}
211214
RUN \
215+
{% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
216+
mkdir -p /etc/yum.repos.d.backup && \
217+
tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
218+
{% endif %}
212219
{% for repo in stackhpc_centos_stream_repos %}
213220
sed -i -e 's/^\(mirrorlist *=.*\)/#\1/g' \
214221
-e 's/^[# ]*\(baseurl *=.*\)/#\1/g' \
@@ -219,11 +226,34 @@ kolla_build_blocks:
219226
base_centos_repo_overrides_post_yum: |
220227
{# fixme #}
221228
&& \
229+
{% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
230+
tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
231+
tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
232+
{% endif %}
222233
{% for repo in stackhpc_centos_stream_repos + stackhpc_epel_repos + stackhpc_centos_additional_repos + stackhpc_third_party_repos %}
223234
sed -i -e 's/^\(mirrorlist *=.*\)/#\1/g' \
224235
-e 's/^[# ]*\(baseurl *=.*\)/#\1/g' \
225236
-e '/#baseurl.*/a baseurl={{ repo.url }}' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
226237
{% endfor %}
238+
footer: |
239+
{% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
240+
{% if kolla_base_distro == 'centos' %}
241+
RUN \
242+
tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
243+
if grep -r '{{ stackhpc_repo_mirror_url }}' /etc/yum.repos.d; then \
244+
echo "Found repository mirror in Yum repositories"; \
245+
exit 1; \
246+
fi && \
247+
rm -rf /etc/yum.repos.d.backup/
248+
{% else %}
249+
# RUN \
250+
# mv /etc/apt/sources.list.backup /etc/apt/sources.list && \
251+
# if grep -r '{{ stackhpc_repo_mirror_url }}' /etc/apt/sources.list; then \
252+
# echo "Found repository mirror in APT repositories"; \
253+
# exit 1; \
254+
# fi
255+
{% endif %}
256+
{% endif %}
227257
# NOTE: The Open vSwitch and OVN packages in Ubuntu Wallaby UCA repository
228258
# are quite old - 2.15 and 20.12 respectively. Pull in these packages from
229259
# the Yoga UCA, which are 2.17 and 22.03, to more closely match the CentOS
@@ -250,7 +280,7 @@ kolla_build_blocks:
250280
# sometimes).
251281
# base_ubuntu_package_sources_list: |
252282
# RUN \
253-
# rm -f /etc/apt/sources.list && \
283+
# mv /etc/apt/sources.list{,.backup} && \
254284
# {% for repo in stackhpc_ubuntu_focal_repos %}
255285
# echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
256286
# {% endif %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Upstream package repository mirrors are now restored in Kolla container
5+
images. This makes it possible to install or update packages for debugging
6+
purposes.

0 commit comments

Comments
 (0)