Created
December 28, 2016 16:51
-
-
Save TomerAdmon/ebe3842d796887d9112d0ee8a5543e16 to your computer and use it in GitHub Desktop.
Update all build configuration in TeamCity to checkout on agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$TEAMCITY_URL = "http://tc" | |
##$secpasswd = ConvertTo-SecureString “PASSWORD” -AsPlainText -Force | |
##$mycreds = New-Object System.Management.Automation.PSCredential (“USERNAME”, $secpasswd) | |
$mycreds = Get-Credential | |
$builds = [xml](Invoke-RestMethod -Method Get ($TEAMCITY_URL + "/httpAuth/app/rest/buildTypes") -Credential $mycreds) | |
foreach ($build in $builds.buildTypes.buildType) | |
{ | |
$buildUri = $TEAMCITY_URL + "/httpAuth/app/rest/buildTypes/id:" + $build.id + "/settings/checkoutMode" | |
$response = Invoke-RestMethod -Method Get -Uri $buildUri -Credential $mycreds | |
if ($response -match "ON_SERVER") | |
{ | |
write-host $build.href | |
$response = Invoke-RestMethod -Method Put -Uri $buildUri -Credential $mycreds -Body "ON_AGENT" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment