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:
parent
45644bf8e5
commit
3ce78059c9
@ -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
|
||||
|
@ -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
|
||||
|
14
tests/parameters/fixtures/run-param001.xml
Normal file
14
tests/parameters/fixtures/run-param001.xml
Normal 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>
|
5
tests/parameters/fixtures/run-param001.yaml
Normal file
5
tests/parameters/fixtures/run-param001.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
parameters:
|
||||
- run:
|
||||
name: FOO
|
||||
project-name: "foo-build"
|
||||
description: "Select a foo-build for promotion"
|
Loading…
x
Reference in New Issue
Block a user