How to deploy C++ packages nicely to several servers

Hi there,

we’re using Octopus for our own software deployment but have recently started experimenting with deploying other software bits, too.

I’m currently looking into deploying Visual C++ Redist. packages because a lot of our applications (thus our servers) need them. I have already created an Octopus project for this and I have a powershell script correctly identifying whether the package is already installed. The script sets an Octopus variable “IsAlreadyInstalled”.

Here are my questions:

  1. When deploying such a package to n servers, is the variable going to be set individually for each server (e.g. server a needs the package, server b doesnt) or is this “global” to the process?
  2. During the “Deploy package” step I try to consume the “IsAlreadyInstalled” variable as a condition. I tried simply stating “#IsAlreadyInstalled” as well as “#{if IsAlreadyInstalled != True} {/if}”. The problem is that the deployment step never went further than “acquiring packages”.

Last but not least, any better idea on how to deploy such dependencies with Octopus?

We are using Ocotpus 4.1.5.

Thanks for any input,
Chris

Hi Chris,

Thanks for getting in touch! When you create an output variable on multiple machines, a variable gets created that is scoped to the specific machine it’s run on. Multiple variables get created, which allows you to reference values specific to each machine.

It looks like the problem you’re running into is the fact that run conditions are evaluated for the step as a whole, instead of being evaluated for each machine. This means that the variables that are evaluated in the step’s run condition aren’t scoped to machines. Either the condition is satisfied and runs against every machine, or it’s not satisfied and doesn’t run against any machines.

Perhaps an option in theory would be to manually check the value of the variable at the beginning of your package step (that currently has your run condition defined on) as a predeploy script to skip the rest of the step if the value of the variable indicates that you don’t want to continue. I think this should work since when the script gets executed, the variables will be scoped to the specific machine that the script is running on.

I hope this helps get you going! I’m sorry it’s not the exact news you were hoping for, but please let me know how you go or if you have any further questions moving forward.

Best regards,

Kenny

1 Like

Hey Kenny,

thank you for your quick reply. I understand your angle and I have re-arranged the steps a bit. I just use the deploy package step now. In the pre-deployment I search for the package and set the variable accordingly and in the post deployment script I evaluate the variable to decide whether I should run the installer. This doesnt save me from deploying the package but I think thats okay.

Thanks for your help, seems to work nicely now :-).

Cheers,
Chris

Hi Chris,

Thanks for following up and letting know you’ve gotten it to work nicely! That’s great to hear. Don’t hesitate to reach out if you come across any other questions or concerns moving forward. :slight_smile:

Best regards,

Kenny

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.