Fix branch ordering when loading in-repo config
In-repo configs were being loaded from branches in non-deterministic order. Instead, load from the master branch first, then other branches in sorted order (so that the order is deterministic). Also, add an entry to the inheritance path for the job itself, to improve debugging. The master is special in that, by being loaded first, jobs that appear there will be deemed to be the reference definition, which means they will not have implied branch matchers added. This is what lets us define jobs in the master branch of zuul-jobs and have them run on any branch of projects that use them. The error this fixes caused random branches to contain the reference definitions of jobs which leads to unpredictable results. Change-Id: I425395db19cc6b336a2db9cf46415d8a5f4c036f
This commit is contained in:
parent
d0033b71e1
commit
11bd5ee86c
|
@ -1374,7 +1374,12 @@ class TenantParser(object):
|
|||
# branch. Remember the branch and then implicitly add a
|
||||
# branch selector to each job there. This makes the
|
||||
# in-repo configuration apply only to that branch.
|
||||
for branch in project.source.getProjectBranches(project, tenant):
|
||||
branches = sorted(project.source.getProjectBranches(
|
||||
project, tenant))
|
||||
if 'master' in branches:
|
||||
branches.remove('master')
|
||||
branches = ['master'] + branches
|
||||
for branch in branches:
|
||||
new_project_unparsed_branch_config[project][branch] = \
|
||||
model.UnparsedTenantConfig()
|
||||
job = merger.getFiles(
|
||||
|
|
|
@ -888,6 +888,8 @@ class Job(object):
|
|||
return Attributes(name=self.name)
|
||||
|
||||
def setRun(self):
|
||||
msg = 'self %s' % (repr(self),)
|
||||
self.inheritance_path = self.inheritance_path + (msg,)
|
||||
if not self.run:
|
||||
self.run = self.implied_run
|
||||
|
||||
|
|
Loading…
Reference in New Issue