Background: we want to associate the Git commit hash of a build with an Octopus release so that we can create a GitHub release and tag as part of our Octopus deployment process.
I tried using Prompted Variables for this - in TeamCity we pass additional command-line arguments to Octo.exe so the command looks something like:
Octo.exe (...) -v "GitCommitHash:%build.vcs.number.1%"
We then use #{GitCommitHash}
as the target commitish in our GitHub - Create Release step.
This doesn’t work, however - our prompted variable (GitCommitHash
) is blank when we go to deploy, despite it being set on the Octopus release (incidentally, is there any way to view the values of prompted variables on a release?).
Is there a way to make the prompted variable value set at release-time be retained for deployments of that release? Alternatively, is there a better way to save arbitrary data about a build on an Octopus release object? We’re already using --releasenotes
for something else.
Answering my own question: metadata looks exactly like what we want.