Final goal - get hash of last commit from metadata for a package, which then will be used to create a tag after deploy.
Questions:
How I can get last commit in script?
How I can use #{Octopus.Release.Package} in powershell script?
Where this strange value “Releases-10312” came from?
While trying to achieve it, metadata from teamcity is published and successfully worked for Release Notes generation, e.g. like setting Release Notes template like
#{each package in Octopus.Release.Package}
[#{package.PackageId}]
#{each commit in package.Commits}
#{commit.CommitId}
#{/each}
#{/each}
But usage of #{Octopus.Release.Package} in variable doesn’t work, i’m using powershell and https://octopus.com/docs/deployment-process/variables/system-variables.
#{Octopus.Release.Notes} work fine, i’ve use them as a proof that variable substitution and passing it to PowerShell works.
//variables in octopus UI
OctopusReleasePackage #{Octopus.Release.Package}
OctopusReleaseNotes #{Octopus.Release.Notes}
OctopusReleaseId #{each package in Octopus.Release.Package} #{package.PackageId} #{/each}
//powershell
Write-Host $OctopusReleasePackage gives “#{Octopus.Release.Package}”
Write-Host $OctopusReleaseNotes gives actual release notes for this packages
Write-Host $OctopusReleaseId gives Releases-10312
Octopus is 2019.5.8 if it matters, but Release Notes Creation Appears to not be working is avoided by not using variable in teamcity. Octopus upgrade is planned but will be not done for weeks maybe.