@@ -317,12 +317,22 @@ kolla_build_blocks:
317317 sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
318318 -e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
319319 -e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
320+ {% if stackhpc_repo_mirror_username is truthy %}
321+ -e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nusername={{ stackhpc_repo_mirror_username }}|' \
322+ -e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\npassword={{ stackhpc_repo_mirror_password }}|' \
323+ {% endif %}
320324 -e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} && \
321325 {% endif %}
322326 {% endfor %}
323327 {% else %}
324328 RUN \
325329 rm /etc/apt/sources.list && \
330+ rm -f /etc/apt/auth.conf && \
331+ {% if stackhpc_repo_mirror_username is truthy %}
332+ echo 'machine {{ stackhpc_repo_mirror_url }}' >> /etc/apt/auth.conf && \
333+ echo 'login {{ stackhpc_repo_mirror_username }}' >> /etc/apt/auth.conf && \
334+ echo 'password {{ stackhpc_repo_mirror_password }}' >> /etc/apt/auth.conf && \
335+ {% endif %}
326336 {% for repo in stackhpc_ubuntu_focal_base_repos %}
327337 echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
328338 {% endif %}
@@ -340,6 +350,10 @@ kolla_build_blocks:
340350 sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
341351 -e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
342352 -e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
353+ {% if stackhpc_repo_mirror_username is truthy %}
354+ -e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nusername={{ stackhpc_repo_mirror_username }}|' \
355+ -e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\npassword={{ stackhpc_repo_mirror_password }}|' \
356+ {% endif %}
343357 -e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
344358 {% endfor %}
345359 {% endif %}
@@ -350,6 +364,12 @@ kolla_build_blocks:
350364 {% endif %}
351365 RUN \
352366 rm /etc/apt/sources.list && \
367+ rm -f /etc/apt/auth.conf && \
368+ {% if stackhpc_repo_mirror_username is truthy %}
369+ echo 'machine {{ stackhpc_repo_mirror_url }}' >> /etc/apt/auth.conf && \
370+ echo 'login {{ stackhpc_repo_mirror_username }}' >> /etc/apt/auth.conf && \
371+ echo 'password {{ stackhpc_repo_mirror_password }}' >> /etc/apt/auth.conf && \
372+ {% endif %}
353373 {% for repo in stackhpc_ubuntu_focal_repos %}
354374 echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
355375 {% endif %}
0 commit comments