Automatically apply versioned setting patches
Completed
I've recently tried the versioned settings feature. Seems great except one thing.
Is there a way to automatically apply patches when versioned config changes are made from the TeamCity UI?
Say you work in a team of 10 people and 1 one of them is not that good in coding but would want to modify this and that through the UI.
Why is it mandatory for developers to manually apply and delete patches in the versioned settings repository?
An option to always sync settings would be awesome. Nevermind the merge conflicts that might occur since VCS is polled every N seconds.
Please sign in to leave a comment.
Hi Ab,
When changes are made from the UI, they took place immediately. If original kt/kts files don't hold any manual adjustments, we try to avoid generating patches and replace the files directly instead. There are still cases when it doesn't happen, but generally, we try to replace files directly.
But if those files contain manual changes from other contributors, wу don't have a choice but to generate the patches. In such a case, we won't be able to find a place in the file, which should be changed. If we tried to replace such a file containing custom code from other contributors, we'd risk to either break the compilation or break the logics inside the code.
Best regards,
Mikhail Efremov
Thanks for the reply, Mikhail.
Can you please confirm that:
If I have a bunch of patches in my VCS already, will I be able to merge them by disabling setting sync and enabling it again?
Then, both the manual changes and the changes done via the UI will be overwritten in the VCS without any patches.
Is that correct or am I missing something?
Hi Ab,
Overwriting your versioned settings in a repo in such a way will potentially ruin some of your code. Say, you have a code creating some builds in a loop. If you overwrite it in such a way, you will lose your loop. All those build configurations will be described separately in newly created kts files. That said, it is not advised to use such an approach, as it will potentially damage your source files and again, some logics might be lost. You should consider applying those patches manually. Per my knowledge, there is no safe way to apply them automatically.
Best regards,
Mikhail Efremov
I created a new project in the UI, and it appeared in a "patches" folder. I'm the only person managing this TC instance, so there was no possibility of conflict. I want to manage my settings from the UI, I just wanted to have the settings saved in VCS because it's easier to search and compare text files. How do I force TeamCity to apply the changes properly instead of putting them in a patches folder?
EDIT: I guess I can disable synchronization, make changes in the UI, and then re-enabling synchronization lets me overwrite the settings saved in VCS. I have to disable synchronization anyway because otherwise the Project ID field cannot even be edited. It's not great but it seems to work.
Daniel Chýlek
OMG You are such a life saver! I used to spend days and days trying to apply the stupid teamcity patches. now I know this way to automatically apply them! teamcity really should make a button to do this!