@@ -285,11 +285,18 @@ stackhpc_ubuntu_focal_repos:
285
285
- " deb {{ stackhpc_repo_ubuntu_focal_security_url }} focal-security main universe"
286
286
- " deb {{ stackhpc_repo_ubuntu_cloud_archive_url }} focal-updates/{{ openstack_release }} main"
287
287
288
+ # Whether to revert to the upstream mirrors in built Kolla container images.
289
+ stackhpc_kolla_clean_up_repo_mirrors : true
290
+
288
291
# Dict mapping Jinja2 block names in kolla's Docker images to their contents.
289
292
kolla_build_blocks :
290
293
base_header : |
291
294
{% if kolla_base_distro in ['centos', 'rocky'] %}
292
295
RUN \
296
+ {% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
297
+ mkdir -p /etc/yum.repos.d.backup && \
298
+ tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
299
+ {% endif %}
293
300
{% for repo in stackhpc_yum_repos %}
294
301
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
295
302
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
@@ -302,6 +309,10 @@ kolla_build_blocks:
302
309
{# fixme #}
303
310
{% if kolla_base_distro in ['centos', 'rocky'] %}
304
311
&& \
312
+ {% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
313
+ tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
314
+ tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
315
+ {% endif %}
305
316
{% for repo in base_centos_repo_overrides_post_yum_list %}
306
317
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
307
318
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
@@ -311,11 +322,30 @@ kolla_build_blocks:
311
322
{% endif %}
312
323
base_ubuntu_package_sources_list : |
313
324
RUN \
314
- rm -f /etc/apt/sources.list && \
325
+ mv /etc/apt/sources.list{,.backup} && \
315
326
{% for repo in stackhpc_ubuntu_focal_repos %}
316
327
echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
317
328
{% endif %}
318
329
{% endfor %}
330
+ footer : |
331
+ {% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
332
+ {% if kolla_base_distro == 'centos' %}
333
+ RUN \
334
+ tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
335
+ if grep -r '{{ stackhpc_repo_mirror_url }}' /etc/yum.repos.d; then \
336
+ echo "Found repository mirror in Yum repositories"; \
337
+ exit 1; \
338
+ fi && \
339
+ rm -rf /etc/yum.repos.d.backup/
340
+ {% else %}
341
+ RUN \
342
+ mv /etc/apt/sources.list.backup /etc/apt/sources.list && \
343
+ if grep -r '{{ stackhpc_repo_mirror_url }}' /etc/apt/sources.list; then \
344
+ echo "Found repository mirror in APT repositories"; \
345
+ exit 1; \
346
+ fi
347
+ {% endif %}
348
+ {% endif %}
319
349
bifrost_base_header : |
320
350
ADD additions-archive /
321
351
grafana_plugins_install : |
0 commit comments