0
votes

I'm setting up teamcity and I have 2 Projects using the same VCS root, Build and Deploy.

Is there a way I can:

  • Trigger the build project on all branches except master
  • Trigger the deploy project only on master

I have it set to automatically trigger but both projects still show pending changes and a user can still manually run deploy on any branch they wish.

Build Trigger Branch filter:
+:*
-:<default>

Deploy Trigger Branch filter:
+:<default>
-:*

Do I need to configure the VCS root twice with different branch specifications?

Please let me know if I need anything else.

Thanks for your help. Kurtis

1
is it correct that you want to deploy master, but not trigger to build master?Senior Pomidor
Yeah. So the deploy project builds, test and packages up the project. The build project just builds and tests. ThanksKurtis
what is the reason to build branches if they will not be deployed?Senior Pomidor
I want other branches to build and run test so we have a place to immediately see if a branch is safe to merge into master. I've used GitLab CI before and in the merge request, if the build fails for that branch, you wouldn't be able to merge it in.Kurtis

1 Answers

1
votes

unfortunately, you can't.

But you have to do the follows:

  • Delete ability to run Build and Deploy configuration from users.
  • Set trigger +:*; -:<default> for a Build

I hope the Deploy has dependencies from a Build.

  • create the new Deploy configuration, let's say Deploy only master
  • Add snapshot dependency from Deploy
  • define hidden variable reverse.dep.*.teamcity.build.branch with value <default>

So, nobody cannot run Build, and Deploy. If someone runs Deploy only master and select another branch it will not work because you will replace the teamcity.build.branch to master