Getting the path of the currently deployed version

I’d like to make a manual intervention step that allows someone to validate (via a diff tool) the changes between 2 versions. This is easy to get the path to the new version as it’s a variable in the build but how do I get the a path for the currently deployed version? I know how to get the latest deployed version from the API but I can’t seem to find anything in there about the physical path the package was deployed to. Is this anywhere?

Hi Piers,

We don’t currently track this information; you might be able to use New-OctopusArtifact in a post-deploy script to attach a file containing this information to the release? E.g.:

pwd >> release-location.txt
New-OctopusArtifact release-location.txt

Any use?


That gave me a file with this: C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp

Then I tried $OctopusOriginalPackageDirectoryPath and $OctopusPackageDirectoryPath

but just got#{OctopusOriginalPackageDirectoryPath} and #{OctopusOriginalPackageDirectoryPath}

I don’t get this. It uploads the package, it’s clearly there. Why isn’t the variable resolving correctly?

Hi - did you package the PostDeploy.ps1 script in the package that you want to track? It looks from your output that you may have run this as a Script Step, which is separate from the deployment step and won’t have the variables set. HTH!

Ah, that’ll do it.

No it’s in the script step. Is the PostDeploy.ps1 the only way? I’d rather not add a script file to every project.

Unfortunately it is the only option right now; I’ve aded an issue to track our intention to change this:

One thing that may help out - if you package your PowerShell scripts into a standard (non-deployed) NuGet package, under a folder like /Deployment, you can install this into all of your C# projects. We’ll look for scripts recursively at deployment time. May help a bit…


Looking into this here:

I see I can use command line to automate release creation. How would I deploy one package at a specific version and the other package (the one with the deploy scripts) at ‘latest’?

From Octo.exe you can use this syntax

--package YourStep:1.0.1

Where YourStep is the name of the Step in the deployment process for the package that you want to specify.

If you don’t specify this, it will use the latest available version.