From 0815e66bab924cfadb953b8a7e71761d70809504 Mon Sep 17 00:00:00 2001 From: Attila Darazs Date: Tue, 16 May 2017 12:42:57 +0200 Subject: [PATCH] build-test-packages: Fix gerrit based dependency parsing The repo cloning part of the role was altered to not assume the 'https://' URL prefix. This broke the repo cloning in certain situations (when only hostname was given). This change restores the original behavior and assumes a https:// prefix for all gerrit instances. Change-Id: Ib0606f3676a3ee7454201a80edde29c47f50b666 Closes-bug: #1690899 --- roles/build-test-packages/library/jenkins_deps.py | 6 ++++++ roles/build-test-packages/library/zuul_deps.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/roles/build-test-packages/library/jenkins_deps.py b/roles/build-test-packages/library/jenkins_deps.py index ef617794d..aab1ff661 100755 --- a/roles/build-test-packages/library/jenkins_deps.py +++ b/roles/build-test-packages/library/jenkins_deps.py @@ -191,6 +191,12 @@ def resolve_dep(host, change_id, branch, revision): continue new_deps = parse_commit_msg(change['host'], details['commit_msg']) to_resolve.extend(new_deps) + for index in range(len(deps)): + if deps[index]['host'] == 'review.openstack.org': + # redirect change cloning to reduce load on review.openstack.org + deps[index]['host'] = 'git.openstack.org' + # add https:// prefix for cloning the change + deps[index]['host'] = ''.join(['https://', deps[index]['host']]) if len(deps) == 0: output_msg.append('error: failed to resolve the target change') return {'failed': True, diff --git a/roles/build-test-packages/library/zuul_deps.py b/roles/build-test-packages/library/zuul_deps.py index 8615bbc9b..840d326b1 100755 --- a/roles/build-test-packages/library/zuul_deps.py +++ b/roles/build-test-packages/library/zuul_deps.py @@ -54,6 +54,9 @@ def process(host, changes, branch): # https://bugs.launchpad.net/tripleo/+bug/1676853 if '.openstack.org' in host: host = 'https://git.openstack.org' + # add URL prefix if only the bare hostname is given + if host.find('://') == -1: + host = ''.join(['https://', host]) output.append({"host": host, "project": params[0], "branch": params[1],