aboutsummaryrefslogtreecommitdiff
path: root/tests/templates/template_overrides.j2
blob: ee67e2a62959f38e3936b49efb75f3c168e9fc48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{% 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 %}

{% raw %}
{% endblock %}
{% endraw %}

{% if base_distro == 'rocky' %}
{% raw %}
{% block base_centos_repo_overrides_post_copy %}
{% endraw %}
RUN sed -i -e "s/^mirrorlist/#mirrorlist/g" -e "s/^#baseurl/baseurl/g" \
    /etc/yum.repos.d/rocky.repo
{% raw %}
{% endblock %}
{% endraw %}
{% endif %}

{% raw %}
{% block base_debian_after_sources_list %}
{% endraw %}
{% if base_distro == "debian" %}

RUN cp /etc/apt/sources.list.d/debian.sources /tmp/ && \
    sed -i -e "s|^URIs: http://deb.debian.org/debian$|URIs: http://{{ nodepool_mirror_host }}/debian\nTrusted: yes|" \
           -e "s|^URIs: http://deb.debian.org/debian-security|URIs: http://{{ nodepool_mirror_host }}/debian-security\nTrusted: yes|" \
           /etc/apt/sources.list.d/debian.sources

{% elif base_distro == "ubuntu" %}

RUN cp /etc/apt/sources.list.d/ubuntu.sources /tmp/ && \
    sed -i -e "s|^URIs: http://archive.ubuntu.com/ubuntu/$|URIs: http://{{ nodepool_mirror_host }}/ubuntu/\nTrusted: yes|" \
           -e "s|^URIs: http://security.ubuntu.com/ubuntu/$|URIs: http://{{ nodepool_mirror_host }}/ubuntu/\nTrusted: yes|" \
           -e "s|^URIs: http://ports.ubuntu.com/ubuntu-ports/$|URIs: http://{{ nodepool_mirror_host }}/ubuntu-ports/\nTrusted: yes|" \
           -e "s|^URIs: http://ubuntu-cloud.archive.canonical.com/ubuntu$|URIs: http://{{ nodepool_mirror_host }}/ubuntu-cloud-archive\nTrusted: yes|" \
           /etc/apt/sources.list.d/ubuntu.sources

{% 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 %}

{% if base_distro == "debian" %}
RUN if [ -f /tmp/debian.sources ]; then \
        mv -f /tmp/debian.sources /etc/apt/sources.list.d/debian.sources; \
    fi
{% elif base_distro == "ubuntu" %}
RUN if [ -f /tmp/ubuntu.sources ]; then \
        mv -f /tmp/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources; \
    fi
{% endif %}
{% raw %}
{% endblock %}
{% endraw %}