Add override-branch property to job repos

When a job specifies what repos it requires, allow it to also
specify a branch to check out specifically for that project.
This is similar to the project_override_branch option in zuul-cloner
which we have used to indicate that regardless of the presence of,
say, a stable/icehouse branch, we should always check out the
master branch of tempest in a particular job.

Change-Id: Ie4a5350b48eb02cadfbaf4a242770ede9a89fd1b
This commit is contained in:
James E. Blair
2017-05-23 13:07:28 -07:00
parent 040b65097f
commit 27f3dfc77e
3 changed files with 49 additions and 10 deletions

View File

@@ -287,7 +287,7 @@ class ExecutorClient(object):
params['vars']['zuul'] = zuul_params
projects = set()
def make_project_dict(project):
def make_project_dict(project, override_branch=None):
project_config = item.current_build_set.layout.project_configs.get(
project.canonical_name, None)
if project_config:
@@ -297,12 +297,19 @@ class ExecutorClient(object):
connection = project.source.connection
return dict(connection=connection.connection_name,
name=project.name,
override_branch=override_branch,
default_branch=project_default_branch)
if job.repos:
for repo in job.repos:
(trusted, project) = tenant.getProject(repo)
params['projects'].append(make_project_dict(project))
for job_project in job.repos.values():
(trusted, project) = tenant.getProject(
job_project.project_name)
if project is None:
raise Exception("Unknown project %s" %
(job_project.project_name,))
params['projects'].append(
make_project_dict(project,
job_project.override_branch))
projects.add(project)
for item in all_items:
if item.change.project not in projects: