mirror of
git://git.yoctoproject.org/yocto-autobuilder2.git
synced 2025-07-19 20:59:02 +02:00
schedulers: Correctly set default branch names for new release specific builds
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
6c3ebfa7a9
commit
a2c99357cb
328
schedulers.py
328
schedulers.py
|
@ -13,164 +13,7 @@ from yoctoabb.yocto_console_view.yocto_console_view import ReleaseSelector
|
||||||
|
|
||||||
schedulers = []
|
schedulers = []
|
||||||
|
|
||||||
|
branchdefaults = {
|
||||||
def create_repo_inputs(reponame):
|
|
||||||
"""
|
|
||||||
Given the name of a repository in yoctoab.config's repo dict creates
|
|
||||||
StringParameter inputs to allow specification of alternative uri, branch
|
|
||||||
and commit/hash values
|
|
||||||
"""
|
|
||||||
|
|
||||||
repo = util.StringParameter("repo_{}".format(reponame),
|
|
||||||
label="Repository:",
|
|
||||||
default=config.repos[reponame][0])
|
|
||||||
branch = util.StringParameter("branch_{}".format(reponame),
|
|
||||||
label="Branch:",
|
|
||||||
default=config.repos[reponame][1])
|
|
||||||
commit = util.StringParameter("commit_{}".format(reponame),
|
|
||||||
label="Revision:",
|
|
||||||
default="HEAD")
|
|
||||||
return [repo, branch, commit]
|
|
||||||
|
|
||||||
|
|
||||||
def repos_for_builder(buildername):
|
|
||||||
"""
|
|
||||||
Returns a list of additional properties for a scheduler, a list of
|
|
||||||
StringParameter allowing all of the repositories used by the
|
|
||||||
builder/scheduler to be customised
|
|
||||||
"""
|
|
||||||
|
|
||||||
parameters = []
|
|
||||||
repos = config.buildertorepos.get(buildername)
|
|
||||||
if not repos:
|
|
||||||
repos = config.buildertorepos["default"]
|
|
||||||
for repo in repos:
|
|
||||||
inputs = create_repo_inputs(repo)
|
|
||||||
parameters = parameters + [util.NestedParameter(name='', label=repo, fields=inputs, columns=2)]
|
|
||||||
return parameters
|
|
||||||
|
|
||||||
def parent_default_props(buildername):
|
|
||||||
props = {}
|
|
||||||
props["swat_monitor"] = True
|
|
||||||
repos = config.buildertorepos.get(buildername)
|
|
||||||
if not repos:
|
|
||||||
repos = config.buildertorepos["default"]
|
|
||||||
for repo in repos:
|
|
||||||
props["repo_{}".format(repo)] = config.repos[repo][0]
|
|
||||||
props["branch_{}".format(repo)] = config.repos[repo][1]
|
|
||||||
props["commit_{}".format(repo)] = "HEAD"
|
|
||||||
return props
|
|
||||||
|
|
||||||
def buildappsrcrev_param():
|
|
||||||
return util.StringParameter(
|
|
||||||
name="buildappsrcrev",
|
|
||||||
label="""Build appliance source revision to use. "None" means default to the srcrev currently in the recipe, use "AUTOREV" to use latest revision or specify a revision to use:""",
|
|
||||||
default="AUTOREV")
|
|
||||||
|
|
||||||
def props_for_builder(builder):
|
|
||||||
"""
|
|
||||||
Generate an appropriate list of properties to use on a builder-specific
|
|
||||||
scheduler
|
|
||||||
"""
|
|
||||||
|
|
||||||
props = []
|
|
||||||
props.append(util.BooleanParameter(
|
|
||||||
name="swat_monitor",
|
|
||||||
label="Should SWAT monitor this build?",
|
|
||||||
default=True))
|
|
||||||
if builder == 'build-appliance':
|
|
||||||
props.append(buildappsrcrev_param())
|
|
||||||
if builder in ['build-appliance', 'buildtools', 'eclipse-plugin-neon', 'eclipse-plugin-oxygen']:
|
|
||||||
props.append(util.BooleanParameter(
|
|
||||||
name="deploy_artefacts",
|
|
||||||
label="Do we want to deploy artefacts? ",
|
|
||||||
default=False
|
|
||||||
))
|
|
||||||
props = props + repos_for_builder(builder)
|
|
||||||
worker_list = config.builder_to_workers.get(builder, config.builder_to_workers['default'])
|
|
||||||
props.append(util.ChoiceStringParameter(name="worker",
|
|
||||||
label="Worker to run the build on",
|
|
||||||
default="*",
|
|
||||||
multiple=False,
|
|
||||||
strict=True,
|
|
||||||
choices=worker_list + ["*"]))
|
|
||||||
return props
|
|
||||||
|
|
||||||
|
|
||||||
for builder in config.subbuilders:
|
|
||||||
schedulers.append(sched.ForceScheduler(
|
|
||||||
name=builder,
|
|
||||||
builderNames=[builder],
|
|
||||||
reason=util.StringParameter(
|
|
||||||
name="reason",
|
|
||||||
label="""Reason (please note the reason for triggering the
|
|
||||||
build and any expectations for the build's outcome:""",
|
|
||||||
required=False),
|
|
||||||
properties=props_for_builder(builder),
|
|
||||||
buttonName="Force Build"))
|
|
||||||
|
|
||||||
@util.renderer
|
|
||||||
def builderNamesFromConfigQuick(props):
|
|
||||||
#log.msg("builderNames: Sourcestamp %s, props %s" % (str(props.sourcestamps), str(props)))
|
|
||||||
yp_branch = props.sourcestamps[0]['branch']
|
|
||||||
|
|
||||||
builders = config.trigger_builders_wait_quick
|
|
||||||
for b in config.trigger_builders_wait_quick_releases:
|
|
||||||
if yp_branch and yp_branch.startswith(b):
|
|
||||||
log.msg("builderNames: Filtering branch %s due to entry %s" % (str(yp_branch), str(b)))
|
|
||||||
builders = config.trigger_builders_wait_quick_releases[b]
|
|
||||||
|
|
||||||
return builders
|
|
||||||
|
|
||||||
@util.renderer
|
|
||||||
def builderNamesFromConfigFull(props):
|
|
||||||
#log.msg("builderNames: Sourcestamp %s, props %s" % (str(props.sourcestamps), str(props)))
|
|
||||||
yp_branch = props.sourcestamps[0]['branch']
|
|
||||||
|
|
||||||
builders = config.trigger_builders_wait_full
|
|
||||||
for b in config.trigger_builders_wait_full_releases:
|
|
||||||
if yp_branch and yp_branch.startswith(b):
|
|
||||||
log.msg("builderNames: Filtering branch %s due to entry %s" % (str(yp_branch), str(b)))
|
|
||||||
builders = config.trigger_builders_wait_full_releases[b]
|
|
||||||
|
|
||||||
# Only run performance runs on release builds
|
|
||||||
if props.getProperty("is_release", False):
|
|
||||||
builders = builders + config.trigger_builders_wait_perf
|
|
||||||
|
|
||||||
return builders
|
|
||||||
|
|
||||||
# Upstream Triggerable class will rasise NotImplementedError() which will mean triggers abort upon reconfig
|
|
||||||
# Hack to intercept and ignore this, we'd rather they just survive in our case.
|
|
||||||
class ourTriggerable(sched.Triggerable):
|
|
||||||
def reconfigService(self, name=None, *args, **kwargs):
|
|
||||||
return
|
|
||||||
|
|
||||||
# nightly builder triggers various other builders
|
|
||||||
wait_quick = ourTriggerable(name="wait-quick",
|
|
||||||
builderNames=builderNamesFromConfigQuick)
|
|
||||||
schedulers.append(wait_quick)
|
|
||||||
wait_full = ourTriggerable(name="wait-full",
|
|
||||||
builderNames=builderNamesFromConfigFull)
|
|
||||||
schedulers.append(wait_full)
|
|
||||||
|
|
||||||
def parent_scheduler(target):
|
|
||||||
return sched.ForceScheduler(
|
|
||||||
name=target,
|
|
||||||
builderNames=[target],
|
|
||||||
buttonName="Start " + target + " Build",
|
|
||||||
codebases = [util.CodebaseParameter(codebase='', label="yocto-autobuilder-helper:", project=None)],
|
|
||||||
reason=util.StringParameter(
|
|
||||||
name="reason",
|
|
||||||
label="""Reason (please note the reason for triggering the build and
|
|
||||||
any expectations for the build's outcome:""",
|
|
||||||
required=False),
|
|
||||||
properties=[
|
|
||||||
ReleaseSelector(
|
|
||||||
name="branchselector",
|
|
||||||
default="master",
|
|
||||||
label="Release Shortcut Selector",
|
|
||||||
choices=["master", "master-next", "mut", "hardknott", "gatesgarth", "dunfell", "zeus", "warrior", "thud", "sumo", "rocko", "pyro", "morty"],
|
|
||||||
selectors={
|
|
||||||
'master': {
|
'master': {
|
||||||
'branch': 'master',
|
'branch': 'master',
|
||||||
'branch_poky': 'master',
|
'branch_poky': 'master',
|
||||||
|
@ -295,7 +138,170 @@ def parent_scheduler(target):
|
||||||
'branch_meta-mingw': 'morty',
|
'branch_meta-mingw': 'morty',
|
||||||
'branch_oecore': 'morty',
|
'branch_oecore': 'morty',
|
||||||
}
|
}
|
||||||
}),
|
}
|
||||||
|
|
||||||
|
def create_repo_inputs(reponame):
|
||||||
|
"""
|
||||||
|
Given the name of a repository in yoctoab.config's repo dict creates
|
||||||
|
StringParameter inputs to allow specification of alternative uri, branch
|
||||||
|
and commit/hash values
|
||||||
|
"""
|
||||||
|
|
||||||
|
repo = util.StringParameter("repo_{}".format(reponame),
|
||||||
|
label="Repository:",
|
||||||
|
default=config.repos[reponame][0])
|
||||||
|
branch = util.StringParameter("branch_{}".format(reponame),
|
||||||
|
label="Branch:",
|
||||||
|
default=config.repos[reponame][1])
|
||||||
|
commit = util.StringParameter("commit_{}".format(reponame),
|
||||||
|
label="Revision:",
|
||||||
|
default="HEAD")
|
||||||
|
return [repo, branch, commit]
|
||||||
|
|
||||||
|
|
||||||
|
def repos_for_builder(buildername):
|
||||||
|
"""
|
||||||
|
Returns a list of additional properties for a scheduler, a list of
|
||||||
|
StringParameter allowing all of the repositories used by the
|
||||||
|
builder/scheduler to be customised
|
||||||
|
"""
|
||||||
|
|
||||||
|
parameters = []
|
||||||
|
repos = config.buildertorepos.get(buildername)
|
||||||
|
if not repos:
|
||||||
|
repos = config.buildertorepos["default"]
|
||||||
|
for repo in repos:
|
||||||
|
inputs = create_repo_inputs(repo)
|
||||||
|
parameters = parameters + [util.NestedParameter(name='', label=repo, fields=inputs, columns=2)]
|
||||||
|
return parameters
|
||||||
|
|
||||||
|
def parent_default_props(buildername, branchname=None):
|
||||||
|
props = {}
|
||||||
|
props["swat_monitor"] = True
|
||||||
|
repos = config.buildertorepos.get(buildername)
|
||||||
|
if not repos:
|
||||||
|
repos = config.buildertorepos["default"]
|
||||||
|
for repo in repos:
|
||||||
|
props["repo_{}".format(repo)] = config.repos[repo][0]
|
||||||
|
branchkey = "branch_{}".format(repo)
|
||||||
|
if branchname and branchname in branchdefaults and branchkey in branchdefaults[branchname]:
|
||||||
|
props[branchkey] = branchdefaults[branchname][branchkey]
|
||||||
|
else:
|
||||||
|
props[branchkey] = config.repos[repo][1]
|
||||||
|
config.repos[repo][1]
|
||||||
|
props["commit_{}".format(repo)] = "HEAD"
|
||||||
|
return props
|
||||||
|
|
||||||
|
def buildappsrcrev_param():
|
||||||
|
return util.StringParameter(
|
||||||
|
name="buildappsrcrev",
|
||||||
|
label="""Build appliance source revision to use. "None" means default to the srcrev currently in the recipe, use "AUTOREV" to use latest revision or specify a revision to use:""",
|
||||||
|
default="AUTOREV")
|
||||||
|
|
||||||
|
def props_for_builder(builder):
|
||||||
|
"""
|
||||||
|
Generate an appropriate list of properties to use on a builder-specific
|
||||||
|
scheduler
|
||||||
|
"""
|
||||||
|
|
||||||
|
props = []
|
||||||
|
props.append(util.BooleanParameter(
|
||||||
|
name="swat_monitor",
|
||||||
|
label="Should SWAT monitor this build?",
|
||||||
|
default=True))
|
||||||
|
if builder == 'build-appliance':
|
||||||
|
props.append(buildappsrcrev_param())
|
||||||
|
if builder in ['build-appliance', 'buildtools', 'eclipse-plugin-neon', 'eclipse-plugin-oxygen']:
|
||||||
|
props.append(util.BooleanParameter(
|
||||||
|
name="deploy_artefacts",
|
||||||
|
label="Do we want to deploy artefacts? ",
|
||||||
|
default=False
|
||||||
|
))
|
||||||
|
props = props + repos_for_builder(builder)
|
||||||
|
worker_list = config.builder_to_workers.get(builder, config.builder_to_workers['default'])
|
||||||
|
props.append(util.ChoiceStringParameter(name="worker",
|
||||||
|
label="Worker to run the build on",
|
||||||
|
default="*",
|
||||||
|
multiple=False,
|
||||||
|
strict=True,
|
||||||
|
choices=worker_list + ["*"]))
|
||||||
|
return props
|
||||||
|
|
||||||
|
|
||||||
|
for builder in config.subbuilders:
|
||||||
|
schedulers.append(sched.ForceScheduler(
|
||||||
|
name=builder,
|
||||||
|
builderNames=[builder],
|
||||||
|
reason=util.StringParameter(
|
||||||
|
name="reason",
|
||||||
|
label="""Reason (please note the reason for triggering the
|
||||||
|
build and any expectations for the build's outcome:""",
|
||||||
|
required=False),
|
||||||
|
properties=props_for_builder(builder),
|
||||||
|
buttonName="Force Build"))
|
||||||
|
|
||||||
|
@util.renderer
|
||||||
|
def builderNamesFromConfigQuick(props):
|
||||||
|
#log.msg("builderNames: Sourcestamp %s, props %s" % (str(props.sourcestamps), str(props)))
|
||||||
|
yp_branch = props.sourcestamps[0]['branch']
|
||||||
|
|
||||||
|
builders = config.trigger_builders_wait_quick
|
||||||
|
for b in config.trigger_builders_wait_quick_releases:
|
||||||
|
if yp_branch and yp_branch.startswith(b):
|
||||||
|
log.msg("builderNames: Filtering branch %s due to entry %s" % (str(yp_branch), str(b)))
|
||||||
|
builders = config.trigger_builders_wait_quick_releases[b]
|
||||||
|
|
||||||
|
return builders
|
||||||
|
|
||||||
|
@util.renderer
|
||||||
|
def builderNamesFromConfigFull(props):
|
||||||
|
#log.msg("builderNames: Sourcestamp %s, props %s" % (str(props.sourcestamps), str(props)))
|
||||||
|
yp_branch = props.sourcestamps[0]['branch']
|
||||||
|
|
||||||
|
builders = config.trigger_builders_wait_full
|
||||||
|
for b in config.trigger_builders_wait_full_releases:
|
||||||
|
if yp_branch and yp_branch.startswith(b):
|
||||||
|
log.msg("builderNames: Filtering branch %s due to entry %s" % (str(yp_branch), str(b)))
|
||||||
|
builders = config.trigger_builders_wait_full_releases[b]
|
||||||
|
|
||||||
|
# Only run performance runs on release builds
|
||||||
|
if props.getProperty("is_release", False):
|
||||||
|
builders = builders + config.trigger_builders_wait_perf
|
||||||
|
|
||||||
|
return builders
|
||||||
|
|
||||||
|
# Upstream Triggerable class will rasise NotImplementedError() which will mean triggers abort upon reconfig
|
||||||
|
# Hack to intercept and ignore this, we'd rather they just survive in our case.
|
||||||
|
class ourTriggerable(sched.Triggerable):
|
||||||
|
def reconfigService(self, name=None, *args, **kwargs):
|
||||||
|
return
|
||||||
|
|
||||||
|
# nightly builder triggers various other builders
|
||||||
|
wait_quick = ourTriggerable(name="wait-quick",
|
||||||
|
builderNames=builderNamesFromConfigQuick)
|
||||||
|
schedulers.append(wait_quick)
|
||||||
|
wait_full = ourTriggerable(name="wait-full",
|
||||||
|
builderNames=builderNamesFromConfigFull)
|
||||||
|
schedulers.append(wait_full)
|
||||||
|
|
||||||
|
def parent_scheduler(target):
|
||||||
|
return sched.ForceScheduler(
|
||||||
|
name=target,
|
||||||
|
builderNames=[target],
|
||||||
|
buttonName="Start " + target + " Build",
|
||||||
|
codebases = [util.CodebaseParameter(codebase='', label="yocto-autobuilder-helper:", project=None)],
|
||||||
|
reason=util.StringParameter(
|
||||||
|
name="reason",
|
||||||
|
label="""Reason (please note the reason for triggering the build and
|
||||||
|
any expectations for the build's outcome:""",
|
||||||
|
required=False),
|
||||||
|
properties=[
|
||||||
|
ReleaseSelector(
|
||||||
|
name="branchselector",
|
||||||
|
default="master",
|
||||||
|
label="Release Shortcut Selector",
|
||||||
|
choices=["master", "master-next", "mut", "hardknott", "gatesgarth", "dunfell", "zeus", "warrior", "thud", "sumo", "rocko", "pyro", "morty"],
|
||||||
|
selectors=branchdefaults),
|
||||||
util.BooleanParameter(
|
util.BooleanParameter(
|
||||||
name="swat_monitor",
|
name="swat_monitor",
|
||||||
label="Should SWAT monitor this build?",
|
label="Should SWAT monitor this build?",
|
||||||
|
@ -357,11 +363,11 @@ schedulers.append(sched.Nightly(name='nightly-check-layer', branch='master', pro
|
||||||
builderNames=['check-layer-nightly'], hour=0, minute=0))
|
builderNames=['check-layer-nightly'], hour=0, minute=0))
|
||||||
|
|
||||||
# Run check-layer-nightly twice a week for hardknott
|
# Run check-layer-nightly twice a week for hardknott
|
||||||
schedulers.append(sched.Nightly(name='nightly-check-layer', branch='hardknott', properties=parent_default_props('check-layer-nightly'),
|
schedulers.append(sched.Nightly(name='nightly-check-layer', branch='hardknott', properties=parent_default_props('check-layer-nightly', 'hardknott'),
|
||||||
builderNames=['check-layer-nightly'], dayOfWeek=[0, 3], hour=2, minute=0))
|
builderNames=['check-layer-nightly'], dayOfWeek=[0, 3], hour=2, minute=0))
|
||||||
|
|
||||||
# Run check-layer-nightly twice a week for dunfell
|
# Run check-layer-nightly twice a week for dunfell
|
||||||
schedulers.append(sched.Nightly(name='nightly-check-layer', branch='dunfell', properties=parent_default_props('check-layer-nightly'),
|
schedulers.append(sched.Nightly(name='nightly-check-layer', branch='dunfell', properties=parent_default_props('check-layer-nightly', 'dunfell'),
|
||||||
builderNames=['check-layer-nightly'], dayOfWeek=[1, 4], hour=2, minute=0))
|
builderNames=['check-layer-nightly'], dayOfWeek=[1, 4], hour=2, minute=0))
|
||||||
|
|
||||||
# Run the build performance tests at 3am, 9am, 3pm and 9pm
|
# Run the build performance tests at 3am, 9am, 3pm and 9pm
|
||||||
|
|
Loading…
Reference in New Issue
Block a user