Solution in one branch but not in another
Hello,
We have a parallel development scenario that is starting with two branches: release/5.0 and hotfix/4.5
The release/5.0 development has added a new visual studio solution, foobar.sln, and a new CI Build step was added to add it to the CI builds.
The problem is, we have a generic VCS so that any change to release/* or hotfix/* would just trigger the ci-build. But hotfix/4.5 does not have foobar.sln, so that obviously fails.
I know that I can create separate CI projects for the branches, with different VCS settings, but I'm hoping there is a more elegant way whereby I can do something so that foobar.sln only compiles on the release/5.0 branch (and later), or perhaps is skipped on the hotfix/4.5 branch.
Is this ability in TC, or is copy/paste/modify the only solution?
Thanks in advance.
Please sign in to leave a comment.
You can set up the VCS trigger on that build to ignore the hotfix/* branch (or the hotfix/4.5 in particular), as well as to only include the release/5.0. More information on how to set it up here: https://confluence.jetbrains.com/display/TCD10/Configuring+VCS+Triggers#ConfiguringVCSTriggers-BranchFilterbranchFilter
Hello Denis,
Thank you for the response. I looked in to this and I see how this could be used. Then I looked at the infrastructure we have set up and I don't think it's applicable to us. But it might be. I'm hoping you can teach me some more.
I looked at what we have established and found that we have 10 solutions in branch-X of the repository and 11 solutions in branch-Y of the repository.
The infrastructure is set up with a:
'Build All Solution" rule that has each of the solutions as snapshot dependencies.
The 'Build All Solution' has the trigger "if any file except for the foobar file changes do build all"
For what you shared, I think I know how to do it if each of the solutions had triggers, but in this case it's one 'master' rule that takes the trigger and then causes each of the dependencies to compile. However, since branch-X doesn't have one of the solutions, one of it's dependencies fails.
Is there a way to adapt what you shared to our scenario?
One alternative I can think of is to remove the 'Build All' trigger and put a trigger on each of the solutions instead. However, I'm hoping that's not the only solution due to the number of changes needed to achieve that.
Thank you.
Hi John,
judging from your structure, I'd say that yes, changing the build structure to building all solutions separately would make more sense than having all the solutions be built together. This would allow for a much more granular control. You can use templates, parameters and meta runners for the shared code, but it would be much more flexible to changes, as you are experiencing right now.
This said, there might be another workaround. I'm trying to reword what you said into TeamCity terminology for clarity. You have a "Build All Solutions" build configuration, with a snapshot dependency on all the solutions and a VCS Trigger configured for all branches.
What you could do is create a single other build configuration "Build all old solutions" that only depends on the initial 10. Then modify the original VCS Trigger to trigger on the new branch, and the second one to only do so on the older branches that contain only the older solutions.