Add support for build parameter of type "Run"

Defines a run parameter for parametrized build, where users can pick a
single run of another project. The absolute url of this run will be
exposed as an environment variable.

Change-Id: I86bc3109b00259f9fe3dcf7ab9d72cb1f22fadc2
This commit is contained in:
Michael Tupitsyn 2014-10-03 13:31:59 -07:00 committed by Khai Do
parent 45644bf8e5
commit 3ce78059c9
4 changed files with 39 additions and 0 deletions

View File

@ -197,6 +197,25 @@ def choice_param(parser, xml_parent, data):
XML.SubElement(a, 'string').text = choice
def run_param(parser, xml_parent, data):
"""yaml: run
A run parameter.
:arg str name: the name of the parameter
:arg str project-name: the name of job from which the user can pick runs
:arg str description: a description of the parameter (optional)
Example:
.. literalinclude:: /../../tests/parameters/fixtures/run-param001.yaml
:language: yaml
"""
pdef = base_param(parser, xml_parent, data, False,
'hudson.model.RunParameterDefinition')
XML.SubElement(pdef, 'projectName').text = data['project-name']
def validating_string_param(parser, xml_parent, data):
"""yaml: validating-string
A validating string parameter

View File

@ -95,6 +95,7 @@ jenkins_jobs.parameters =
file=jenkins_jobs.modules.parameters:file_param
label=jenkins_jobs.modules.parameters:label_param
password=jenkins_jobs.modules.parameters:password_param
run=jenkins_jobs.modules.parameters:run_param
string=jenkins_jobs.modules.parameters:string_param
svn-tags=jenkins_jobs.modules.parameters:svn_tags_param
text=jenkins_jobs.modules.parameters:text_param

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.RunParameterDefinition>
<name>FOO</name>
<description>Select a foo-build for promotion</description>
<projectName>foo-build</projectName>
</hudson.model.RunParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
</project>

View File

@ -0,0 +1,5 @@
parameters:
- run:
name: FOO
project-name: "foo-build"
description: "Select a foo-build for promotion"