From a4ee07744e60c283de31fc187abe3a07071d5894 Mon Sep 17 00:00:00 2001 From: Vladimir Kozhukalov Date: Tue, 19 Sep 2023 23:23:50 +0300 Subject: [PATCH] Fix buildset registry usage for multinode jobs The issue was that we used to add buildset registry name to the /etc/hosts file only on the primary node. This PR fixes this. Change-Id: I48a861c7c6661e3fe1e7384f4b987f1646d652d7 --- tools/gate/playbooks/run-scripts.yaml | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/gate/playbooks/run-scripts.yaml b/tools/gate/playbooks/run-scripts.yaml index 4f2d5f90b2..7ae51c4b33 100644 --- a/tools/gate/playbooks/run-scripts.yaml +++ b/tools/gate/playbooks/run-scripts.yaml @@ -11,6 +11,20 @@ # limitations under the License. --- +- hosts: all + become: true + tasks: + - name: Configure /etc/hosts for buildset_registry to workaround docker not understanding ipv6 addresses + lineinfile: + path: /etc/hosts + state: present + regex: "^{{ buildset_registry.host }}\tzuul-jobs.buildset-registry$" + line: "{{ buildset_registry.host }}\tzuul-jobs.buildset-registry" + insertafter: EOF + when: + - buildset_registry is defined + - buildset_registry.host | ipaddr + - hosts: primary tasks: - name: Override images @@ -18,9 +32,17 @@ vars: work_dir: "{{ zuul.project.src_dir }}" block: - - name: Buildset registry alias - include_tasks: - file: buildset_registry_alias.yaml + - name: Set buildset_registry alias variable when using ip + set_fact: + buildset_registry_alias: zuul-jobs.buildset-registry + when: + - buildset_registry.host | ipaddr + + - name: Set buildset_registry alias variable when using name + set_fact: + buildset_registry_alias: "{{ buildset_registry.host }}" + when: + - not ( buildset_registry.host | ipaddr ) - name: Print zuul debug: