From 67cfe4ad0dc2e4d8edeb693a486441e94dab11f4 Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Mon, 12 Aug 2013 23:39:30 -0700 Subject: [PATCH] Add display-name job property. There is apparently no way to clear this property using the REST api once it is set, and the included documentation change warns of that. Change-Id: I49c5a91664cd37196f3239854bb0adbcf5b3c9f9 --- doc/source/configuration.rst | 8 ++++++++ doc/source/general.rst | 9 +++++++++ jenkins_jobs/modules/general.py | 4 +++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index 056681f48..eb01ae950 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -34,6 +34,7 @@ later. There are a few basic optional fields for a Job definition:: project-type: freestyle defaults: global disabled: false + display-name: 'Fancy job name' concurrent: true quiet-period: 5 workspace: /srv/build-area/job-name @@ -56,6 +57,13 @@ later. There are a few basic optional fields for a Job definition:: Boolean value to set whether or not this job should be disabled in Jenkins. Defaults to ``false`` (job will be enabled). +**display-name** + Optional name shown for the project throughout the Jenkins web GUI in place + of the actual job name. The jenkins_jobs tool cannot fully remove this trait + once it is set, so use caution when setting it. Setting it to the same + string as the project name is an effective un-set workaround. Alternately, + the field can be cleared manually using the Jenkins web interface. + **concurrent** Boolean value to set whether or not Jenkins can run this job concurrently. Defaults to ``false``. diff --git a/doc/source/general.rst b/doc/source/general.rst index e67f33c84..17dab03db 100644 --- a/doc/source/general.rst +++ b/doc/source/general.rst @@ -18,6 +18,7 @@ later. There are a few basic optional fields for a Job definition:: project-type: freestyle defaults: global disabled: false + display-name: 'Fancy job name' concurrent: true workspace: /srv/build-area/job-name quiet-period: 5 @@ -40,6 +41,14 @@ later. There are a few basic optional fields for a Job definition:: Boolean value to set whether or not this job should be disabled in Jenkins. Defaults to ``false`` (job will be enabled). + * **display-name**: + Optional name shown for the project throughout the Jenkins web GUI in + place of the actual job name. The jenkins_jobs tool cannot fully remove + this trait once it is set, so use caution when setting it. Setting it to + the same string as the job's name is an effective un-set workaround. + Alternately, the field can be cleared manually using the Jenkins web + interface. + * **concurrent**: Boolean value to set whether or not Jenkins can run this job concurrently. Defaults to ``false``. diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py index 2f3fc9e3a..f1d6a7bbd 100644 --- a/jenkins_jobs/modules/general.py +++ b/jenkins_jobs/modules/general.py @@ -68,6 +68,8 @@ class General(jenkins_jobs.modules.base.Base): XML.SubElement(xml, 'disabled').text = 'true' else: XML.SubElement(xml, 'disabled').text = 'false' + if 'display-name' in data: + XML.SubElement(xml, 'displayName').text = data['display-name'] if data.get('block-downstream'): XML.SubElement(xml, 'blockBuildWhenDownstreamBuilding').text = 'true' @@ -89,7 +91,7 @@ class General(jenkins_jobs.modules.base.Base): if 'workspace' in data: XML.SubElement(xml, 'customWorkspace').text = \ str(data['workspace']) - if('quiet-period' in data): + if 'quiet-period' in data: XML.SubElement(xml, 'quietPeriod').text = str(data['quiet-period']) node = data.get('node', None) if node: