From fb5b3612a39e9d8345fcaf0db6b400cee4d571d2 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 4 May 2017 15:47:41 +0100 Subject: [PATCH] Enable ARA cross-repo testing When executing tests in OpenStack-CI, this patch enables the use of 'Depends-On: ' in the commit message to execute the test using a patch that is still in review for the openstack/ara repository. This patch also lays the ground for similar testing to be done with other openstack repositories, but that will no work just yet as it will take quite a bit more machinery to make the cloned repositories be used to build the venvs. That work will be submitted in subsequent patches. Change-Id: I7bc665bc7f8dd1759f521622e7607c089696a546 --- get-ansible-role-requirements.yml | 19 ++++++++++++++++--- test-ansible-functional.sh | 9 +++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/get-ansible-role-requirements.yml b/get-ansible-role-requirements.yml index de31b7e7..935bf5ab 100644 --- a/get-ansible-role-requirements.yml +++ b/get-ansible-role-requirements.yml @@ -58,10 +58,21 @@ {%- set filtered_role_list = [] %} {%- for role in roles %} {%- if (role.src | match(".*git.openstack.org.*")) and (not role.name | match("os_previous_.*")) %} - {%- set _ = filtered_role_list.append(role) %} + {%- set role_src_cleaned = role.src | regex_replace('https://git.openstack.org/', '') %} + {%- set _ = filtered_role_list.append(role_src_cleaned) %} {%- endif %} {%- endfor %} {{- filtered_role_list -}} + openstack_repo_list: > + {%- set filtered_repo_list = [] %} + {%- set repo_list = lookup('env', 'ZUUL_CHANGES').split('^') %} + {%- for repo in repo_list %} + {%- set repo_cleaned = repo | regex_replace(':.*$', '') %} + {%- if not repo_cleaned | match("^openstack/openstack-ansible.*") %} + {%- set _ = filtered_repo_list.append(repo_cleaned) %} + {%- endif %} + {%- endfor %} + {{- filtered_repo_list -}} when: - _zuul_cloner_check.rc == 0 @@ -84,6 +95,8 @@ dest: '{{ lookup("env", "WORKING_DIR") }}/tests/common' - name: 'openstack/openstack-ansible-(?!tests)(.*)' dest: '{{ homedir }}/.ansible/roles/\1' + - name: 'openstack/(?!openstack-ansible)(.*)' + dest: '{{ homedir }}/git/openstack/\1' dest: "{{ homedir }}/.ansible/clonemap.yml" when: - _zuul_cloner_check.rc == 0 @@ -94,8 +107,8 @@ -m {{ homedir }}/.ansible/clonemap.yml \ --cache-dir /opt/git \ git://git.openstack.org \ - {% for role in zuul_roles %} - {{ role.src | regex_replace('https://git.openstack.org/', '') }} \ + {% for repo in zuul_roles + openstack_repo_list %} + {{ repo }} \ {% endfor %} when: - _zuul_cloner_check.rc == 0 diff --git a/test-ansible-functional.sh b/test-ansible-functional.sh index c603429d..651f5f4d 100755 --- a/test-ansible-functional.sh +++ b/test-ansible-functional.sh @@ -30,6 +30,7 @@ set -e ## Vars ---------------------------------------------------------------------- +export TESTING_HOME=${TESTING_HOME:-$HOME} export WORKING_DIR=${WORKING_DIR:-$(pwd)} export ROLE_NAME=${ROLE_NAME:-''} @@ -66,10 +67,10 @@ function setup_ara { [[ -L "${ANSIBLE_PLUGIN_DIR}/callback/ara" ]] && return 0 # Install ARA from source if running in ARA gate, otherwise install from PyPi - if [[ -e /usr/zuul-env/bin/zuul-cloner && "${ZUUL_PROJECT}" == "openstack/ara" ]]; then - /usr/zuul-env/bin/zuul-cloner --workspace /tmp --cache-dir /opt/git \ - git://git.openstack.org openstack/ara - pip install /tmp/openstack/ara + if [[ -d "${TESTING_HOME}/git/openstack/ara" ]]; then + pip install "${TESTING_HOME}/git/openstack/ara" + elif [[ "${ZUUL_PROJECT}" == "openstack/ara" ]]; then + pip install "${WORKING_DIR}" else pip install ara fi