Variable substitution post deploy step

Hi there,

I’m currently deploying a python package via Octopus to a Linux machine my steps are:

  1. Deploy
  2. Untar the package.tar inside the nuget package (taring to solve issues with unpacking nuget on Linux)

I now need to perform variable substitution on a file that was extracted from the tar. The problem is variable substitution is part of the deploy step. Is there any way I can use the step outside of the deploy step.

Any help would be appreciated :slight_smile:

Cheers,

Josh

Hi Josh,
Are you using Octopus Deploy 3.0? The latest builds of Octopus Deploy support SSH Targets as first class citizens with almost the full functionality of normal tentacles! This includes un-packaging NuGet files (although we now also support .tar.gz and .zip natively!), performing variable substitutions and running deployment scripts. Take a look at this new feature as it should solve your problem.
You can therefore use the Substitute variables in files feature in a deployment step to run the substitution on any files extracted from the package before the PostDeployment script is executed.
Does this information solve your problem? If not, then could you provide some further details about exactly what scenario you are trying to support.
Thanks in advance,
Robert

Hi Rob,

Thanks for the reply :slight_smile:

I was having the issue as described here:
http://help.octopusdeploy.com/discussions/problems/41742-linux-deployment-all-frozen-up#comment_38395756

And followed the solution to tar up the files before packing them, which fixed that problem.

My Octopus version is 3.3.4.

Many thanks,

Josh

Hi Josh,
Great to hear you are back on track. Feel free to let us know if you run into any further issues.
Cheers,
Robert

Sorry, I was just describing why I was using a tar inside the nuget package.

I still have the problem of performing variable substitution after untaring :frowning:

Many thanks,

Josh

Hi,
Octopus Deploy has a script library containing step templates that have been built and maintained by active members of the community. One script that might come in handy for your scenario is the Variables - Substitute in Files. Using this template you can perform the variable substitution as a seperate step after the deployment.
Templates can be easily added to your Octopus instance and then used in projects as outlined in our documentation.
Let me know if this meets your needs.
Cheers,
Robert

Hi Rob,

That script is written in powershell (deploying on Linux), but I tried it anyway and Octopus errors with: System.InvalidOperationException: Script type ps1 unsupported on this platform.

Many thanks,

Josh

Hi Josh,
Yes as you have noticed the scripts in the Octopus script library are PowerShell, and if you are executing on Linux then this isn’t supported. Unfortunately then we don’t have a simple alternative solution to performing variable substitution after a deployment step has completed. What is the reason you cant use the Substitute Variables in Files feature in your deployment step itself to perform the substitution?
Rob

Hi Rob,

I can’t substitute variables as part of the deploy step because I’m having to tar my package to overcome the problem with Octopus extracting from a NuGet package on Linux.

Octopus won’t be able to see the files I need to do variable substitutions on until the tar has been unpacked.

Many thanks,

Josh

Josh,
As I mentioned in the previous post, you can now upload .zip and .tar in the newer versions of Octopus. This will bypass the problem you described with nuget. This is the best option to get the results you are after.
Cheers,
Rob

Hi Rob,

Pushing it as a tar works, although it moves slightly outside of our current setup.

Thank you for all your help :slight_smile:

Cheers,

Josh