Is there a way to force a default value for a parameter in TeamCity and not lose it once a different value has been set?

走远了吗. 提交于 2019-12-12 10:49:03

问题


I have a parameter for which I'm showing a prompt. I've set a default value for it and that works fine.
What doesn't work, however, is that if I choose to enter a different value when running the build, then on the next build this value automatically becomes the new default value, so to say.

I'd like the default value to always be fixed and if you enter a different value in the field, then that value will be used just for this build (and the next build will fallback to the fixed, default value for this parameter).

Is this possible and how can it be done?


回答1:


Currently it's not possible. The related request is https://youtrack.jetbrains.com/issue/TW-21453, please vote. As of now you can use "Reset" link.




回答2:


As far as I know, there's no built-in solution for this.

To solve your problem, you could use a Command Line (or Powershell) Build Runner that runs as the last step of the build. There you can reset your parameter by setting it to the desired default value using this as script content:

##teamcity[setParameter name='your.parameter' value='desiredDefaultValue']

I would recommend using a separate parameter to save desiredDefaultValue instead of a hard-coded value.



来源:https://stackoverflow.com/questions/33869349/is-there-a-way-to-force-a-default-value-for-a-parameter-in-teamcity-and-not-lose

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