Add Promoted Build parameter.
Change-Id: Ic995976a9c2596c8579963512e20a44087641dce Co-Authored-By: Steven Armstrong <Steven.9.armstrong@gmail.com>
This commit is contained in:
parent
b52cafb498
commit
3da732e01e
@ -74,6 +74,36 @@ def string_param(parser, xml_parent, data):
|
||||
'hudson.model.StringParameterDefinition')
|
||||
|
||||
|
||||
def promoted_param(parser, xml_parent, data):
|
||||
"""yaml: promoted build
|
||||
A promoted build parameter.
|
||||
Requires the Jenkins :jenkins-wiki:`Promoted Builds Plugin
|
||||
<Promoted+Builds+Plugin>`.
|
||||
|
||||
:arg str name: the name of the parameter (required)
|
||||
:arg str project-name: the job from which the user can pick runs (required)
|
||||
:arg str promotion-name: promotion process to choose from (optional)
|
||||
:arg str description: a description of the parameter (optional)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/parameters/fixtures/promoted-build-param001.yaml
|
||||
:language: yaml
|
||||
|
||||
"""
|
||||
pdef = base_param(parser, xml_parent, data, False,
|
||||
'hudson.plugins.promoted__builds.parameters.'
|
||||
'PromotedBuildParameterDefinition')
|
||||
try:
|
||||
XML.SubElement(pdef, 'projectName').text = data['project-name']
|
||||
except KeyError:
|
||||
raise MissingAttributeError('project-name')
|
||||
|
||||
XML.SubElement(pdef, 'promotionProcessName').text = data.get(
|
||||
'promotion-name', None)
|
||||
|
||||
|
||||
def password_param(parser, xml_parent, data):
|
||||
"""yaml: password
|
||||
A password parameter.
|
||||
|
15
tests/parameters/fixtures/promoted-build-param001.xml
Normal file
15
tests/parameters/fixtures/promoted-build-param001.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.plugins.promoted__builds.parameters.PromotedBuildParameterDefinition>
|
||||
<name>FOO</name>
|
||||
<description>Select a foo-build for promotion</description>
|
||||
<projectName>foo-build</projectName>
|
||||
<promotionProcessName>passed-promotion</promotionProcessName>
|
||||
</hudson.plugins.promoted__builds.parameters.PromotedBuildParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
</project>
|
6
tests/parameters/fixtures/promoted-build-param001.yaml
Normal file
6
tests/parameters/fixtures/promoted-build-param001.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
parameters:
|
||||
- promoted:
|
||||
name: FOO
|
||||
project-name: "foo-build"
|
||||
promotion-name: "passed-promotion"
|
||||
description: "Select a foo-build for promotion"
|
15
tests/parameters/fixtures/promoted-build-param002.xml
Normal file
15
tests/parameters/fixtures/promoted-build-param002.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.plugins.promoted__builds.parameters.PromotedBuildParameterDefinition>
|
||||
<name>FOO</name>
|
||||
<description/>
|
||||
<projectName>foo-build</projectName>
|
||||
<promotionProcessName/>
|
||||
</hudson.plugins.promoted__builds.parameters.PromotedBuildParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
</project>
|
4
tests/parameters/fixtures/promoted-build-param002.yaml
Normal file
4
tests/parameters/fixtures/promoted-build-param002.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
parameters:
|
||||
- promoted:
|
||||
name: FOO
|
||||
project-name: "foo-build"
|
Loading…
Reference in New Issue
Block a user