aboutsummaryrefslogtreecommitdiff
path: root/tests/templates/template_overrides.j2
blob: 22baa2a569daddd5b44de458b9b4f577fa7022fe (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
{% raw %}
{% extends parent_template %}

{% block base_header %}
{% endraw %}

ENV PIP_INDEX_URL {{ nodepool_pypi_mirror }}
ENV PIP_TRUSTED_HOST {{ nodepool_mirror_host }}

RUN echo registry={{ nodepool_npmjs_proxy }} > /etc/npmrc \
    && mkdir -p /usr/etc \
    && ln -s /etc/npmrc /usr/etc/npmrc

{% raw %}
{% if base_distro == 'ubuntu' %}

# NOTE(hrw): Debian 'buster' and Ubuntu 18.04 refuse to use unsigned repos
RUN echo 'APT::Get::AllowUnauthenticated "true";' > /etc/apt/apt.conf.d/99allow-unauthenticated \
 && echo 'Acquire::AllowInsecureRepositories "true";' > /etc/apt/apt.conf.d/99allow-insecure-repos

{% elif base_distro == 'centos' %}
{% endraw %}

RUN sed -i -e "/^mirrorlist/ d" \
        -e "s|^#baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \
        /etc/yum.repos.d/CentOS-Base.repo

{% raw %}
{% endif %}
{% endblock %}

{% block base_footer %}
{% if base_distro == "centos" %}
{% endraw %}

## NOTE(yoctozepto): GPG key location is replaced for Percona repo only
## TODO(yoctozepto): CentOS hits external EPEL repo for its repo package (epel-release-*.rpm), should use the mirrored
RUN sed -i \
        -e "/^mirrorlist/ d" \
        -e "s|^#baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \
        /etc/yum.repos.d/CentOS-*.repo \
    && sed -i \
        -e "/^metalink/ d" \
        -e "s|^#baseurl=http://download.fedoraproject.org/pub|baseurl=http://{{ nodepool_mirror_host }}|" \
        /etc/yum.repos.d/epel*.repo \
    && sed -i \
        -e "s|https://trunk.rdoproject.org|{{ nodepool_rdo_proxy }}|g" \
        -e "s|https://cbs.centos.org/repos|{{ nodepool_cbs_centos_proxy }}|g" \
        -e "s|https://repo.percona.com|{{ nodepool_percona_proxy }}|g" \
        /etc/yum.repos.d/*.repo

{% raw %}
{% elif base_distro == "ubuntu" %}
{% endraw %}

## TODO(yoctozepto): replace base repo earlier as well (like RHEL-based do)
RUN sed -i -e "s|http://archive.ubuntu.com|http://{{ nodepool_mirror_host }}|" \
        -e "s|http://ubuntu-cloud.archive.canonical.com/ubuntu|http://{{ nodepool_mirror_host }}/ubuntu-cloud-archive|" \
        -e "s|http://repo.percona.com|{{ nodepool_percona_proxy }}|" \
        /etc/apt/sources.list \
    && apt-get update

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