Variable substitution in Manual Intervention step

Hello,

As part of a deployment I am designing, I am implementing a manual intervention step. Part of this step is creating a manual backup of the existing application, as this is the first time that Octopus is being used to deploy this application. Being I am replacing the existing deployment model with this, I want a ‘rollback’ set up to be able to fall back on if something goes wrong.

I’m doing this with a powershell script. This script varies per environment. All I’d like to do in the deployment plan is to call out the environment name, and the script path in our source control to execute to handle the backup. The script would then be run in the console window to handle the backup. I’d like the message to be updated per environment with variable substitution by Octopus. While it works a bit… part of it does not. It seems that project variables are not being replaced, but Octopus variables are. See this message set up in the Manual Intervention step:

Run the following Powershell script in the Octopus script console to back up the current #{Octopus.Environment.Name} version of the admin application: #{RollbackScriptName}

When the deployment is run, the message becomes this:

Run the following Powershell script in the Octopus script console to back up the current DEV version of the admin application: #{BackupScriptName}

The ‘DEV’ text was clearly replaced by using the variable #{Octopus.Environment.Name} - but as you can see, the variable name #{BackupScriptName} still exists in the message. This variable is a local project variable and for whatever reason, doesn’t get replaced when the deployment is run.

Obviously, the Octopus variable was substituted here. So, does variable replacement work with custom variables in this step, or only built-in Octopus variables?

Hi Jeffrey,

Thanks for getting in touch. I tested this out and it worked perfectly for me. I have a couple guesses as to what might be he issue but I’d like to confirm one thing first.

Manual intervention step message:

Run the following Powershell script in the Octopus script console to back up the current #{Octopus.Environment.Name} version of the admin application: #{RollbackScriptName}

Output:

Run the following Powershell script in the Octopus script console to back up the current DEV version of the admin application: #{BackupScriptName}

I noticed you used two different variables above. #{RollbackScriptName} and #{BackupScriptName}. I just wanted to confirm that this is a typo in your email and you’re not accidentally referencing an old variable.

If that is indeed a typo, then we need to dig deeper. My first guess is that potentially variable scoping is preventing that variable from getting a value. Can you provide a deployment log and a screenshot of your manual intervention step and variables page? This should help identify the problem.

You can learn more about getting the log file at the following URL.

BTW - Feel free to make this message private if you there is anything sensitive.

Let me know how you go.

Rob