Kotlin DSL dynamic select parameter population

I have a similar problem to this question: https://teamcity-support.jetbrains.com/hc/en-us/community/posts/360001222619-Conditional-step-with-kotlin-dsl. I have a bunch of integration tests that developers need to execute on a selectable docker image tag. Tags get pushed to the docker registry constantly. So far we used https://plugins.jetbrains.com/plugin/9076-web-parameters to dynamically populate the select parameter from a Rest API call.

Now that we are moving to Kotlin DSL I am facing the following problem that I am unable to populate the select options with the possible docker tags the moment when a developer wants to start a build.

Either I would like to continue to use the web-parameters plugin but I have not found a way to do this from Kotlin code.

Or I would like to code the call to my Rest API myself and execute this every time someone wants to start a build.

My current understanding is that neither currently is possible. Plugins are not available and the TC Koltin DSL is generating a static configuration when updates are fetched.

Am I missing something, is my understanding correct?

At the moment I am contemplating an insane solution as to push to git every time a docker tag is added/changed so that TC server regenerates the config :/

 

Edit: Ok I figured out how to use the web-populated plugin by looking at the code generated by "View DSL". Immediate problem solved. Still I would like to know if there is any way to get similar functionality w.o. use of a plugin?

0
1 comment

Hi Kai,

 

first of all, for the kotlin dsl - plugins issue, please check this issue in our tracker: https://youtrack.jetbrains.com/issue/TW-54064 . Also, as this isn't a bundled plugin, but a third party one, there is little we can do here to help. Maybe asking the dev for some insight could help.

 

With this in mind, there might be some other ways to accomplish this. Even if you cannot add the feature via the Kotlin DSL, you can create a parameter with it on a parent project that is not under the DSL and it will be inherited by all children.

 

If you need per-build-config or per-project configuration, it seems like you can use configuration parameters in most, so simply setting those up as parameters in the builds themselves should work. I understand that would make the parameter show up in every build configuration that comes from that parent, even those that don't need it, but it's the easiest workaround at the moment.

 

Would that help?

0

Please sign in to leave a comment.