I am building a Continuous Delivery pipeline in TC, and as a 0th build step, I'd like to be able to extract the unique version number which I give to my commit.
It looks like this: release_4.46.
I'd like to use the '4.46'-part to append to the different steps of my pipeline, and as the final step, name my artifact as eg app_4.46.war.
I've managed to assemble the majority of the pipeline(unit tests, jsHint, Maven build) and it's up and running, but I cannot get to the end of this feature.
Any help or pointers is appreciated. thanks
You can try adding a powershell step which extracts 4.46 from branch name and set a teamcity parameter which can be used in rest of the steps. Powershell code should looks something like:
function Set-Version{
param
(
[string]
$branch
)
$ExtractedVersion = $branch.Split("_")[1]
Write-Host "##teamcity[setParameter name='ExtractedVersion' value='$ExtractedVersion']"
}
And then in the powershell step you can call this function like
Set-Version %teamcity.build.branch%
Once this step is executed, a teamcity parameter ExtractedVersion with value 4.46 should be available for the rest of the build steps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.