Copy Package to Tentacle server without Deployment

For one of our Projects we are looking to copy several nuget packages to various remote servers into an IIS virtual directory on the remote servers, keeping them as nuget packages so that they can then be downloaded across the web by our software. The deployment needs to create a sub folder based on a release version number and drop the nuget pasckages into this folder. The folder management is fine with powershell, but I cannot see how it is possible to deploy a nuget package without actually expanding to a local folder - is this possible?

Hi Andrew,

Thanks for reaching out. Octopus wasn’t really built for this, but it can be done with a few gotchas:

During the deployment step Octopus will download the package to the Tentacle to later on extract it. There’s a variable called $OctopusParameters["Octopus.Tentacle.CurrentDeployment.PackageFilePath"] that holds the full path of the package on the Tentacle. You can add a Custom Script on your package step to copy this file to a different path.

Gotchas

  • The variable $OctopusParameters["Octopus.Tentacle.CurrentDeployment.PackageFilePath"] will only be available on the Nuget deployment step. This means you can’t use it from a separate Powershell script step.

  • The value of the variable $OctopusParameters["Octopus.Tentacle.CurrentDeployment.PackageFilePath"] will be something like this: C:\Octopus\Files\[PackageID].[PackageVersion].nupkg-7db9c9fd-9811-49a6-a0e1-f26e998e11d8. You’re gonna have to rename the file deleting all that comes after the file extension.

  • You cant prevent Octopus from unpacking the contents of the package, meaning you’re gonna have to add a post deploy script to clean the extracted content. You can use the variable $OctopusParameters[Octopus.Action.Package.CustomInstallationDirectory"] to get the path where things were extracted.

Hope that helps

Dalmiro