dotnet-installer/eng/common/retain-build.ps1
dotnet-maestro[bot] d53983f0cb Update dependencies from https://github.com/dotnet/arcade build 20220316.1
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.22157.6 -> To Version 7.0.0-beta.22166.1

Dependency coherency updates

VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.FSharp.Compiler,Microsoft.SourceBuild.Intermediate.fsharp,Microsoft.Build,Microsoft.SourceBuild.Intermediate.source-build,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
 From Version 7.0.0-preview.3.22151.6 -> To Version 7.0.0-preview.3.22158.1 (parent: Microsoft.NET.Sdk
2022-03-17 12:33:02 +00:00

45 lines
1.3 KiB
PowerShell

Param(
[Parameter(Mandatory=$true)][int] $buildId,
[Parameter(Mandatory=$true)][string] $azdoOrgUri,
[Parameter(Mandatory=$true)][string] $azdoProject,
[Parameter(Mandatory=$true)][string] $token
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 2.0
function Get-AzDOHeaders(
[string] $token)
{
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":${token}"))
$headers = @{"Authorization"="Basic $base64AuthInfo"}
return $headers
}
function Update-BuildRetention(
[string] $azdoOrgUri,
[string] $azdoProject,
[int] $buildId,
[string] $token)
{
$headers = Get-AzDOHeaders -token $token
$requestBody = "{
`"keepForever`": `"true`"
}"
$requestUri = "${azdoOrgUri}/${azdoProject}/_apis/build/builds/${buildId}?api-version=6.0"
write-Host "Attempting to retain build using the following URI: ${requestUri} ..."
try {
Invoke-RestMethod -Uri $requestUri -Method Patch -Body $requestBody -Header $headers -contentType "application/json"
Write-Host "Updated retention settings for build ${buildId}."
}
catch {
Write-Error "Failed to update retention settings for build: $_.Exception.Response.StatusDescription"
exit 1
}
}
Update-BuildRetention -azdoOrgUri $azdoOrgUri -azdoProject $azdoProject -buildId $buildId -token $token
exit 0