How to have different TFS build templates trigger deployments to different Octopus deployments

Hi there,
I have two different TFS build templates, one is a CI build that is triggered on code check-in, the other is a scheduled build that is triggered at the end of the day.
Is it possible to have both of these builds send a nuget package up to Octopus whereby the CI build is deployed only to our Dev server, but the scheduled build is deployed to Dev and then on to the Test server?
What is the best way to achieve this?
Thanks and regards

Hi Myles,

Thanks for getting in touch!

The best way to achieve this would probably be to trigger the deployments separately.

I assume you’re using OctoPack to package and push your project to Octopus, using Automatic Release Creation to create a release, and then triggering a deployment using a Lifecycle that deploys to Dev automatically? If not, let me know :slight_smile:

You could leave this process in place, but add a post-build step in your nightly Build definition that triggered a promotion of your Dev deployment either using the API or the promote-release command in Octo.exe. Depending on which TF Build template you’re using, it might be as simple as specifying a script at the end of the build.

Good luck, and let me know how it goes!


Thanks for your quick reply Damian,
My colleague suggested something similar to what you have said.
We added a nuspec file to the project that accepts appends a parameter to the project name. I tried this and it means we can now upload different packages to Octopus based on a paramenter passed in in the MSBuild arguements.

eg /p:OctoPackNuGetProperties=parameterName=NightlyBuild

This is works well and it gives us flexibility to create different TFS build templates that will kick off different deployments.

Thanks again

Hi Myles,

Oh great work - that’s a nice solution - I’ll have to remember that for next time!