Last active
August 16, 2018 10:35
-
-
Save sumitsaiwal/0d30f9d749b6d969ad44e7582eec612b to your computer and use it in GitHub Desktop.
Retain VSTS build indefinitely
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
#import-module "Microsoft.TeamFoundation.DistributedTask.Task.Common" | |
$uri = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECT/_apis/build/builds/$($env:BUILD_BUILDID)?api-version=2.0" | |
Write-Verbose "URI: $uri" | |
$body = "{keepForever:true}" | |
$result = Invoke-RestMethod -Uri $uri -Method Patch -ContentType "application/json" -Headers @{Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"} -Body $body | |
Write-Output "RESULT: $result" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment