Prevent Release and Deployment for TeamCity Personal Builds

Hi,

I am using TeamCity ro build a IIS web site, which I then deploy using Octopus Deploy. The following are my build steps:

  1. NuGet Installer
  2. MSBuild - Builds my solution and calls OctoPack. Then publishes to the built in package repository.
  3. OctopusDeploy: Create release - Creates my release according to specifications and deploys to my Dev environment.

My issue is, a release and deployment occurs every time a personal build runs successfully. How do I prevent that? I just want releases and deployments for successful “non-personal” builds.

Thank you!

Hi,

Thank you for getting in touch.

You would need to setup TeamCity to not run that step on personal builds. It is most likely you would need to split the 3rd step into a separate build configuration, link them via dependencies and setup the triggers so the first triggers on a personal build and the second on other builds. You’d have to refer to JetBrains and TeamCity docs on how best to achieve that.

If you were ok with the release being created, and you could differentiate the release based on something in the release number (eg in the pre-release tag), you could setup two channels. Setup one “Personal” channel with a package rule that matches those release numbers, and the default channel with a package version rule that excludes those packages. The auto-release creation process will choose the best matching channel. Then you would assign different lifecycles to each channel, with the Personal one not auto-deploying.

Hope that helps

Robert W

Hi Robert,

I was able to solve this by using octo.exe.
For reference, I am going to share my solution:

  1. Install octo.exe in your solution (available on the Octopus Deploy downloads website).
  2. The key is to harness the Build Parameter “BUILD_IS_PERSONAL”. Use that to add a Command Line step in TeamCity. Now if BUILD_IS_PERSONAL is true, exit the step there. Otherwise, call octo.exe push … and octo.exe create-reelase … (whose format is already available to you in the build logs of the wrapped steps (OctopusDeploy: Push Packages and OctopusDeploy: Create Releases in TeamCity).

Simply put, remove wrapped steps, add command line script and use octo.exe

Feel free to follow up.
G Singh

Thanks for sharing your solution.