summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Pretorius <jesse.pretorius@rackspace.co.uk>2019-02-12 19:21:00 +0000
committerJesse Pretorius <jesse.pretorius@rackspace.co.uk>2019-02-12 19:21:00 +0000
commitbb9d690eb09360fe03bf16bcfa0ffa2e2e8f5826 (patch)
tree7641a96e23f042a26fe0b5c60092e81f7e678771
parentd90acf00b639496cd0669153534fe5588875f3ee (diff)
Clone the correct plugins repo for role tests
Currently the role tests always clone the plugins repo without specifying a branch. The tests also always use a git clone, even though in zuul the repo is already cloned. This patch ensures that the branch is specified when doing the clone, and also will just symlink to the existing zuul clone if it is present. Change-Id: Iaf5ee20e534a8279b5b563c820518bb176f0f4bb
Notes
Notes (review): Code-Review+2: Marc GariƩpy (mgariepy) <gariepy.marc@gmail.com> Code-Review+2: Kevin Carter (cloudnull) <kevin@cloudnull.com> Workflow+1: Kevin Carter (cloudnull) <kevin@cloudnull.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 12 Feb 2019 21:38:58 +0000 Reviewed-on: https://review.openstack.org/636426 Project: openstack/openstack-ansible-tests Branch: refs/heads/master
-rwxr-xr-xtest-ansible-env-prep.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/test-ansible-env-prep.sh b/test-ansible-env-prep.sh
index 378f132..a628d1b 100755
--- a/test-ansible-env-prep.sh
+++ b/test-ansible-env-prep.sh
@@ -45,6 +45,16 @@ export ANSIBLE_ROLE_DEP_DIR="${TESTING_HOME}/.ansible/roles"
45export ANSIBLE_ROLE_DIR="${TESTING_HOME}/.ansible/testing-role" 45export ANSIBLE_ROLE_DIR="${TESTING_HOME}/.ansible/testing-role"
46export COMMON_TESTS_PATH="${WORKING_DIR}/tests/common" 46export COMMON_TESTS_PATH="${WORKING_DIR}/tests/common"
47 47
48# The place where zuul clones dependent repositories to
49ZUUL_PLUGINS_CLONE_LOCATION="/home/zuul/src/git.openstack.org/openstack/openstack-ansible-plugins"
50
51# Use .gitreview as the key to determine the appropriate
52# branch to clone for tests.
53TESTING_BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' "${WORKING_DIR}/.gitreview")
54if [[ "${TESTING_BRANCH}" == "" ]]; then
55 TESTING_BRANCH="master"
56fi
57
48# Use pip opts to add options to the pip install command. 58# Use pip opts to add options to the pip install command.
49# This can be used to tell it which index to use, etc. 59# This can be used to tell it which index to use, etc.
50export PIP_OPTS=${PIP_OPTS:-""} 60export PIP_OPTS=${PIP_OPTS:-""}
@@ -103,8 +113,18 @@ if [[ ! -d "${ANSIBLE_PLUGIN_DIR}" ]]; then
103 # symlink it. 113 # symlink it.
104 if [[ "${OSA_PROJECT_NAME}" == "openstack-ansible-plugins" ]]; then 114 if [[ "${OSA_PROJECT_NAME}" == "openstack-ansible-plugins" ]]; then
105 ln -s ${WORKING_DIR} "${ANSIBLE_PLUGIN_DIR}" 115 ln -s ${WORKING_DIR} "${ANSIBLE_PLUGIN_DIR}"
116
117 # In zuul v3 any dependent repository is placed into
118 # /home/zuul/src/git.openstack.org, so we check to see
119 # if there is a tests checkout there already. If so, we
120 # symlink that and use it.
121 elif [[ -d "${ZUUL_PLUGINS_CLONE_LOCATION}" ]]; then
122 ln -s "${ZUUL_PLUGINS_CLONE_LOCATION}" "${ANSIBLE_PLUGIN_DIR}"
123
124 # Otherwise we're clearly not in zuul or using a previously setup
125 # repo in some way, so just clone it from upstream.
106 else 126 else
107 git clone \ 127 git clone -b "${TESTING_BRANCH}" \
108 https://git.openstack.org/openstack/openstack-ansible-plugins \ 128 https://git.openstack.org/openstack/openstack-ansible-plugins \
109 "${ANSIBLE_PLUGIN_DIR}" 129 "${ANSIBLE_PLUGIN_DIR}"
110 fi 130 fi