From e0692e65cec2ffcf8f8b88f8ec188696ee46937f Mon Sep 17 00:00:00 2001 From: "william.soula" Date: Mon, 29 Oct 2012 23:13:43 -0500 Subject: [PATCH] Adding ability to use the Build Name Setter Plugin Change-Id: Icf933a25513f3b349ef67badc7b3e9cd7998089c Reviewed-on: https://review.openstack.org/15037 Reviewed-by: James E. Blair Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- jenkins_jobs/modules/wrappers.py | 20 ++++++++++++++++++++ setup.py | 1 + 2 files changed, 21 insertions(+) diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index cdbc9ff99..5954d7bd9 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -108,6 +108,26 @@ def mask_passwords(parser, xml_parent, data): 'com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper') +def build_name(parser, xml_parent, data): + """yaml: build-name + Set the name of the build + Requires the Jenkins `Build Name Setter Plugin. + `_ + + :arg str name: Name for the build. Typically you would use a variable + from Jenkins in the name. The syntax would be ${FOO} for the FOO variable. + + Example:: + + wrappers: + - build-name: + name: Build-${FOO} + """ + bsetter = XML.SubElement(xml_parent, + 'org.jenkinsci.plugins.buildnamesetter.BuildNameSetter') + XML.SubElement(bsetter, 'template').text = data['name'] + + class Wrappers(jenkins_jobs.modules.base.Base): sequence = 80 diff --git a/setup.py b/setup.py index 298aaf7c1..53b249b98 100644 --- a/setup.py +++ b/setup.py @@ -92,6 +92,7 @@ setup(name='jenkins_job_builder', 'timestamps=jenkins_jobs.modules.wrappers:timestamps', 'ansicolor=jenkins_jobs.modules.wrappers:ansicolor', 'mask-passwords=jenkins_jobs.modules.wrappers:mask_passwords', + 'build-name=jenkins_jobs.modules.wrappers:build_name', ], 'jenkins_jobs.modules': [ 'assignednode=jenkins_jobs.modules.assignednode:AssignedNode',