Reputation: 2138
In my build configuration I have environment variables for major, minor and patch version numbers.
I am trying to write a build step that checks the name of the branch and if it is a release branch with a higher version than the current env vars, I want to update them.
I have tried setting the variables, but when I go the 'Parameters' tab it still shows the old value.
I am writing a Powershell script, and have tried:
Write-Host "##teamcity[setParameter name='major.version' value='2']"
Write-Host "##teamcity[setParameter name='env.major.version' value='2']"
$Env:major.version = 2
Upvotes: 1
Views: 3437
Reputation: 1832
If you want to update the settings of the TeamCity build configuration, you need to use REST API. e.g. curl -u username:password "https://teamcity.corp.com/app/rest/buildTypes/id:%system.teamcity.buildType.id%/parameters/major.version" --request PUT --header "Content-Type: text/plain"
You will need to provide creentials of a user who has "Edit Project" permission.
Note: ##teamcity[setParameter... changes the parameter only for the following steps of the same build.
Upvotes: 2