Jenkins Version Number Plugin BUILD_NUMBER

只谈情不闲聊 提交于 2019-12-11 06:35:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!