[Qa-jenkins-scm] [jenkins.debian.net] 05/06: d-i: factor out common parts of the defaults

Holger Levsen holger at layer-acht.org
Mon Jul 18 17:59:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit af7115a39adaff5c397c9a1adebb7752487d1814
Author: Philip Hands <phil at hands.com>
Date:   Mon Jul 18 16:28:03 2016 +0200

    d-i: factor out common parts of the defaults
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 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 b906547..f1b477c 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 <pre>{gitrepo}</pre> '
+                        '{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 <pre>{gitrepo}</pre> '
-                        '{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 <pre>{gitrepo}</pre> '
-                        '{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}'))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list