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?
Asked Answered
R

2

6

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?

Retiarius answered 23/11, 2015 at 10:57 Comment(0)
P
5

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.

Politics answered 27/11, 2015 at 16:39 Comment(0)
R
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.

Refer answered 23/11, 2015 at 16:5 Comment(1)
Sorry, I had to downvote this. I am facing the same issue. The thing is, this resets the parameter's default value, but it won't reset the value the user inserted. So next time the user clicks run, the dialog will still contain the old value.Rosenblatt

© 2022 - 2024 — McMap. All rights reserved.