How to store VcsRoot for Versionized Setting within Git Repository?

Hi everyone. 

I have currently a bit a pain-point with using Versionized Settings due to it's "chicken-egg-problem". My goal is to store all my TeamCity related information within my Git repository, this includes the VcsRoot used by the "Versionized Settings" feature. I want developers to be able to adjust these settings via Git workflows and TC should pick them up.

To configure a new project in TC, you need to manually create the VcsRoot first. Then you can enable the Versionized Settings feature. At this point, if you named everything correctly, TeamCity detects that the VcsRoot you created manually, is actually stored in Git as well. It shows this properly in the UI: 

Unfortunately, the actual settings of this VcsRoot in Git are not picked up in my case. I changed the branchSpec within my Kotlin DSL with later commits, but the UI still shows old settings (while indicating correctly that there was a change in the history). 

I do not want to use DslContext.settingsRoot within my Build Configurations because this would make the TeamCity UI "master of data" but we want the code be master of data. Not all developers are allowed to change project configurations via the UI, but still we want to allow it through code. We have code reviews with approvals which ensures changes are done properly. 

Is it potentially a bug, misconfiguration or other problem that TeamCity does not actually change the Vcs Settings from Git even though it detects from the Synchronizing that there was a change? Is this potentially even an unsupported workflow? 

Any help on this topic is appreciated. 

Greetings
Daniel

2 comments
Comment actions Permalink

Any feedback on this? I just ran again into some troubles because of this. In our Kotlin DSL we specified `useTagsAsBranches = true` and i was wondering why TC does not pick up any tags we are pushing. After a long time of checking I found out that TC had different settings in the UI and the DSL option was not respected. 

I want to make my code the source of truth and we also have the `teamcity.ui.settings.readOnly` set to `true` to avoid anybody changing things in the UI. 

0
Comment actions Permalink

I've not been able to come up with a solution that matches your use case 1:1, but I've got two workarounds:

1. When the source code and the settings DSL share the repo, I create the VcsRoot in the root project DSL, and use the DslContext.settingsRoot. It means it's still in code, just not in the project repo. Depending on how tightly you control these different repos this might be unacceptable, but if you have solid code reviews and processes it might not be too big of a problem.

2. When the source code is in a different repo from the DSL, in our case we have many projects that share the same configuration "template", then the DSL root is created in the root settings DSL repo, and used when versioned settings are set up. The project repo URL along with any other VcsRoot settings are passed as DslContext parameters and the VcsRoot is constructed inside the DSL.

Neither of these approaches are really what you're looking for, I know, but it's the closest I've gotten so far.

I also recommend opening this as an issue/request in YouTrack, as YouTrack in my experience is getting more attention.

0

Please sign in to leave a comment.