Adds support for prefix-variable in version-number wrapper

prefix-variable is currently not available for use in the version-number wrapper.
updated wrapper for support of this variable
and updated test fixtures to also use this variable.

set default value of prefix-variable to ''
Errors out without a default value set saying the attribute is missing,
and since this is an optional attribute we don't want that.

Task: 4885
Change-Id: I151eef271194fb38dfde7518698f2ff06e3a8f01
This commit is contained in:
OJ LaBoeuf 2017-08-14 12:25:31 -07:00
parent b402d7800c
commit c052a70837
3 changed files with 5 additions and 0 deletions

View File

@ -2358,6 +2358,8 @@ def version_number(parser, xml_parent, data):
number to (required)
:arg str format-string: Format string used to generate version number
(required)
:arg str prefix-variable: Variable that contains version number prefix
(optional)
:arg bool skip-failed-builds: If the build fails, DO NOT increment any
auto-incrementing component of the version number (default: false)
:arg bool display-name: Use the version number for the build display
@ -2387,6 +2389,7 @@ def version_number(parser, xml_parent, data):
# option, xml name, default value
("variable-name", 'environmentVariableName', None),
("format-string", 'versionNumberString', None),
("prefix-variable", 'environmentPrefixVariable', ''),
("skip-failed-builds", 'skipFailedBuilds', False),
("display-name", 'useAsBuildDisplayName', False),
("start-date", 'projectStartDate', '1970-1-1 00:00:00.0 UTC'),

View File

@ -4,6 +4,7 @@
<org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder>
<environmentVariableName>relVersion</environmentVariableName>
<versionNumberString>${BUILD_DATE_FORMATTED, &quot;yy.M&quot;}.${BUILDS_THIS_MONTH_Z}</versionNumberString>
<environmentPrefixVariable>relVersion</environmentPrefixVariable>
<skipFailedBuilds>false</skipFailedBuilds>
<useAsBuildDisplayName>false</useAsBuildDisplayName>
<projectStartDate>1970-1-1 00:00:00.0 UTC</projectStartDate>

View File

@ -1,4 +1,5 @@
wrappers:
- version-number:
variable-name: relVersion
prefix-variable: relVersion
format-string: ${BUILD_DATE_FORMATTED, "yy.M"}.${BUILDS_THIS_MONTH_Z}