We have two builds:
- daily, version format is 1.0.%release.build.number%.%build.number%
- Release, version format is 1.0.%build.number%.0
Release depends on Daily.
We would like to be able to:
1) Reset buildcounter of a Daily build when Release build starts
2) Update release.build.number property of a Daily build when Release build starts
I tried putting a PowerShell script to use REST API to do this:
$user = "%system.teamcity.auth.userId%"
$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
Invoke-RestMethod -Uri %teamcity.serverUrl%/httpAuth/app/rest/buildTypes/id:90/parameters/release.build.number -Method PUT -Credential $cred -Body %build.counter%
Invoke-RestMethod -Uri %teamcity.serverUrl%/httpAuth/app/rest/buildTypes/id:90/settings/buildNumberCounter -Method PUT -Credential $cred -Body 0
But I am getting a 403 error, because that user doe not have permissions to change build configurations.
Please advice how can I achieve my task.