Pull image from dockerhub rather than tarballs.o.o site
Change-Id: Id71c1ecda9f8647a0eb290fe02a12afb3df09988
This commit is contained in:
parent
826658e7d4
commit
11f9afba1b
@ -3,6 +3,11 @@
|
||||
vars:
|
||||
logs_dir: "/tmp/logs"
|
||||
tasks:
|
||||
- name: Print all facts
|
||||
copy:
|
||||
content: "{{ hostvars[inventory_hostname] | to_nice_json }}"
|
||||
dest: "{{ logs_dir }}/facts.json"
|
||||
|
||||
- name: Run diagnostics script
|
||||
script: get_logs.sh
|
||||
register: get_logs_result
|
||||
|
@ -5,6 +5,7 @@
|
||||
logs_dir: "/tmp/logs"
|
||||
kolla_ansible_src_dir: "src/{{ zuul.project.canonical_hostname }}/openstack/kolla-ansible"
|
||||
kolla_ansible_full_src_dir: "{{ zuul.executor.work_root }}/{{ kolla_ansible_src_dir }}"
|
||||
need_build_image: false
|
||||
tasks:
|
||||
- name: ensure /etc/kolla exists
|
||||
file:
|
||||
@ -46,6 +47,13 @@
|
||||
with_items: "{{ ansible_interfaces }}"
|
||||
delegate_to: "primary"
|
||||
|
||||
- name: detect whether need build images
|
||||
set_fact:
|
||||
need_build_image: true
|
||||
when:
|
||||
- item.project.short_name == "kolla"
|
||||
with_items: "{{ zuul['items'] }}"
|
||||
|
||||
- name: generate global.yml file
|
||||
template:
|
||||
src: "{{ kolla_ansible_full_src_dir }}/tests/templates/globals-default.j2"
|
||||
@ -72,6 +80,22 @@
|
||||
dest: /etc/kolla/passwords.yml
|
||||
delegate_to: "primary"
|
||||
|
||||
- name: ensure /etc/docker exists
|
||||
file:
|
||||
path: "/etc/docker"
|
||||
state: "directory"
|
||||
mode: 0777
|
||||
become: true
|
||||
|
||||
- name: create deamon.json for nodepool cache
|
||||
vars:
|
||||
infra_dockerhub_mirror: "http://{{ zuul_site_mirror_fqdn }}:8081/registry-1.docker/"
|
||||
template:
|
||||
src: "{{ kolla_ansible_full_src_dir }}/tests/templates/docker_daemon.json.j2"
|
||||
dest: "/etc/docker/daemon.json"
|
||||
become: true
|
||||
|
||||
|
||||
- name: install kolla-ansible requirements
|
||||
pip:
|
||||
requirements: "{{ ansible_env.HOME }}/{{ kolla_ansible_src_dir }}/requirements.txt"
|
||||
@ -89,6 +113,9 @@
|
||||
export INSTALL_TYPE={{ install_type }}
|
||||
export NODEPOOL_TARBALLS_MIRROR=http://{{ zuul_site_mirror_fqdn }}:8080/tarballs
|
||||
|
||||
export BUILD_IMAGE={{ need_build_image }}
|
||||
export KOLLA_SRC_DIR={{ ansible_env.HOME }}/src/git.openstack.org/openstack/kolla
|
||||
|
||||
tools/setup_gate.sh
|
||||
executable: /bin/bash
|
||||
chdir: "{{ kolla_ansible_src_dir }}"
|
||||
|
6
tests/templates/docker_daemon.json.j2
Normal file
6
tests/templates/docker_daemon.json.j2
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"debug": true,
|
||||
"registry-mirrors": [
|
||||
"{{ infra_dockerhub_mirror }}"
|
||||
]
|
||||
}
|
@ -11,9 +11,15 @@ kolla_internal_vip_address: "169.254.169.10"
|
||||
|
||||
network_interface: "{{ api_interface_name }}"
|
||||
docker_restart_policy: "never"
|
||||
{% if need_build_image %}
|
||||
# NOTE(Jeffrey4l): use different a docker namespace name in case it pull image from hub.docker.io when deplying
|
||||
docker_namespace: "lokolla"
|
||||
docker_registry: "{{ api_interface_address }}:4000"
|
||||
{% else %}
|
||||
# use docker hub images
|
||||
docker_namespace: "kolla"
|
||||
openstack_release: "queens"
|
||||
{% endif %}
|
||||
neutron_external_interface: "fake_interface"
|
||||
enable_horizon: "yes"
|
||||
enable_heat: "no"
|
||||
|
@ -34,11 +34,6 @@ EOF
|
||||
echo "RUN echo $(base64 -w0 ${PIP_CONF}) | base64 -d > /etc/pip.conf" | sudo tee /etc/kolla/header
|
||||
rm ${PIP_CONF}
|
||||
|
||||
# Get base distro and install type from workspace. The full path looks like
|
||||
# /home/jenkins/workspace/gate-kolla-ansible-dsvm-deploy-centos-source-centos-7-nv
|
||||
|
||||
# NOTE(Jeffrey4l): use different a docker namespace name in case it pull image from hub.docker.io when deplying
|
||||
|
||||
GATE_IMAGES="cron,fluentd,glance,haproxy,keepalived,keystone,kolla-toolbox,mariadb,memcached,neutron,nova,openvswitch,rabbitmq,horizon"
|
||||
|
||||
# TODO(jeffrey4l): this doesn't work with zuulv3
|
||||
@ -69,7 +64,7 @@ EOF
|
||||
apt_sources_list = /etc/kolla/sources.list
|
||||
EOF
|
||||
sudo cp /etc/apt/sources.list /etc/kolla/sources.list
|
||||
sudo cat /etc/apt/sources.list.available.d/ubuntu-cloud-archive.list | sudo tee -a /etc/kolla/sources.list
|
||||
sudo cat /etc/apt/sources.list.available.d/ubuntu-cloud-archive-pike.list | sudo tee -a /etc/kolla/sources.list
|
||||
# Append non-infra provided repos to list
|
||||
cat << EOF | sudo tee -a /etc/kolla/sources.list
|
||||
deb http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu xenial main
|
||||
@ -108,25 +103,13 @@ function setup_node {
|
||||
}
|
||||
|
||||
function prepare_images {
|
||||
sudo docker run -d -p 4000:5000 --restart=always -v /opt/kolla_registry/:/var/lib/registry --name registry registry:2
|
||||
|
||||
# NOTE(Jeffrey4l): Zuul adds all changes depend on to ZUUL_CHANGES
|
||||
# variable. if find "openstack/kolla:" string, it means this patch depends
|
||||
# on one of Kolla patch. Then build image by using Kolla's code.
|
||||
# Otherwise, pull images from tarballs.openstack.org site.
|
||||
# NOTE(inc0): Publisher variable is set when Kolla runs publisher jobs.
|
||||
# When that happens we don't build images, we download them from temp location.
|
||||
if echo "$ZUUL_CHANGES" | grep -i "openstack/kolla:" && ! [[ $PUBLISHER ]]; then
|
||||
pushd "${GIT_PROJECT_DIR}/kolla"
|
||||
sudo tox -e "build-${BASE_DISTRO}-${INSTALL_TYPE}"
|
||||
popd
|
||||
else
|
||||
BRANCH=$(echo "$ZUUL_BRANCH" | cut -d/ -f2)
|
||||
filename=${BASE_DISTRO}-${INSTALL_TYPE}-registry-${BRANCH}.tar.gz
|
||||
wget -q -c -O "/tmp/$filename" \
|
||||
"${NODEPOOL_TARBALLS_MIRROR}/kolla/images/${TMP_REGISTRY}${filename}"
|
||||
sudo tar xzf "/tmp/$filename" -C /opt/kolla_registry
|
||||
if [[ "${BUILD_IMAGE}" == "False" ]]; then
|
||||
return
|
||||
fi
|
||||
sudo docker run -d -p 4000:5000 --restart=always -v /opt/kolla_registry/:/var/lib/registry --name registry registry:2
|
||||
pushd "${KOLLA_SRC_DIR}"
|
||||
sudo tox -e "build-${BASE_DISTRO}-${INSTALL_TYPE}"
|
||||
popd
|
||||
}
|
||||
|
||||
function sanity_check {
|
||||
|
Loading…
Reference in New Issue
Block a user