I am trying to include the 7-digit git hash in the artifact name built by my Azure Devops build pipeline. In my build agent job I have an inline powershell script with the following lines:
$commitId = "$(Build.SourceVersion)"
$shortCommitId = ("$commitId").SubString(0,7)
In the options for the Powershell script under "Output variables" I add a reference name: ps
.
Then in the Publish Artifact step right after my Powershell step I set the artifact name as:
$(ApplicationName)_Rel_$(ps.shortCommitId)_$(build.buildnumber)
The actual result after the pipeline has finished running is:
MyApplication_Rel_$(ps.shortCommitId)_20190918.1
How do I pass the variable shortCommitId between steps so that it will be part of the artifact name? MyApplication_Rel_04f53f_20190918.18
.