Reset buildcounter and change a property in a dependency

Hi,

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%"
$pass= "%system.teamcity.auth.password%"

$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.

1 comment
Comment actions Permalink

It seems like you are trying to achieve the same as me in http://devnet.jetbrains.com/message/5499873#5499873 except that you seem to use a Powershell script and the REST API for TeamCity, I would much rather use some type of code where I could write this as a plugin for a Build runner :)

0

Please sign in to leave a comment.