aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichal (inc0) Jastrzebski <inc007@gmail.com>2017-10-20 14:21:49 -0700
committerMichal (inc0) Jastrzebski <inc007@gmail.com>2017-11-06 09:18:22 -0800
commitc506e626e7443fb95180807013082fb281390376 (patch)
tree743f611950f41cb72cd8d2798cb4aa6b54bda0df /tests
parent93b91ceef6d19eb875d72ad7fe5fd5f8f69f0ffb (diff)
downloadkolla-c506e626e7443fb95180807013082fb281390376.tar.gz
kolla-c506e626e7443fb95180807013082fb281390376.zip
Dockerhub publisher job
This patchset includes pushing mechanism for daily periodic jobs. Change-Id: Ic4179ffd3a6e640abfb181dbd000bc75cc64b750
Diffstat (limited to 'tests')
-rw-r--r--tests/playbooks/publish.yml8
-rw-r--r--tests/playbooks/run.yml38
-rw-r--r--tests/templates/kolla-build.conf.j212
-rw-r--r--tests/templates/pip.conf.j24
-rw-r--r--tests/templates/template_overrides.j256
5 files changed, 117 insertions, 1 deletions
diff --git a/tests/playbooks/publish.yml b/tests/playbooks/publish.yml
new file mode 100644
index 000000000..0fad441a0
--- /dev/null
+++ b/tests/playbooks/publish.yml
@@ -0,0 +1,8 @@
+---
+- hosts: all
+ tasks:
+ - name: Login to Dockerhub
+ command: "docker login -u {{ kolla_dockerhub_creds.user }} -p {{ kolla_dockerhub_creds.password }}"
+ no_log: true
+
+ - shell: "for img in $(docker images --format '{{ .Repository }}:{{ .Tag }}' | grep kolla ); do docker push $img; done"
diff --git a/tests/playbooks/run.yml b/tests/playbooks/run.yml
index 5d08a21a5..a04144659 100644
--- a/tests/playbooks/run.yml
+++ b/tests/playbooks/run.yml
@@ -35,6 +35,43 @@
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
+ state: directory
+ mode: 0777
+ become: true
+
+ - name: Template kolla-build.conf
+ template:
+ 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: |
set -e
@@ -44,7 +81,6 @@
export BASE_DISTRO={{ base_distro }}
export INSTALL_TYPE={{ install_type }}
export IN_PROJECT_JOBS=1
-
tools/gate_run.sh
executable: /bin/bash
chdir: "{{ zuul.project.src_dir }}"
diff --git a/tests/templates/kolla-build.conf.j2 b/tests/templates/kolla-build.conf.j2
new file mode 100644
index 000000000..3b1ea1051
--- /dev/null
+++ b/tests/templates/kolla-build.conf.j2
@@ -0,0 +1,12 @@
+[DEFAULT]
+debug = true
+{% if publisher %}
+profile = default
+profile = infra
+profile = main
+namespace = kolla
+tag = queens
+{% endif %}
+push = false
+logs_dir = /tmp/logs/build
+template_override = /etc/kolla/template_overrides.j2
diff --git a/tests/templates/pip.conf.j2 b/tests/templates/pip.conf.j2
new file mode 100644
index 000000000..8f0ac66ad
--- /dev/null
+++ b/tests/templates/pip.conf.j2
@@ -0,0 +1,4 @@
+[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
new file mode 100644
index 000000000..fda0420d5
--- /dev/null
+++ b/tests/templates/template_overrides.j2
@@ -0,0 +1,56 @@
+{% raw %}
+{% extends parent_template %}
+
+{% block base_header %}
+{% endraw %}
+
+RUN echo $(base64 -w0 "{{ pip_conf }}") | base64 -d > /etc/pip.conf
+
+{% raw %}
+{% if base_distro == 'ubuntu' %}
+
+RUN echo 'APT::Get::AllowUnauthenticated "true";' > /etc/apt/apt.conf.d/99allow-unauthenticated
+
+{% endif %}
+{% endblock %}
+
+{% block base_footer %}
+{% 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
+
+{% 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
+
+{% raw %}
+{% elif base_distro == "ubuntu" %}
+{% endraw %}
+
+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|" \
+ /etc/apt/sources.list \
+ && apt-get update
+
+{% raw %}
+{% endif %}
+{% endblock %}
+{% endraw %}