Latest release/version per machine

Hi

We have a complex customer/deployment model and need to tack some things onto OD to complete our needs. One need specifically is to track(find) the latest/successful deployment to a machine. We need to run previous releases/deployments on machines that are ‘behind’. I’m not seeing anything in OD that would allow us to do this, so I’m attempting to write a c# helper application that can run previous releases in order to bring some machines up to the current release…

Hi Justin,

Thanks for getting in touch. The scenario where a new machine gets added to a pool and the latest code gets pushed to it is something we’ve been asked before, and that we are working on. It was briefly mentioned in this blog post http://octopusdeploy.com/blog/rfc-cloud-and-infrastructure-automation-support

At the current moment the best approach is to figure out which is was the latest successfully deployed release and then deploy it to a subset of machines (the ones “behind”). Which is what you are trying to do.

Writing a C# helper using the Octopus.client library is a good approach. If you’d like to avoid doing that you can use tools that already exist like Octoposh and Octo.exe. The process should be somethink like this

  1. Use the cmdlet Get-OctopusDeployment from the Octoposh module to get the latest successful deployment and the release it belongs to.

  2. Use Octo.exe deploy-release to deploy the latest successful release to the subset of machines

This gist shows how to make these 2 steps work together

Hope that helps!

Dalmiro

Hi Dalmiro,

The problem that I’m running into is that the tentacles are queuing the release deployments. Example: I want to deploy version 7.1.50 to QA environment. The latest version deployed to that environment was 7.1.40. I have a c# application and database that stores the latest version for all machines. Lets say that in the QA environment there is 2 machines that have version 7.1.30 (according to what our database says) - so my logic says ok, we need to kick off a release of 7.1.40 to those 2 machines before I do the 7.1.50 release, and I do this through the Octopus API using the --specificmachines parameter. This works fine EXCEPT, since I’m doing this in the context of releasing 7.1.50 from within Octopus, then those releases are queued and I have a deadlock situation. My c# application has logic that will loop/poll on the tasks that were created by the release to the specific machines, that way all machines are up to date before the 7.1.50 release proceeds. I thought there was a setting to tell a tentacle to run more than 1 job at a time, but either I misunderstood, or its not working…
Again heres the process
Octopus deploy (web UI) -> deploy release -> first step in deploy process calls a c# executable passing the project, release, and environment as parameters. C# application checks our own database for latest release for each machine in the environment - it they are behind, we want to use OD to push those previous releases to those machines, before handing control back to OD so it can proceed with next step in the deployment process.

Getting back with me as soon as possible would be great. I’m working on a POC to prove that OD can work for us before we purchase licensing (we will need an Enterprise license)

Thanks
Justin

Hi Dalmiro,
The problem that I’m running into is that the tentacles are queuing the release deployments. Example: I want to deploy version 7.1.50 to QA environment. The latest version deployed to that environment was 7.1.40. I have a c# application and database that stores the latest version for all machines. Lets say that in the QA environment there is 2 machines that have version 7.1.30 (according to what our database says) - so my logic says ok, we need to kick off a release of 7.1.40 to those 2 machines before I do the 7.1.50 release, and I do this through the Octopus API using the --specificmachines parameter. This works fine EXCEPT, since I’m doing this in the context of releasing 7.1.50 from within Octopus, then those releases are queued and I have a deadlock situation. My c# application has logic that will loop/poll on the tasks that were created by the release to the specific machines, that way all machines are up to date before the 7.1.50 release proceeds. I thought there was a setting to tell a tentacle to run more than 1 job at a time, but either I misunderstood, or its not working…
Again here’s the process -
Octopus deploy (web UI) -> deploy release -> first step in deploy process calls a c# executable passing the project, release, and environment as parameters. C# application checks our own database for latest release for each machine in the environment - it they are behind, we want to use OD to push those previous releases to those machines, before handing control back to OD so it can proceed with next step in the deployment process.
Getting back with me as soon as possible would be great. I’m working on a POC to prove that OD can work for us before we purchase licensing (we will need an Enterprise license)
Thanks

Justin Coon
AmerisourceBergen
Software Architect
IntrinsiQ Specialty Solutions

1701 S. Enterprise Ave. Suite 104
Springfield, MO 65804

image001.png

Hi Justin,

Thanks for the detailed description. Your approach does make sense if you are absolutely forced to deploy 7.1.40 before 7.1.50. If the changes on each build were cumulative though, it would be a lot easier as you’d only have to deploy the latest each time. But I understand this is not the case :). Do remember though that we will be doing something to support this scenario as out of the box as possible.

This is the setting you are talking about to run multiple processes on a Tentacle. Is it not working for you?

Thanks,

Daliro

Correct this is not working. I want to verify though, is the setting value case sensitive and in the screen shot I see a ServerName variable, is that also required?

Thanks
Justin

The setting works when the deployment is triggered outside of Octopus web app UI (when I do it programmatically through the API). If I trigger a deployment through OD UI then a deadlock occurs - the deployments that I have triggered are waiting in the queue for the one which initiated it all in the UI

Sorry actually its not working at all. If I deploy release 2.5 to environment A, in my deployment process, i call the c# executable which determines that machine 1 is on release 2.3, so release 2.4 is deployed to machine 1 via OD API, and then the c# executable loops, waiting for the 2.4 release to complete before passing control back to OD. This shows that the tentacle is executing serially so therefore Im at a deadlock. The 2.4 deployment cant complete because the tentacle will not start it till 2.5 deployment is finished, and 2.5 will not proceed until the 2.4 deployment proceeds. :frowning:

Sorry to seem pushy - any updates on this? This is a blocking item for us

Hi Justin,

I’m so sorry for the delay here. Somehow this ticket got stuck at the bottom of my queue. In theory this should work after setting the variable I mentioned earlier. The variable Is not case sensitive and you do not need that other variable. Could you please help me out providing this info so I can test this on my end?

  1. Enable the 2 variables mentioned on this doc in your project http://docs.octopusdeploy.com/display/OD/Debug+problems+with+Octopus+variables

  2. Create a new release (so the new variables take effect), and deploy it

  3. Send me the deployment raw log http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task

  4. Let me know exactly which version of Octopus are you running so I can try to reproduce it.

  5. Just to double check, you are triggering the 2nd deployment from the first one using Octo.exe with the --specificMachines argument, correct?

Thanks and again my sincere apologies for the delay. I’ll stay on top of this ticket to make sure I read your reply asap.

Dalmiro