Package Deploy - Custom Install Directory Option - variable for package extract folder

During a standard package deploy, Ive used the “custom install directory option”

I’ve also used variable substitution on config files / config transformation.

All this happens in an initial directory where the package is extracted to.

I’ve then also used config encryption.

I have a custom install directory as multiple copies / instances of the package can be installed on one machine (with different config).

I need to cleanup the package extraction folder ASAP to remove non encrypted config files.

Is there a variable I can use in a step after the deploy package step to ascertain the folder the package was extracted to?

Obviously with multiple pipelines deploying the same package (and sometimes the same version of the package) - the package extraction folder ends up being packageid\version.v.v_sequence

I did find some posts talking about a variable available within the step, but That variable didn’t contain anything in subsoquent steps (same server etc.).

Thanks,
Mhano

Hi Mhano,

Thanks for getting in touch! You can target the directory the package was extracted to in a couple different ways. The following system output variable contains this path which can be targeted in subsequent steps:

Octopus.Action[PackageStepName].Output.Package.InstallationDirectoryPath

Replacing PackageStepName with your step name that deployed the package, you can target this in a subsequent script step to remove the contents.

Alternatively, you could embed this into a PostDeploy script inside your package step and use the variable:

Octopus.Action.Package.InstallationDirectoryPath

(This custom script would be run after the extracted package contents are copied to the custom installation directory, and you can reference the package deployment feature ordering in our docs. :slight_smile:)

I hope this helps get you going! Don’t hesitate to reach out if you have any further questions or concerns moving forward.

Best regards,

Kenny

Thanks - bit of a noob re octopus still.

We are using that variable for the final path (Octopus.Action[PackageStepName].Output.Package.InstallationDirectoryPath) to manage retention etc.

The tip I needed was to use the “PostDeployment” script on the step.

Another post somewhere talked about $OctopusOriginalPackageDirectoryPath which is the variable / we needed / directory we need to clean up.

Hi Mhano,

Not a problem at all, and you’re very welcome! Let me know if there’s anything else at all I can assist with. :slight_smile:

Best regards,

Kenny

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