Missing WorkItems/Commits in Octopus.Deployment.Changes variable

I have this deployment changes template to list all items and commits for every Release available in Octopus.Deployment.Changes variable:

#{each change in Octopus.Deployment.Changes}
**Version #{change.Version}**

Work items:
#{each buildInformation in change.BuildInformation}
- #{buildInformation.PackageId}
  #{each workItem in buildInformation.WorkItems}
  - [#{workItem.Id}](#{workItem.LinkUrl}): #{workItem.Description}
  #{/each}
#{/each}

Commits:
#{each buildInformation in change.BuildInformation}
- #{buildInformation.PackageId}
    #{each commit in buildInformation.Commits}
  - [#{commit.Id}](#{commit.LinkUrl}): #{commit.Comment}
    #{/each}
#{/each}

#{/each}

And here is the release notes template:

Work items:
#{each package in Octopus.Release.Package}
- #{package.PackageId}
  #{each workItem in package.WorkItems}
    #{if workItem.Id}
  - [#{workItem.Id}](#{workItem.LinkUrl}): #{workItem.Description}
    #{/if}
  #{/each}
#{/each}

Commits:
#{each package in Octopus.Release.Package}
- #{package.PackageId}
  #{each commit in package.Commits}
    #{if commit.CommitId}
  - [#{commit.CommitId}](#{commit.LinkUrl}): #{commit.Comment}
    #{/if}
  #{/each}
#{/each}

The problem is that only the second one (release notes template, and not deployment notes template) is working, even if both of these should produce exactly same output (deployment notes should have list of release notes as you might see).In the first one there’re only release version elements (each change loop works fine) and package names (each package loop works fine) but its work items and commits are always empty, even if these packages in these releases have work items and commits listed properly at single release notes template.

And I know that I might use change.ReleaseNotes variable in the first template to achieve the same effect, but this is only the example for this forum post, because in our final configuration we would like to have deployment notes NOT to have commits (so it would not be list of release notes).

The main problem (which I’ve found out by printing whole object in JSON) is that Octopus.Deployment.Changes variable have work items and commits list in distincted version (change.WorkItems and change.Commits variables) but these properties in each BuildInformation (packages) elements are empty, even if these packages in release notes have proper lists.

v2021.1.7316

Hi Rafal,

I see where the issue lays.

So to clarify, you would be looking to have something along the lines of this:

Deployment Changes Template

#{each change in Octopus.Deployment.Changes}
**Version #{change.Version}**

Work items:
#{each buildInformation in change.BuildInformation}
- #{buildInformation.PackageId}
  #{each workItem in buildInformation.WorkItems}
  - [#{workItem.Id}](#{workItem.LinkUrl}): #{workItem.Description}
  #{/each}
#{/each}

Commits:
#{each buildInformation in change.BuildInformation}
- #{buildInformation.PackageId}
    #{each commit in buildInformation.Commits}
  - [#{commit.Id}](#{commit.LinkUrl}): #{commit.Comment}
    #{/each}
#{/each}

#{/each}

Release Notes Template

Work items:
#{each package in Octopus.Release.Package}
- #{package.PackageId}
  #{each workItem in package.WorkItems}
    #{if workItem.Id}
  - [#{workItem.Id}](#{workItem.LinkUrl}): #{workItem.Description}
    #{/if}
  #{/each}
#{/each}

and you haven’t been able to get your commits to populate in your Deployment Changes.
Let me know if I’ve got that correct?

I will need to do some testing and potentially reach out to some of the engineers to see if there is a solution for this issue.

Regards,

It seems like these:

:heavy_check_mark: Release notes has “Octopus.Release.Package” variable (list of packages).
:heavy_check_mark: “Octopus.Release.Package[i].WorkItems” is available for each package.
:heavy_check_mark: “Octopus.Release.Package[i].Commits” is available for each package.
:heavy_check_mark: There’s also “Octopus.Release.WorkItems” available with distincted list of “Octopus.Release.Package[*].WorkItems”
:warning: For some reason there’s no “Octopus.Release.Commits” available with distincted list of “Octopus.Release.Package[*].Commits”

:heavy_check_mark: Deployment notes has “Octopus.Deployment.Changes” variable (list of releases).
:heavy_check_mark: “Octopus.Deployment.Changes[i].BuildInformation” is available for each release (list of packages).
:x: “Octopus.Deployment.Changes[i].BuildInformation[j].WorkItems” is available for each package, but it’s always an empty array.
:x: “Octopus.Deployment.Changes[i].BuildInformation[j].Commits” is available for each package, but it’s always an empty array.
:heavy_check_mark: There’s also “Octopus.Deployment.Changes[i].WorkItems” available with distincted list of “Octopus.Deployment.Changes[i].BuildInformation[*].WorkItems”.
:heavy_check_mark: There’s also “Octopus.Deployment.Changes[i].Commits” available with distincted list of “Octopus.Deployment.Changes[i].BuildInformation[*].Commits”.
:heavy_check_mark: There’s also “Octopus.Deployment.WorkItems” available with distincted list of “Octopus.Deployment.Changes[*].BuildInformation[*].WorkItems”
:warning: For some reason there’s no “Octopus.Deployment.Commits” available with distincted list of “Octopus.Deployment.Changes[*].BuildInformation[*].Commits”

:heavy_check_mark: There’s also “Octopus.Deployment.PackageBuildInformation” available with distincted list of “Octopus.Deployment.Changes[*].BuildInformation”
:x: “Octopus.Deployment.PackageBuildInformation[i].WorkItems” is available for each package, but it’s always an empty array.
:x: “Octopus.Deployment.PackageBuildInformation[i].Commits” is available for each package, but it’s always an empty array.

I’ve send you a private message with release and deployment notes, as well as generated markdown for these.
And also deployment logs for this “debug” test:

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

Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

Write-Host "Octopus.Deployment.WorkItems"
Write-Host $OctopusParameters["Octopus.Deployment.WorkItems"]

Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

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

Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

Write-Host "Octopus.Deployment.ChangesMarkdown"
Write-Host $OctopusParameters["Octopus.Deployment.ChangesMarkdown"]

Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

Write-Host "Octopus.Deployment.Targets"
Write-Host $OctopusParameters["Octopus.Deployment.Targets"]

Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

Hi Rafal,

Thanks for following up and sending through that info via private message to Dane. I’m just jumping in for the time being as he’s now offline as part of our EU-based team.

I had a look through the template you sent over, and from what I can tell it looks to be just fine. We have only recently had some problems regarding performance with build information in cases where there is a large number of packages each with their own included build information and how Octopus stores that data causing. I’m wondering if this might be related somehow. Did this by chance work for you previously?

I’ll catch up with Dane when he gets online and we’ll get back to you as soon as we have something.

I appreciate your report, and I look forward to getting this working as needed!

Best regards,

Kenny

So you have access to informations that I’ve sent to dane.falvo? If not I’ll send you the same messages, just let me know.

So far we’ve used only release notes template that contained all Commits/WorkItems in form of list grouped by package.
Now we’ve changed it a little bit so that release notes display Commits/WorkItems only for one package by adding

#{if package.PackageId == Ecom.Project.ReleaseInfoPackageName}

and that works fine. What we had to achieve here was to remove changes that appears at every release, because some packages don’t change every release which is pretty common scenario.

But we’ve never used deployment notes before, so I can’t tell you if this worked before or not.

What we have to achieve in this place is pretty similar to release notes described above - list only changes related to one package, Ecom.Project.ReleaseInfoPackageName. But in this case we’ll use 2 versions of it.
First one available for developers - Commits/WorkItems for this package. So that might be worked around by simply defining deployment notes as list of release notes, because they’ll have the same desired content as you might already noticed.
Second version of deployment notes is currently impossible to achieve. This version should be used in one of the deployment steps to generate changes in form of WorkItems for this specified package (ommiting commits). So we can’t use release notes here directly, and because of bug (empty builInfo objects) we can’t define working template either.

Hey Rafal,

Yeah, Kenny and certain members of the support team have access to that email. We’ve been discussing it this morning. The answer and solution to this will wholly depend on the information available at Release time.

I may also rope in some people from the solutions team just to get their head around this problem and tackle it from their perspective. We will touch base as soon as practical, which will hopefully be in a day or so.

Regards,

Hi Rafal,

We’ve worked out the issue. You have pinpointed a bug that we’ve had in our code for awhile now.

Essentially, Release Notes and Deployment Notes should have access to the same information. Unfortunately due to a single mapping being missed in our code, when iterating through individual packages in the Deployment Notes, no commit details are evaluated.

You can definitely use the Rolled up Commit notes - but I know that isn’t a solution for your end goal.

The Engineers have agreed that this fix should be backported to our supported versions, however I believe the latest supported version (that will receive a fix like this) will be Octopus Deploy version 2021.3.

Here is the GitHub issue that has been raised: Commit notes when loading per Deployment are not evaluated due to missing mapping. · Issue #7425 · OctopusDeploy/Issues · GitHub.

The only thing that I think may be due to misconfiguration in your current setup is in reference to:

but its work items and commits are always empty

Work Items was initially not working, but was fixed awhile ago. I need to confirm what version this was fixed in, but I believe it was fixed prior to 2021.1.7316. I will confirm this for you, but once the issue is rectified, upgrading to the latest 2021.3 patch version will sort out these anomalies for you.

Keep an eye on the github issue for the latest information on this fix. It will likely be a few weeks before the patched version is available in our GA releases.

I’m sorry this isn’t the answer you were probably looking for, but thank you for helping identify this bug.

Regards,

Thank you, our current version of Octopus Server is not a problem - it’ll be upgraded on our side soon, so it’s good to hear that bugfix is on the way.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.