From af7115a39adaff5c397c9a1adebb7752487d1814 Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Mon, 18 Jul 2016 16:28:03 +0200 Subject: d-i: factor out common parts of the defaults Signed-off-by: Holger Levsen --- job-cfg/d-i.yaml.py | 73 +++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/job-cfg/d-i.yaml.py b/job-cfg/d-i.yaml.py index b9065474..f1b477c2 100755 --- a/job-cfg/d-i.yaml.py +++ b/job-cfg/d-i.yaml.py @@ -328,7 +328,28 @@ def jobspec_svn(key, name, desc, defaults=None, j['logrotate'] = lr(logkeep) return {key: j} - +def gen_default(name, downstream=None, envfile=None, parameters=None): + builders = [{'shell': '/srv/jenkins/bin/d-i_build.sh'}] + if envfile is not None: + builders.append({'inject': {'properties-file': envfile}}) + if downstream is not None: + builders.append({'trigger-builds': downstream}) + + ret = {'defaults': { + 'name': name, + 'description': ('Builds Debian packages in sid from git {branchdesc}, ' + 'triggered by pushes to
{gitrepo}
' + '{do_not_edit}'), + 'triggers': [{'pollscm': {'cron': '{trg}'}}], + 'scm': [{'git': {'url': '{gitrepo}', + 'branches': ['{branch}']}}], + 'builders': builders, + 'project-type': 'freestyle', + 'properties': prop(type='packages', priority=99), + 'parameters': parameters, + 'logrotate': lr(90), + 'publishers': publ(irc='debian-boot')}} + return ret # -- here we build the data to be dumped as yaml data = [] @@ -358,46 +379,16 @@ for f in ['html', 'pdf']: logkeep=90)) templs.append(jtmpl(act='manual', target='{lang}', fmt=f, po=po)) -data.extend( - [{'defaults': { - 'name': '{name}-{act}', - 'description': ('Builds Debian packages in sid from git {branchdesc}, ' - 'triggered by pushes to
{gitrepo}
' - '{do_not_edit}'), - 'triggers': [{'pollscm': {'cron': '{trg}'}}], - 'scm': [{'git': {'url': '{gitrepo}', - 'branches': ['{branch}']}}], - 'builders': [{'shell': '/srv/jenkins/bin/d-i_build.sh'}, - {'trigger-builds': [{'project': 'lvc_debian-miniiso', - 'current-parameters': 'true', - }]}], - 'project-type': 'freestyle', - 'properties': prop(type='packages', priority=99), - 'parameters': [{'string': {'name': 'TRIGGERING_BRANCH', - 'description': 'git branch that triggered the build that resulted in this subsequent build.'}}], - 'logrotate': lr(90), - 'publishers': publ(irc='debian-boot')}}]) - -data.extend( - [{'defaults': { - 'name': '{name}-pu-{act}', - 'description': ('Builds Debian packages in sid from git {branchdesc}, ' - 'triggered by pushes to
{gitrepo}
' - '{do_not_edit}'), - 'triggers': [{'pollscm': {'cron': '{trg}'}}], - 'scm': [{'git': {'url': '{gitrepo}', - 'branches': ['{branch}']}}], - 'builders': [ {'shell': '/srv/jenkins/bin/d-i_build.sh'}, - {'inject': {'properties-file': 'env.txt'}}, - {'trigger-builds': [{'project': 'd-i_pu-triggered_debian-installer', - 'predefined-parameters': 'TRIGGERING_BRANCH=$OUR_BRANCH' - }, - ]} - ], - 'project-type': 'freestyle', - 'properties': prop(type='packages', priority=99), - 'logrotate': lr(90), - 'publishers': publ(irc='debian-boot')}}]) +data.append(gen_default( + name='{name}-{act}', + downstream=[{'project': 'lvc_debian-miniiso', 'current-parameters': 'true'}], + parameters=[ {'string': {'name': 'TRIGGERING_BRANCH', 'description': 'git branch that triggered the build that resulted in this subsequent build.'}}], + )) +data.append(gen_default( + name='{name}-pu-{act}', + downstream=[{'project': 'd-i_pu-triggered_debian-installer','predefined-parameters': 'TRIGGERING_BRANCH=$OUR_BRANCH'}], + envfile='env.txt', + )) templs.append(jtmpl(act='{act}', target='{pkg}')) templs.append(jtmpl(act='pu-{act}', target='{pkg}')) -- cgit v1.2.3-70-g09d2