How variable can be passed from octo.exe to Script Modules

I am using Jenkins build server to create release. As a part of my deployment script I am using a script that I have in my Script Modules; it takes a Git SHA as a variable. It is implemented like this

   # check if needed parameters are passed
    If ([string]::IsNullOrEmpty($OctopusParameters["GitHubHash"])) {
        Write-Host "No github hash was specified, there's nothing to report then."
# ...

In order to set this variable, when I run octo.exe, I do it like this:

octo.exe create-release  --project MY-PROJECT --version 1.0.i --variable GitHubHash:abcde12345 --server ... --apiKey ...

but in my deployment report, I can see that the value is not passed to the script modules.

OTOH when the variable is set in the project (statically), the script works ok.

What am I doing wrong?

thanks for response!

Hi Lukasz,
Thanks for reaching out. Sorry for the delay in getting back to you.

Adding ReleaseChanges.PackageBuildMetadata[].VcsCommitNumber should give you the Git Commit Hash that kicked off the build of a specific package.
We have a couple of docs that might be useful to you here. One that talks about Deployment Variables and another on how to take advantage of Package Metadata during release creation.

I hope this helps and please let me know if this doesn’t resolve your issue.

Best Regards,