Pushing packages from head to head

In our organization we have three environments controlled by developers in which we have successfully setup OD. We are now investigating the creation of another OD head for two environments that we devs, don’t have access. The idea is to sync those two heads and while import/export works quite well for migrating projects, settings, e.t.c., I am trying to figure out a way of pushing the same NuGet packages from one head to another as the requirement is to be able to deploy the same binaries to all environments. Any ideas and/or recommendations?

Drat, I’ve missed this topic in documentation! http://docs.octopusdeploy.com/display/OD/Isolated+Octopus+Deploy+servers
Tried pushing with NuGet.exe and works just fine. Now I only need a way to automate the pushing.


Thanks for reaching out! Pretty much all build servers nowadays have a step to push packages to a Nuget feed. If you let me know which build server you are using (if you are using one!) I can point to into the right way of pushing the packages.


Hi Dalmiro,

Thanks for the reply but it’s not relevant I’m afraid. See, we have already setup our TFS to push packages (the right way :)), what we want is to further push these packages to a second octopus head, an isolated Octopus server as described here http://docs.octopusdeploy.com/display/OD/Isolated+Octopus+Deploy+servers


Hi Manos,

You are totally right, sorry about that! The recommendation would depend a bit on your scenario. A common setup for the Isolated-Octopus stragegy could be:

  • Your Development, Staging and Pre-Production environments are in your Dev Octopus Instance which we’ll call Octopus-Dev

  • Your Production environment will be in Octopus-Prod

  • From your build server you push your packages to Octopus-Dev.

  • On your deployment process you’ll have 1 step scoped to Pre-Production which will only consist on running Nuget.exe to push the package to Octopus-Prod

  • On Octopus-Dev you do all your testing in Development and Staging, and once you are ready to go to Octopus-Prod, you promote your deployment to Pre-Production where the package push step will run.

  • Finally, you deploy the package to Production from Octopus-Prod

Let me know if that makes sense for your scenario.



That makes perfect sense and it’s pretty much what I thought of when I read about the isolated server scenario. I tried to create that step using a “run a script” step type, like so:

$pkg = $OctopusParameters[“Octopus.Tentacle.CurrentDeployment.PackageFilePath”]
& NuGet.exe push $pkg -ApiKey MYAPI-KEY-HERE -Source http://myprodoctopusservernamehere/octopus/nuget/packages

Problem is, the parameter Octopus.Tentacle.CurrentDeployment.PackageFilePath comes up empty when the script runs. I guess it would have had a value if it was running inside a deploy.ps1 script attached to the project. But I would rather not pollute my solution with script files, there are 5 octopus projects that deploy several assemblies. I’m wondering if there is any other way to get the nuget package that is being deployed or any other way to achieve the step “On your deployment process you’ll have 1 step scoped to Pre-Production which will only consist on running Nuget.exe to push the package to Octopus-Prod” that you are describing.


Hi Manos,

You were really close! The variable $OctopusParameters["Octopus.Tentacle.CurrentDeployment.PackageFilePath"] only exists within the context of each deployment step. So if you have a Package Deploy step, that variable will hold the right value for that particular step during that step.

I was super sure we had a variable to reference that PackageFilePath from a different step, but it seems like we don’t. I’m gonna bring this one to the team to get some thoughts.

So as a workaround you can do the following:

  • Enable the feature Custom Deployment Scripts on the step where you are deploying the package, and put this as a “Post Deploy Script”
$value = $OctopusParameters['Octopus.Tentacle.CurrentDeployment.PackageFilePath']
$name = "PackageFilePath"
Set-OctopusVariable -name $name -value $value
  • On your package push script, use the variable $OctopusParameters["Octopus.Action[PACKAGESTEPNAME].Output.PackageFilePath"]. Make sure to replace PACKAGESTEPNAME with the actual name of the step where you deployed the package. This variable will hold a value like C:\Octopus\Files\Files.4.0.0.nupkg-567ccc41-25c2-48de-b83f-a46b08728080 so you’re gonna have to cut everything that comes after .nupkg before pushing it to your feed.

Hope that helps! Let me know if any part of the process is unclear to you.