@@ -201,11 +201,18 @@ stackhpc_ubuntu_focal_repos:
201
201
- " deb {{ stackhpc_repo_ubuntu_focal_security_url }} focal-security main universe"
202
202
- " deb {{ stackhpc_repo_ubuntu_cloud_archive_url }} focal-updates/{{ openstack_release }} main"
203
203
204
+ # Whether to revert to the upstream mirrors in built Kolla container images.
205
+ stackhpc_kolla_clean_up_repo_mirrors : true
206
+
204
207
# Dict mapping Jinja2 block names in kolla's Docker images to their contents.
205
208
kolla_build_blocks :
206
209
base_header : |
207
210
{% if kolla_base_distro == 'centos' %}
208
211
RUN \
212
+ {% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
213
+ mkdir -p /etc/yum.repos.d.backup && \
214
+ tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
215
+ {% endif %}
209
216
{% for repo in stackhpc_centos_stream_repos %}
210
217
sed -i -e 's/^\(mirrorlist *=.*\)/#\1/g' \
211
218
-e 's/^[# ]*\(baseurl *=.*\)/#\1/g' \
@@ -216,11 +223,34 @@ kolla_build_blocks:
216
223
base_centos_repo_overrides_post_yum : |
217
224
{# fixme #}
218
225
&& \
226
+ {% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
227
+ tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
228
+ tar -czf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d . && \
229
+ {% endif %}
219
230
{% for repo in stackhpc_centos_stream_repos + stackhpc_epel_repos + stackhpc_centos_additional_repos + stackhpc_third_party_repos %}
220
231
sed -i -e 's/^\(mirrorlist *=.*\)/#\1/g' \
221
232
-e 's/^[# ]*\(baseurl *=.*\)/#\1/g' \
222
233
-e '/#baseurl.*/a baseurl={{ repo.url }}' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
223
234
{% endfor %}
235
+ footer : |
236
+ {% if stackhpc_kolla_clean_up_repo_mirrors | bool %}
237
+ {% if kolla_base_distro == 'centos' %}
238
+ RUN \
239
+ tar -xzf /etc/yum.repos.d.backup/repos.tar.gz -C /etc/yum.repos.d && \
240
+ if grep -r '{{ stackhpc_repo_mirror_url }}' /etc/yum.repos.d; then \
241
+ echo "Found repository mirror in Yum repositories"; \
242
+ exit 1; \
243
+ fi && \
244
+ rm -rf /etc/yum.repos.d.backup/
245
+ {% else %}
246
+ # RUN \
247
+ # mv /etc/apt/sources.list.backup /etc/apt/sources.list && \
248
+ # if grep -r '{{ stackhpc_repo_mirror_url }}' /etc/apt/sources.list; then \
249
+ # echo "Found repository mirror in APT repositories"; \
250
+ # exit 1; \
251
+ # fi
252
+ {% endif %}
253
+ {% endif %}
224
254
# NOTE: The Open vSwitch and OVN packages in Ubuntu Wallaby UCA repository
225
255
# are quite old - 2.15 and 20.12 respectively. Pull in these packages from
226
256
# the Yoga UCA, which are 2.17 and 22.03, to more closely match the CentOS
@@ -247,7 +277,7 @@ kolla_build_blocks:
247
277
# sometimes).
248
278
# base_ubuntu_package_sources_list: |
249
279
# RUN \
250
- # rm -f /etc/apt/sources.list && \
280
+ # mv /etc/apt/sources.list{,.backup} && \
251
281
# {% for repo in stackhpc_ubuntu_focal_repos %}
252
282
# echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
253
283
# {% endif %}
0 commit comments