Merge "Add Promoted Build parameter."

This commit is contained in:
Jenkins 2016-04-23 23:25:02 +00:00 committed by Gerrit Code Review
commit 044f1b46b3
5 changed files with 70 additions and 0 deletions

View File

@ -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.

View 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>

View File

@ -0,0 +1,6 @@
parameters:
- promoted:
name: FOO
project-name: "foo-build"
promotion-name: "passed-promotion"
description: "Select a foo-build for promotion"

View 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>

View File

@ -0,0 +1,4 @@
parameters:
- promoted:
name: FOO
project-name: "foo-build"