Custom installation Directory Variable

Hello I am trying to create a variable that allows me to select a specific path for package installatioin based on the environment. I am receiving errors regarding absolute path. what would be the best way to define the custom install directory variable?

Hi @Aaron.Clark

Thanks for getting in touch with Octopus!

Usually, with the custom installation directory feature, I recommend the use of a project/tenant variable and have multiple values assigned, each value scoped to the appropriate environment for your use case.

I don’t know exactly what errors you are receiving, so if you can provide some more information about your setup in your project, and deployment process, including details of the errors you are seeing, I might be able to give you more specific advice.

Best,

Thank you, I have created a project variable with multiple values. I tried using a drop down selection and when attempting to run the deployment I am getting an error that reads “value provided is a relative path please try using an absolute path”

Hi @Aaron.Clark

Can you provide some examples of the values you placed in the drop-down list?

What’s the use-case for wanting to use a relative path (assuming the error correctly indicates that the values are indeed relative).

Also, can you provide a screenshot of both the error, and could you confirm what version of Octopus you are running?

Best,

Hey @Aaron.Clark

Digging into the Calamari code that’s responsible for performing the custom install directory contents, it looks like the error you are receiving is by design:

Octopus doesn’t support relative paths for a custom install directory.

The only thing I can suggest is trying to use an absolute path as the error suggests e.g., if it’s on windows:

For the DEV environment a value of C:\MyApp\#{Octopus.Environment.Name}\#{Octopus.Release.Number} would become C:\MyApp\Dev\1.0.0 (where the release number was 1.0.0).

Generally speaking, I try to avoid the use of custom install directories completely, as you lose the ability for Octopus to perform retention policies on the directory, and also you have to handle possible conflicts of the app being in use when you are deploying to that directory also.

Best,

here is a screenshot of the error

and here is how I defined the project variable

What I want is to be able to select the custom installation directory path using a project variable prior to deploying.

Hi @Aaron.Clark

Ah, interesting - leave it with me and I’ll do some more digging.

What version of octopus are you running?

Thanks, Mark

Hi @Aaron.Clark

So one option is to use a prompted variable with a drop-down that has the values in:

That image might not be very clear so the values in the drop down options are:

C:\MyApp\#{Octopus.Release.Number}-dev|Dev
C:\MyApp\#{Octopus.Release.Number}-test|Test
C:\MyApp\#{Octopus.Release.Number}|Prod

Then when deploying to an environment, you can select the path you want:

You can scope prompted variables to environments, but that probably wouldn’t help in this instance.

Looking at the last error, it looked like Octopus had an issue evaluating the two variables:

  • #{Test Installation Directory} and
  • #{Prod Installation Directory}

I noticed the screenshot of the test directory variable was set to a Checkbox which might be why it errored. Still, I’d be interested to see how you’ve set the Custom install directory variable in your deployment process.

Does that help at all?

Best,