问题
I would like to use the Version Number Plugin to format the BUILD_NUMBER variable.
I've configured it in the following way: image
Environment Variable Name: FORMATTED_BUILD_NUMBER Version Number Format String: ${BUILD_NUMBER,XXX}
But when I'm using the FORMATTED_BUILD_NUMBER variable (${FORMATTED_BUILD_NUMBER}) it returns the un-formatted build number.
So I would like to see something like: 032 but it returns 32.
回答1:
This is not supported. Formatting of the strings is done in function formatVersionNumber. It does not use the token macro plugin but parses the string itself, and only considers the variables it mentions in its documentation (BUILD_DATE_FORMATTED
et cetera). I'd guess the latter does not allow to pad a string to a given length.
The docs are not complete in this regard. You wouldn't know this plugin supports padding at all if you not happen to read the BUILD_DAY
table entry.
来源:https://stackoverflow.com/questions/45252515/jenkins-version-number-plugin-build-number