Octopus.Deployment.PackageBuildInformation null and "Changes" messed up

When I try to deploy a final release package (not a pre-release, they work just fine), the Octopus Deploy variable Octopus.Deployment.PackageBuildInformation is null/missing in my Powershell script step. Also the “Changes” part of the deployment looks messed up, see the included image.

My project gets its release number from a package step. It has no release notes or deployment changes templates configured.

I will next try to use the variable Octopus.Deployment.Changes and see if it is correctly populated. It is more of a hassle to use though as I only want the latest release’s (the one currently being deployed?) BuildInformations. Using Octopus.Release.Package does not work as it does not contain what I want (BuildUrl, VcsCommitNumber etc), unless the documentation is outdated.

image

I added a step to print out the contents of Octopus.Deployment.Changes, it is also empty. This is strange because the releases packages has actual changes in them (I created a dummy commit) according to their BuildInformations in the GUI, see the included image.

image

Hi Dennis,

Thanks for reaching out, sorry to hear you’re having issues with build info.

Where are you attempting to get the information to populate within Octopus with that code? It looks like some if may have been lost, could you copy your code again and put it inside of a code block?

Would you be able to provide the contents of your buildinfo file that gets pushed with the build information? You may have to turn on verbose logging depending on the build server you’re using.

Could you also please send me a screenshot of the package in the library as well as a screenshot of the build information of the package from the build information tab?

Thanks,
Jeremy

Hi Jeremy,

Sure, the code I am using right now is just a Powershell script step that prints out the variables:

Write-Host $OctopusParameters["Octopus.Deployment.PackageBuildInformation"]
Write-Host $OctopusParameters["Octopus.Deployment.Changes"]

It runs in a script step configured with default values. I have tried to both set the Execution Location to run on the Octopus Server and to run on the Octopus Server on behalf of deployment targets, both with the same result (both variables empty).

Attached are the octopus.buildinfo files from Teamcity for the two packages used by the deployment (buildUrl and vcsRoot obfuscated).

buildtools octopus.buildinfo (720 Bytes) easyconnect octopus.buildinfo (730 Bytes)

Here’s the packages build information in Octopus.

Hey Dennis,

Thanks for the information.

Would you be able to show me screenshots from the library to show the corresponding packages? Sometimes there is a mismatch there that causes the issue.

Can you please turn on variable logging and see if the information is available in any system variable?

Please disable variable logging once you are done using it as it can cause slowness in your deployments and bloated logs.

Please let me know.

Thanks,
Jeremy

Do you mean the list of packages and their versions? There’s not much info there. I will try to turn on variable logging and get back to you.

Since you mentioned possible mismatch errors here are the packages build information (in my first post I screenshotted the packages).

I just tried a deployment with OctopusPrintVariables and OctopusPrintEvaluatedVariables set to true. The only mentions of PackageBuildInformation in the log file are from the occurrences within my “run a script” step. There’s no mention of Octopus.Release.Package anywhere. There’s also no mentions of the branches I expect to see, or the commit hashes.

There’s a few occurrences of Octopus.Deployment.Changes and Octopus.Deployment.ChangesMarkdown:

16:24:21   Verbose  |       [Octopus.Deployment.Changes] = ''
16:24:21   Verbose  |       [Octopus.Deployment.ChangesMarkdown] = '
16:24:21   Verbose  |       **Release #{release.Version}**
16:24:21   Verbose  |       #{release.ReleaseNotes}
16:24:21   Verbose  |       '

Hey Dennis,

There is nothing in this variable on your end?

[Octopus.Deployment.PackageBuildInformation] = '[{"PackageId":"randomquotes","Version":"1.0.3","BuildEnvironment":null,"BuildNumber":"3","BuildUrl":"http://localhost/viewLog.html?buildId=5","Branch":"","VcsType":"Git","VcsRoot":"https://github.com/millerjn21/RandomQuotes-Java","VcsCommitNumber":"83beb4675c04854f9920d14a38776be8cb770418","VcsCommitUrl":null,"WorkItems":[],"Commits":[]},{"PackageId":"randomquotes","Version":"1.0.7","BuildEnvironment":null,"BuildNumber":"7","BuildUrl":"http://localhost/viewLog.html?buildId=9","Branch":"","VcsType":"Git","VcsRoot":"https://github.com/millerjn21/RandomQuotes-Java","VcsCommitNumber":"16c11e24db76ea73d238fdde3b6811b81ac2ed56","VcsCommitUrl":null,"WorkItems":[],"Commits":[]},{"PackageId":"RandomQuotes","Version":"74","BuildEnvironment":null,"BuildNumber":"74","BuildUrl":"http://localhost:8080/job/RandomQuotes/74/","Branch":null,"VcsType":"Git","VcsRoot":"https://github.com/OctopusSamples/RandomQuotes-Java","VcsCommitNumber":"5bad423eacb2207a8b34ee0846fa206028185774","VcsCommitUrl":null,"WorkItems":[],"Commits":[]}]' 

The screenshots look okay to me. Do the appropriate pacakges with build information show up on the release page like this? (please ignore the error, I have deleted the package so it just warns me of that.)

Which version of Octopus are you running? Are you by chance on cloud so I could log in and take a look?

Thanks,
Jeremy

No that variable doesn’t even show up in the logs except for the lines where I am using it in my script step:

16:23:28   Verbose  |         [Octopus.Action[Test].Script.ScriptBody] = '$OctopusParameters["Octopus.Deployment.PackageBuildInformation"]
16:23:28   Verbose  |         $OctopusParameters["Octopus.Deployment.Changes"]
16:23:28   Verbose  |         Write-Host $OctopusParameters["Octopus.Deployment.PackageBuildInformation"]
16:23:28   Verbose  |         Write-Host $OctopusParameters["Octopus.Deployment.Changes"]'

The release page looks like:

Unfortunately we are using Octopus Server on premises. Version is 2019.13.7.

Hi Dennis,

Can you please private message me the full task log from the deployment with the variables turned on? From the task page please click download and attach that in a direct message to me.

Thanks,
Jeremy

Hey Dennis,

I took a look at your log and see that the variable is definitely missing. Are you able to upgrade to current and see if that resolves the issue for you, or are you stuck on 2019.13.7?

Thanks,
Jeremy

Unfortunately I am stuck on 2019.13.7 for the time being, due to SQL Server licensing upgrade costs.

Any idea what could cause the missing variables? Any workarounds?