add an auth-token YAML parameter for the General Job Configuraion module

Using the Jenkins WEB UI an Authentication Token can be specified for
jobs to allow builds to be triggered remotely by using the URL:
JENKINS_URL/job/JOBNAME/build?token=TOKEN

Add an auth-token job parameter to generate the <authToken> XML element.

Change-Id: Ic916e4074c9b2de9c616ef39a88c1d8e1e91fcff
Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
Reviewed-on: https://review.openstack.org/25819
Reviewed-by: Arnaud Fabre <fabre.arnaud@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Javier Martinez Canillas 2013-04-01 14:55:56 +02:00 committed by Jenkins
parent 2cd1e7fb9d
commit bc235fdfc9
3 changed files with 12 additions and 0 deletions

View File

@ -77,6 +77,11 @@ later. There are a few basic optional fields for a Job definition::
upstream jobs are running. Upstream jobs are determined
transitively. Defaults to ``false``.
**auth-token**
Specifies an authentication token that allows new builds to be
triggered by accessing a special predefined URL. Only those who
know the token will be able to trigger builds remotely.
.. _job-template:
Job Template

View File

@ -62,5 +62,10 @@ later. There are a few basic optional fields for a Job definition::
upstream jobs are running. Upstream jobs are determined
transitively. Defaults to ``false``.
* **auth-token**:
Specifies an authentication token that allows new builds to be
triggered by accessing a special predefined URL. Only those who
know the token will be able to trigger builds remotely.
.. automodule:: general
:members:

View File

@ -74,6 +74,8 @@ class General(jenkins_jobs.modules.base.Base):
else:
XML.SubElement(xml,
'blockBuildWhenUpstreamBuilding').text = 'false'
if 'auth-token' in data:
XML.SubElement(xml, 'authToken').text = data['auth-token']
if data.get('concurrent'):
XML.SubElement(xml, 'concurrentBuild').text = 'true'
else: