@@ -204,11 +204,18 @@ stackhpc_ubuntu_focal_repos:
204
204
- " deb {{ stackhpc_repo_ubuntu_focal_security_url }} focal-security main universe"
205
205
- " deb {{ stackhpc_repo_ubuntu_cloud_archive_url }} focal-updates/wallaby main"
206
206
207
+ # Whether to revert to the upstream mirrors in built Kolla container images.
208
+ stackhpc_kolla_clean_up_repo_mirrors : true
209
+
207
210
# Dict mapping Jinja2 block names in kolla's Docker images to their contents.
208
211
kolla_build_blocks :
209
212
base_header : |
210
213
{% if kolla_base_distro == 'centos' %}
211
214
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 %}
212
219
{% for repo in stackhpc_centos_stream_repos %}
213
220
sed -i -e 's/^\(mirrorlist *=.*\)/#\1/g' \
214
221
-e 's/^[# ]*\(baseurl *=.*\)/#\1/g' \
@@ -219,11 +226,34 @@ kolla_build_blocks:
219
226
base_centos_repo_overrides_post_yum : |
220
227
{# fixme #}
221
228
&& \
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 %}
222
233
{% for repo in stackhpc_centos_stream_repos + stackhpc_epel_repos + stackhpc_centos_additional_repos + stackhpc_third_party_repos %}
223
234
sed -i -e 's/^\(mirrorlist *=.*\)/#\1/g' \
224
235
-e 's/^[# ]*\(baseurl *=.*\)/#\1/g' \
225
236
-e '/#baseurl.*/a baseurl={{ repo.url }}' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
226
237
{% 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 %}
227
257
# NOTE: The Open vSwitch and OVN packages in Ubuntu Wallaby UCA repository
228
258
# are quite old - 2.15 and 20.12 respectively. Pull in these packages from
229
259
# the Yoga UCA, which are 2.17 and 22.03, to more closely match the CentOS
@@ -250,7 +280,7 @@ kolla_build_blocks:
250
280
# sometimes).
251
281
# base_ubuntu_package_sources_list: |
252
282
# RUN \
253
- # rm -f /etc/apt/sources.list && \
283
+ # mv /etc/apt/sources.list{,.backup} && \
254
284
# {% for repo in stackhpc_ubuntu_focal_repos %}
255
285
# echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
256
286
# {% endif %}
0 commit comments