diff --git a/tests/playbooks/run.yml b/tests/playbooks/run.yml index a041446591..92af9d639a 100644 --- a/tests/playbooks/run.yml +++ b/tests/playbooks/run.yml @@ -1,6 +1,14 @@ - hosts: all vars: kolla_inventory_path: "{{ zuul.project.src_dir }}/inventory" + nodepool_rdo_proxy: "{{ zuul_site_mirror_fqdn }}:8080/rdo" + nodepool_pypi_mirror: "http://{{ zuul_site_mirror_fqdn }}:8080/pypi/simple" + nodepool_mirror_host: "{{ zuul_site_mirror_fqdn }}" + nodepool_npmjs_proxy: "http://{{ zuul_site_mirror_fqdn }}:8080/registry.npmjs/" + nodepool_elastic_proxy: "http://{{ zuul_site_mirror_fqdn }}:8080/elastic/" + nodepool_grafana_proxy: "http://{{ zuul_site_mirror_fqdn }}:8080/grafana/" + nodepool_opendaylight_proxy: "http://{{ zuul_site_mirror_fqdn }}:8080/opendaylight/" + nodepool_oraclelinux_proxy: "http://{{ zuul_site_mirror_fqdn }}:8080/oraclelinux/" tasks: - name: generate kolla inventory file copy: @@ -35,12 +43,6 @@ mode: 666 become: true - - name: Prepare mirror configuration - set_fact: - nodepool_rdo_proxy: "{{ zuul_site_mirror_fqdn }}:8080/rdo" - nodepool_pypi_mirror: "{{ zuul_site_mirror_fqdn }}:8080/pypi/simple" - nodepool_mirror_host: "{{ zuul_site_mirror_fqdn }}" - - name: Ensure /etc/kolla exists file: path: /etc/kolla @@ -53,24 +55,10 @@ src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tests/templates/kolla-build.conf.j2" dest: /etc/kolla/kolla-build.conf - - set_fact: - template_override_path: zuul.executor.work_root + '/' + zuul.project.src_dir '/tests/templates/pip.conf.j2' - - - name: Prepare pip.conf - template: - src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tests/templates/pip.conf.j2" - dest: /etc/kolla/pip.conf - - - name: Read contents of pip.conf - command: "cat /etc/kolla/pip.conf" - register: pip_conf_file - - name: Template override template: src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tests/templates/template_overrides.j2" dest: /etc/kolla/template_overrides.j2 - vars: - pip_conf: "{{ pip_conf_file.stdout | b64encode }}" - shell: cmd: | diff --git a/tests/templates/kolla-build.conf.j2 b/tests/templates/kolla-build.conf.j2 index 13e857178b..39e95eccee 100644 --- a/tests/templates/kolla-build.conf.j2 +++ b/tests/templates/kolla-build.conf.j2 @@ -7,3 +7,6 @@ tag = {{ zuul.branch | basename }} push = false logs_dir = /tmp/logs/build template_override = /etc/kolla/template_overrides.j2 + +[opendaylight] +location = {{ nodepool_opendaylight_proxy}}/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.6.2-Carbon/distribution-karaf-0.6.2-Carbon.tar.gz diff --git a/tests/templates/pip.conf.j2 b/tests/templates/pip.conf.j2 deleted file mode 100644 index 8f0ac66ad3..0000000000 --- a/tests/templates/pip.conf.j2 +++ /dev/null @@ -1,4 +0,0 @@ -[global] -timeout = 60 -index-url = {{ nodepool_pypi_mirror }} -trusted-host = {{ nodepool_mirror_host }} diff --git a/tests/templates/template_overrides.j2 b/tests/templates/template_overrides.j2 index fda0420d58..9bc50fd0c7 100644 --- a/tests/templates/template_overrides.j2 +++ b/tests/templates/template_overrides.j2 @@ -4,13 +4,32 @@ {% block base_header %} {% endraw %} -RUN echo $(base64 -w0 "{{ pip_conf }}") | base64 -d > /etc/pip.conf +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' %} RUN echo 'APT::Get::AllowUnauthenticated "true";' > /etc/apt/apt.conf.d/99allow-unauthenticated +{% 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 %} +{% elif base_distro == 'oraclelinux' %} +{% endraw %} + +RUN sed -i -e "s|^baseurl=http://yum.oracle.com/repo/OracleLinux|baseurl={{ nodepool_oraclelinux_proxy }}|" \ + /etc/yum.repos.d/public-yum-ol7.repo + +{% raw %} {% endif %} {% endblock %} @@ -18,28 +37,27 @@ RUN echo 'APT::Get::AllowUnauthenticated "true";' > /etc/apt/apt.conf.d/99allow- {% if 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 \ - && sed -i -e "/^mirrorlist/d" \ - -e "s|^#baseurl=http://download.fedoraproject.org/pub|baseurl=http://{{ nodepool_mirror_host }}|" \ - /etc/yum.repos.d/epel.repo \ - && sed -i -e "s|^baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \ - /etc/yum.repos.d/CentOS-Ceph-Jewel.repo \ - && sed -i -e "s|^baseurl=https://trunk.rdoproject.org|baseurl=http://{{ nodepool_rdo_proxy }}|" \ - /etc/yum.repos.d/delorean.repo +RUN sed -i -e "/^mirrorlist/d" \ + -e "s|^#baseurl=http://download.fedoraproject.org/pub|baseurl=http://{{ nodepool_mirror_host }}|g" \ + -e "s|^baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|g" \ + -e "s|^baseurl=https://packages.elastic.co|baseurl={{ nodepool_elastic_proxy }}|g" \ + -e "s|^baseurl=https://packagecloud.io/grafana|baseurl={{ nodepool_grafana_proxy }}|g" \ + -e "s|^baseurl=https://trunk.rdoproject.org|baseurl=http://{{ nodepool_rdo_proxy }}|g" \ + /etc/yum.repos.d/*.repo {% raw %} {% elif base_distro == "oraclelinux" %} {% endraw %} RUN sed -i -e "/^mirrorlist/d" \ - -e "s|^#baseurl=http://download.fedoraproject.org/pub|baseurl=http://{{ nodepool_mirror_host }}|" \ - /etc/yum.repos.d/epel.repo \ - && sed -i -e "s|^baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|" \ - /etc/yum.repos.d/CentOS-Ceph-Jewel.repo \ - && sed -i -e "s|^baseurl=https://trunk.rdoproject.org|baseurl=http://{{ nodepool_rdo_proxy }}|" \ - /etc/yum.repos.d/delorean.repo + -e "/^metalink/d" \ + -e "s|^#baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|g" \ + -e "s|^#baseurl=http://download.fedoraproject.org/pub|baseurl=http://{{ nodepool_mirror_host }}|g" \ + -e "s|^baseurl=http://mirror.centos.org|baseurl=http://{{ nodepool_mirror_host }}|g" \ + -e "s|^baseurl=https://packages.elastic.co|baseurl={{ nodepool_elastic_proxy }}|g" \ + -e "s|^baseurl=https://packagecloud.io/grafana|baseurl={{ nodepool_grafana_proxy }}|g" \ + -e "s|^baseurl=https://trunk.rdoproject.org|baseurl=http://{{ nodepool_rdo_proxy }}|g" \ + /etc/yum.repos.d/*.repo {% raw %} {% elif base_distro == "ubuntu" %}