Using the "CustomInstallationDirectory" from one step in a another step

Hi all,

I have a few different steps that deploys a packages to a Custom Installation Directory, the Custom Install Directory looks like this:


This is processing the correct path of


Then the last step of my deployment process runs a script to make a junction point, currently I am calling:

$WebPath = $OctopusParameters['Octopus.Action[Deploy Web].Package.CustomInstallationDirectory']

to get the path of where my files are, but instead of getting:


I get:


and if I use

$WebPath = $OctopusParameters['Octopus.Action[Deploy Web].Output.Package.InstallationDirectoryPath']

I get a completely different path of:


Am I missing something here. Is there an easy way of getting the Custom Installation Directory between steps???

As you can see from the screenshots attached you should be able to use the Octopus.Action[StepName].Output.Package.InstallationDirectoryPath variable to get access to the install location from the previous steps. You mention that the path instead of containing web.company3 is actually web.company1. Do you have any idea where this value might be coming from? It seems odd that the 3 just turned into a 1 in the middle of a string. Presumably its from the #{Client} variable that has some scoping applied?

Could you provide a little more information about this deployment so I can work out of there is a potential bug in the code or possibly some invalid cross over of state between machines\roles\steps. If you could send through screenshots along with information on reproducing this step in the minimal way possible I will try and reproduce it locally and let you know what I find.

Thanks for getting in contact,

Hi Rob,

I have setup a test project and below is what it looks like. Also I am using Octopus v3.2.13

See first attachment

Step name: deploy web

**Run on targets roles: ** edinburgh-web-server

Custom Install directory: E:\temp\web.#{Client}.#{Environment}\#{Octopus.Release.Number}

see attachment

Step name: deploy app

**Run on targets roles: ** edinburgh-app-server

Custom Install directory: E:\temp\app.#{Client}.#{Environment}\#{Octopus.Release.Number}

see attachment

Script template

Step name: write out vars

**Run on targets roles: ** edinburgh-app-server edinburgh-web-server

powershell script:

write-host "Deploy App path"
Write-host "CustomInstallationDirectory Var = " $OctopusParameters['Octopus.Action[Deploy web].Package.CustomInstallationDirectory']
Write-host "InstallationDirectoryPath Var = " $OctopusParameters['Octopus.Action[Deploy web].Output.Package.InstallationDirectoryPath']
Write-host "Deploy App path"
Write-host "CustomInstallationDirectory Var = " $OctopusParameters['Octopus.Action[Deploy app].Package.CustomInstallationDirectory']
Write-host "InstallationDirectoryPath Var = " $OctopusParameters['Octopus.Action[Deploy app].Output.Package.InstallationDirectoryPath']
Write-host "Client var = " $OctopusParameters['client']

Using Variable sets - see attachment

The only thing I can think that would cause this is, even though with the Variable set we have scoped each on based on roles those roles are all on the same servers. See attachment.

So now I create and run a release and today InstallationDirectoryPath is using the correct path, client Variable is correct but CustomInstallationDirectory is still wrong. See last attachment

I think I will try using InstallationDirectoryPath again in our main process and see if it work across more then one project


I feel like I must be missing an important piece. I am running against the 3.2.13 codebase as you suggested and set up the project exactly as you have with 2 slight variations.

  1. Obviously I’m just pushing a random package (same on both) with no post/pre deployment scripts.
  2. You mentioned that the install path is E:\temp\app.#{Client}.#{Environment}\#{Octopus.Release.Number} as far as Im aware #{Environment} doesnt resolve to anything unless you have it set up as a project level variable. Ive used #{Octopus.Environment.Name}

Are there some other variables/ configuration that you haven’t sent through?
For the sake of experimentation can you remove the extra roles from the machines and see if the phantom role is leaking into the deployment.

Thanks for all the detailed information you already provided, I would think that usually it would be enough to diagnose the problem but this one seems especially “odd”.

Hi again,
Scratch that last comment. After getting another ticket with this same problem I think I managed to corner the problem and get a fix in.

When each action completes it takes all its specific action variables (those prefixed with Octopus.Action[...) and stores the evaluated values so that they can be used in subsequent actions. If the value itself was made up of another variable that had a value that was unscoped, it would use the unscoped value rather than the actual scoped variable value that was really used.

A fix for this has been committed and it should go out in our next release 3.2.16 in the next few days. Keep an eye out for this release and let us know if it fixes your problem.

Thanks again,

Thanks Rob, will keep an eye for it.