From 731d6b1acf0016a84ea318e5d625e71ef9fab2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Tue, 8 Sep 2020 12:38:56 +0200 Subject: [PATCH] [CI] Support building source images with in-review changes The Kolla-Ansible part. This switches Kolla-Ansible to use the kolla-build-config role instead of generating config locally. Depends-On: https://review.opendev.org/607159 Change-Id: I859acbe4f84ccbdc53764574a58e6f0fab4094a3 --- tests/run.yml | 32 ++++++++++++++++++++++++++------ tests/setup_gate.sh | 23 +---------------------- zuul.d/base.yaml | 2 ++ 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/tests/run.yml b/tests/run.yml index de2ca429fe..f59701078e 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -42,20 +42,38 @@ - hosts: primary any_errors_fatal: true + vars: + kolla_build_config: + DEFAULT: + profile: gate + logs_dir: /tmp/logs/build + # NOTE(yoctozepto): we cannot build and push at the same time on debian + # buster see https://github.com/docker/for-linux/issues/711. + push: "{{ base_distro != 'debian' }}" + base: "{{ base_distro }}" + install_type: "{{ install_type }}" + registry: "127.0.0.1:4000" + namespace: lokolla + tag: "{{ build_image_tag }}" + template_override: /etc/kolla/template_overrides.j2 + # NOTE(yoctozepto): to avoid issues with IPv6 not enabled in the docker daemon + # and since we don't need isolated networks here, use host networking + network_mode: host tasks: - name: detect whether need build images set_fact: need_build_image: true when: - - item.project.short_name == "kolla" - - item.branch == zuul.branch + # NOTE(yoctozepto): if there is any tested change that does not belong to kolla-ansible, + # then kolla images should be built + - item.project.short_name != "kolla-ansible" with_items: "{{ zuul['items'] }}" # NOTE(yoctozepto): required to template template_overrides.j2 for Zuul - name: Include kolla Zuul vars if building new images include_vars: file: "{{ zuul.executor.work_root }}/src/opendev.org/openstack/kolla/tests/vars/zuul.yml" - when: need_build_image # only then kolla sources are available (and used) + when: need_build_image - block: # NOTE(mgoddard): This only affects the remote copy of the repo, not the @@ -84,12 +102,16 @@ mode: 0777 become: true + - import_role: + name: kolla-build-config + when: need_build_image + # NOTE(yoctozepto): required to customize kolla to use local mirrors - name: Template template_overrides.j2 template: src: "{{ zuul.executor.work_root }}/src/opendev.org/openstack/kolla/tests/templates/template_overrides.j2" dest: /etc/kolla/template_overrides.j2 - when: need_build_image # only then kolla sources are available (and used) + when: need_build_image - name: Ensure /etc/docker exists file: @@ -247,9 +269,7 @@ chdir: "{{ kolla_ansible_src_dir }}" environment: BASE_DISTRO: "{{ base_distro }}" - INSTALL_TYPE: "{{ install_type }}" BUILD_IMAGE: "{{ need_build_image }}" - TAG: "{{ build_image_tag }}" KOLLA_SRC_DIR: "{{ ansible_env.HOME }}/src/opendev.org/openstack/kolla" SCENARIO: "{{ scenario }}" UPPER_CONSTRAINTS: "{{ upper_constraints_file }}" diff --git a/tests/setup_gate.sh b/tests/setup_gate.sh index 5fcea9c4f0..e78b35c269 100755 --- a/tests/setup_gate.sh +++ b/tests/setup_gate.sh @@ -79,28 +79,7 @@ function prepare_images { GATE_IMAGES="^cron,^elasticsearch,^fluentd,^grafana,^haproxy,^keepalived,^kibana,^kolla-toolbox,^mariadb,^memcached,^prometheus,^rabbitmq" fi - # NOTE(yoctozepto): we cannot build and push at the same time on debian - # buster see https://github.com/docker/for-linux/issues/711. - PUSH="true" - if [[ "debian" == $BASE_DISTRO ]]; then - PUSH="false" - fi - - sudo tee /etc/kolla/kolla-build.conf <