How to set the ScriptBody when calling Calamari

(Steve Opalenski) #1

I’m working with Offline Deployment Packages and trying to extract variables from an encrypted variable set file. The Calamari version is Octopus Deploy: Calamari version 4.9.5

I’m attempting to do this by calling a Calamari.exe run-script with a -script argument as the Offline Deployment ps1 script does.

When I do this Calamari spits out this warning:

The `--script` parameter is deprecated.
Please set the `Octopus.Action.Script.ScriptBody` and `Octopus.Action.Script.ScriptFileName` variable to allow for variable replacement of the script file.


I’d like to get variable replacement in the script I’m running so I’d like to set the Octopus.Action.Script.ScriptBody and Octopus.Action.Script.ScriptFileName variables as suggested.

How do I do this when calling Calamari from the command line?

Thanks in advance.

(Daniel Fischer) #3

Hi Steve,

Thanks for getting in touch! I’ll need to get some more details from you to get a better idea of how I can help.

When you create an offline drop deployment, Octopus packages everything up so that no changes need to be made to the deployment before it can be executed. We also do not have the ability to edit the encrypted variable files once they are created.

Would you be able to provide some additional details around your requirements here?

Some further information about how you are incorporating calamari.exe into your offline drop may help me get you pointed in the right direction to get this working how you require.

Looking forward to hearing from you and getting to the bottom of this.

Best regards,

(Steve Opalenski) #4

Hi Daniel,

We’re trying to use Offline Deployments to feed into a Packer job to build AWS AMIs with our stuff installed. We used to rig this before within Octopus Deploy using Chain Deployments.

One of the variables in the Variable Set is used later on in the Packer job to identify the AMI. I was trying to get at that variable within the offline deployment package so I could feed it to the Packer job.

Would a better approach be to emit the variable as an output variable?

I hope this provides enough detail. Let me know if you need more.


(Daniel Fischer) #5

Hi Steve,

Thanks for the additional information here. I think using an Output Variable here would be a good approach to this. Since you can not browse and variables inside of the encrypted variable file, Output Variables will let you achieve exactly what you need.

If you need any help getting this to work or run into any issues, please don’t hesitate to let me know. :slight_smile:

Best regards,

(Steve Opalenski) #6

Hi Daniel,

Thank you for the feedback.

I’ll try using the output variable to get at what I need.

Thanks again!

Kind Regards,

(Steve Opalenski) #7

Hi Daniel,

I’m curious, how do I get the Output Variable to be included in an Offline Deployment package?

I tried putting

Set-OctopusVariable -name "AppInstanceName" -value "MyAppInstance"

in a Custom Deploy script and I didn’t see it in the resulting Offline Deployment package.

This is on Octopus v2018.8.7


(Daniel Fischer) #8

Hi Steve,

Sorry for the long delay in getting back to you here. The Output Variable can be called a couple of different ways depending on how you are using it.

It is worth noting that you will need to reference the step in which you create the Output Variable when you are trying to call it.

For example: $OctopusParameters["Octopus.Action[StepA].Output.AppInstanceName"]

An offline deployment should have no trouble creating and evaluating an Output Variable. If you could provide some more information about how you are attempting to set and then call this Output Variable, I should be able to provide you with some more help on this.

Looking forward to hearing from you. And sorry again for the delay in responding here.

Best regards,