Create a stub .zuul.yaml

When creating a new git repo, create a simple .zuul.yaml so that
gating works out of the box on new projects.

Change-Id: I5cd2bbfdcbc73685886a3f019099ea4ac27860f7
This commit is contained in:
James E. Blair 2025-01-31 11:13:21 -08:00
parent 8fd3fda132
commit d0d82cdd40

View File

@ -164,8 +164,21 @@ port=%s
project=%s
defaultbranch=%s
""" % (GERRIT_HOST, GERRIT_PORT, project_git, default_branch))
git_command(repo_path, "add .gitreview")
cmd = ("commit -a -m'Added .gitreview' --author='%s'"
# Create a Zuul config file
with open(os.path.join(repo_path,
".zuul.yaml"),
'w') as zuul:
zuul.write("""- project:
check:
jobs:
- noop
gate:
jobs:
- noop
""")
# Add and commit the files
git_command(repo_path, "add .gitreview .zuul.yaml")
cmd = ("commit -a -m'Added .gitreview and .zuul.yaml' --author='%s'"
% GERRIT_GITID)
git_command(repo_path, cmd)
return "push %s HEAD:" + ref_str
@ -231,7 +244,7 @@ class ProjectsRegistry(object):
if os.path.exists(PROJECTS_INI):
section = 'projects'
if self.defaults.has_option(section, item):
if type(default) == bool:
if isinstance(default, bool):
return self.defaults.getboolean(section, item)
else:
return self.defaults.get(section, item)