kolla/tests/templates/template_overrides.j2
Michal Nasiadka 7a9ff37d0c Add RockyLinux 9 support
Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/859570

Change Ifad1da69122381cec10be4a882f80dab665cfc33 has also been
incorporated because it would fail to build without that.

Depends-On: https://review.opendev.org/c/openstack/bifrost/+/873581

Change-Id: I7af51d07b8a939c908aa072294061def57dd67de
(cherry picked from commit 0883532434fff341c444d8fce8e28fcff3f5e769)
2023-02-21 13:06:47 +00:00

130 lines
4.2 KiB
Django/Jinja

{% raw %}
{% extends parent_template %}
{% block base_pip_conf %}
{% endraw %}
ENV PIP_INDEX_URL {{ nodepool_pypi_mirror }}
ENV PIP_TRUSTED_HOST {{ nodepool_mirror_host }}
{% if use_infra_wheels_mirror | default(true) %}
ENV PIP_EXTRA_INDEX_URL {{ nodepool_wheel_mirror }}
{% endif %}
RUN echo registry={{ nodepool_npmjs_proxy }} > /etc/npmrc \
&& mkdir -p /usr/etc \
&& ln -s /etc/npmrc /usr/etc/npmrc
{% raw %}
{% endblock %}
{% endraw %}
{% if base_distro == 'centos' %}
{% raw %}
{% block base_centos_repo_overrides_post_copy %}
{% endraw %}
RUN sed -i \
-e "s|^\(mirrorlist.*\)|#\1|" \
-e "s|^#baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \
{% raw %}
{% if base_distro_tag.startswith('stream9')%}
/etc/yum.repos.d/centos*.repo
{% else %}
/etc/yum.repos.d/CentOS*.repo
{% endif %}
{% endblock %}
{% block base_centos_repo_overrides_post_rpm %}
{% endblock %}
{% block base_centos_repo_overrides_post_yum -%}
{%- endraw -%}
&& sed -i \
-e "s|^\(mirrorlist.*\)|#\1|" \
-e "s|^#baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \
-e "s|^#baseurl=https://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \
-e "s|^baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \
-e "s|^baseurl=https://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \
{% raw %}
{% if base_distro_tag.startswith('stream9') %}
/etc/yum.repos.d/centos*.repo \
{% else %}
/etc/yum.repos.d/CentOS*.repo \
{% endif %}
{% endraw %}
&& sed -i \
-e "s|^\(metalink.*\)|#\1|" \
-e "s|^#baseurl=http://download.example/pub|baseurl=http://{{ nodepool_mirror_host }}|" \
-e "s|^#baseurl=https://download.example/pub|baseurl=http://{{ nodepool_mirror_host }}|" \
/etc/yum.repos.d/epel*.repo
{%- raw -%}
{% endblock %}
{% endraw %}
{% endif %}
{% raw %}
{% block base_debian_after_sources_list %}
{% endraw %}
{% if base_distro == "debian" %}
RUN sed -i -e "s|http://deb.debian.org|[trusted=yes] http://{{ nodepool_mirror_host }}|" \
-e "s|http://security.debian.org|[trusted=yes] http://{{ nodepool_mirror_host }}|" \
/etc/apt/sources.list
{% elif base_distro == "ubuntu" %}
RUN sed -i -e "s|mirror://mirrors.ubuntu.com/mirrors.txt|[trusted=yes] http://{{ nodepool_mirror_host }}/ubuntu/|" \
-e "s|http://ubuntu-cloud.archive.canonical.com/ubuntu|[trusted=yes] http://{{ nodepool_mirror_host }}/ubuntu-cloud-archive|" \
-e "s|http://ports.ubuntu.com|[trusted=yes] http://{{ nodepool_mirror_host }}/ubuntu-ports|" \
/etc/apt/sources.list
{% endif %}
{% raw %}
{% endblock %}
{# Revert to upstream mirrors after build is complete #}
{% block footer %}
{% endraw %}
ENV PIP_INDEX_URL=
ENV PIP_TRUSTED_HOST=
{% if use_infra_wheels_mirror | default(true) %}
ENV PIP_EXTRA_INDEX_URL=
{% endif %}
RUN if [ -f /usr/etc/npmrc ]; then \
unlink /usr/etc/npmrc; \
fi \
&& rm -f /etc/npmrc
{% if base_distro == 'centos' %}
RUN sed -i \
-e "s|^#\(mirrorlist.*\)|\1|" \
-e "s|^baseurl=http://{{ nodepool_mirror_host }}|#baseurl=http://mirror.centos.org|" \
{% raw %}
{% if base_distro_tag.startswith('stream9') %}
/etc/yum.repos.d/centos*.repo \
{% else %}
/etc/yum.repos.d/CentOS*.repo \
{% endif %}
{% endraw %}
&& sed -i \
-e "s|^#\(metalink.*\)|\1|" \
-e "s|^baseurl=http://{{ nodepool_mirror_host }}|#baseurl=http://download.example/pub|" \
/etc/yum.repos.d/epel*.repo
{% elif base_distro == "debian" %}
RUN sed -i -e "s|\[trusted=yes\] http://{{ nodepool_mirror_host }}|http://deb.debian.org|" \
-e "s|\[trusted=yes\] http://{{ nodepool_mirror_host }}|http://security.debian.org|" \
/etc/apt/sources.list
{% elif base_distro == "ubuntu" %}
RUN sed -i -e "s|\[trusted=yes\] http://{{ nodepool_mirror_host }}/ubuntu/|mirror://mirrors.ubuntu.com/mirrors.txt|" \
-e "s|\[trusted=yes\] http://{{ nodepool_mirror_host }}/ubuntu-cloud-archive|http://ubuntu-cloud.archive.canonical.com/ubuntu|" \
-e "s|\[trusted=yes\] http://{{ nodepool_mirror_host }}/ubuntu-ports|http://ports.ubuntu.com|" \
/etc/apt/sources.list
{% endif %}
{% raw %}
{% endblock %}
{% endraw %}