Make TeamCity Use Versionized Settings from Pull Request Branch

Answered

I have a setup where I have: 

  1. Added a new VCS root to one of my projects in TeamCity via UI pointing to the repository of my product. 
  2. Enabled versionized settings for this project and configured it to "use settings from VCS" 
  3. Added subprojects, additional VCS roots and buildconfigurations using the Kotlin DSL where the pull request feature is active

When I now: 

  1. Create a new feature branch where I make various changes to my teamcity settings
  2. Open a Pull Request

The builds will start, but they will still use the settings from the develop (default) branch of the VCS root created via UI. In the "Changes" tab I can see that it pulls the changes from the two VCS roots: 

  1. (jetbrains.git) GitHub Develop and Release Branches | refs/pull/123/head <hash>
  2. (jetbrains.git) GitHub CI | refs/heads/develop

The build step I added in the pull request is missing during execution. What is needed to make TeamCity use the settings from the pull request? We have a strict integration policy with code reviews and green PR checks and I would like to treat changes to the build configuration just like changes to the product itself. For this the builds on the PR need to use the updated settings of the related branch. 

I hope somebody can help me out here. 

Greetings
Daniel

0
1 comment

Nevermind, I figured it out by trial and error having some assumptions. 

How I solved it: 

  1. I moved the VCS Roots from the Sub-Project to the Root Project. 
  2. I selected the moved VCS Root as new root for versionized settings 
  3. I removed again the UI created "GitHub CI" VCS Root. 

It seem important that the VCS root for versionized settings is on the same level as the versionized settings configuration. Once this is given, you can select it. 

This allows me to have the VCS root for versionized settings also within the versionized settings. I was concerned about a chicken-egg problem but it somehow sorted out for me with stepwise changes. 

 

Topic closed 😁

0

Please sign in to leave a comment.