Browse Source

Fix branch checkout order

Since we're deprecating override-branch in favor of override-checkout,
favor override-checkout when deciding which to use.

Also, change an if to elif to make sure we only do one of these.

Change-Id: I55a94188d9894df27d99416cd3cefff8f3a64718
changes/29/523929/1
James E. Blair 5 years ago
parent
commit
532428b971
  1. 14
      zuul/executor/server.py

14
zuul/executor/server.py

@ -768,22 +768,22 @@ class AnsibleJob(object):
branches = repo.getBranches()
refs = [r.name for r in repo.getRefs()]
selected_ref = None
if project_override_branch in branches:
selected_ref = project_override_branch
self.log.info("Checking out %s project override branch %s",
project_name, selected_ref)
if project_override_checkout in refs:
selected_ref = project_override_checkout
self.log.info("Checking out %s project override ref %s",
project_name, selected_ref)
elif job_override_branch in branches:
selected_ref = job_override_branch
self.log.info("Checking out %s job override branch %s",
elif project_override_branch in branches:
selected_ref = project_override_branch
self.log.info("Checking out %s project override branch %s",
project_name, selected_ref)
elif job_override_checkout in refs:
selected_ref = job_override_checkout
self.log.info("Checking out %s job override ref %s",
project_name, selected_ref)
elif job_override_branch in branches:
selected_ref = job_override_branch
self.log.info("Checking out %s job override branch %s",
project_name, selected_ref)
elif ref and ref.startswith('refs/heads/'):
selected_ref = ref[len('refs/heads/'):]
self.log.info("Checking out %s branch ref %s",

Loading…
Cancel
Save