Octopus Package Name


I’m a newbie to Octopus, but I’m trying to help a project team because their DevOps guy quit. We have a deployment process which pushes code out to 100s of clients, but the package re-uploads everytime. I’m trying to establish a process where we check if the file exists on the server. If not, use Oct Transfer File to upload to the server.

Octopus Server: Windows
Deployment Server: Linux

I’m trying to echo anything package/deployment related, but everything I try doesn’t echo

and etc.

The only thing I can seem to get to echo back is #{Octopus.Release.Id}

Is this a chicken/egg issue or do I have something incorrectly configured? If I can get these details set, then I can write a script to do more robust work.

Thanks in advance.

Hello @bdickey,

Thanks for reaching out, and welcome to the forum!

Looking at our documentation the Octopus.Release.Package variable is only populated if build information has been pushed for the specified package and is not accessible from the project deployment steps.

There is the Octopus.Deployment.PackageBuildInformation variable that is available from the project deployment step and looks like it contains the information you’re looking for.

I hope this helps. Feel free to let me know if you have any other questions.

Best regards,
Mark Butler

Hey Mark,

Thanks for the help, I think I can work with what you gave me. So Octopus.Deployment.PackageBuildInformation returns a key/value pair. How can I get a single value from this? I’ve tried the following:

echo #{Octopus.Deployment.PackageBuildInformation.PackageId}
echo #{Octopus.Deployment.PackageBuildInformation[PackageId]}
echo #{Octopus.Deployment.PackageId}

Hello @bdickey,

The Octopus.Deployment.PackageBuildInformation is going to return a JSON array of objects with build information.

Using PowerShell, I converted that JSON to an object and then looped through the packages to obtain the information you’re looking for.

$packageBuildInfo = $OctopusParameters["Octopus.Deployment.PackageBuildInformation"] | ConvertFrom-Json

foreach($package in $packageBuildInfo){
	$packageId = $package.PackageId
    $packageVersion = $package.Version
	Write-Host "Package id: $packageId"
    Write-Host "Package version: $packageVersion"

The result of running that code in a step.

I hope this helps.

Best regards,
Mark Butler