summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs
diff options
context:
space:
mode:
authorIgor Lakhtenkov <lakhtenkov@gmail.com>2020-05-22 16:32:44 +0300
committerIgor Lakhtenkov <lakhtenkov@gmail.com>2020-05-22 17:04:49 +0300
commit2eb74a15cd8e237902578321b2f131cffe7757fc (patch)
treee157b22ffe2a3411b137a1e36fa54d9d1b713e0f /jenkins_jobs
parent4e1e1c7524dcf5edc1a91ef2663b9bf25ae577d3 (diff)
downloadpython-jenkins-job-builder-2eb74a15cd8e237902578321b2f131cffe7757fc.tar.gz
python-jenkins-job-builder-2eb74a15cd8e237902578321b2f131cffe7757fc.tar.xz
python-jenkins-job-builder-2eb74a15cd8e237902578321b2f131cffe7757fc.zip
Added trim option for String parameter.
Task: #22637 Change-Id: Ic2722aac586d3911e3ff5ab4c2d3c5a7a03fa14e
Diffstat (limited to 'jenkins_jobs')
-rw-r--r--jenkins_jobs/modules/parameters.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/jenkins_jobs/modules/parameters.py b/jenkins_jobs/modules/parameters.py
index fca02e1c..37030617 100644
--- a/jenkins_jobs/modules/parameters.py
+++ b/jenkins_jobs/modules/parameters.py
@@ -61,6 +61,8 @@ def string_param(registry, xml_parent, data):
:arg str name: the name of the parameter
:arg str default: the default value of the parameter (optional)
:arg str description: a description of the parameter (optional)
+ :arg bool trim: strip whitespaces from the begnning and end
+ of the string (optional, default: false)
Example::
@@ -69,11 +71,15 @@ def string_param(registry, xml_parent, data):
name: FOO
default: bar
description: "A parameter named FOO, defaults to 'bar'."
+ trim: true
"""
- base_param(
+ pdef = base_param(
registry, xml_parent, data, True, "hudson.model.StringParameterDefinition"
)
+ mapping = [("trim", "trim", False)]
+ helpers.convert_mapping_to_xml(pdef, data, mapping, fail_required=True)
+
def promoted_param(registry, xml_parent, data):
"""yaml: promoted build