Merge "Use load-branch with trusted repository"

This commit is contained in:
Zuul 2021-04-01 16:51:32 +00:00 committed by Gerrit Code Review
commit ce7c998c6b
3 changed files with 24 additions and 1 deletions

View File

@ -19,6 +19,11 @@
name: common-config-job
run: playbooks/common.yaml
- project:
check:
jobs:
- common-config-job
# Use the canonical name here. This should be merged with the org/project1 in
# the other repo.
- project:

View File

@ -401,6 +401,24 @@ class TestTenantConfigBranches(ZuulTestCase):
# Now job must be defined on stable branch
self._validate_job(common_job, 'stable')
# Now try to break the config in common-config on stable
in_repo_conf = textwrap.dedent(
"""
- job:
name: base
parent: non-existing
""")
file_dict = {'zuul.yaml': in_repo_conf}
A = self.fake_gerrit.addFakeChange('common-config', 'stable', 'A',
files=file_dict)
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
# No job should have run due to the change introducing a config error
self.assertHistory([])
self.assertTrue(A.reported)
self.assertTrue('Job non-existing not defined' in A.messages[0])
class TestSplitConfig(ZuulTestCase):
tenant_config_file = 'config/split-config/main.yaml'

View File

@ -2363,7 +2363,7 @@ class ConfigLoader(object):
tenant = item.pipeline.tenant
tpc = tenant.project_configs[project.canonical_name]
if trusted:
branches = ['master']
branches = [tpc.load_branch if tpc.load_branch else 'master']
else:
# Use the cached branch list; since this is a dynamic
# reconfiguration there should not be any branch changes.