This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[automated] Merge branch 'release/6.0.2xx' => 'main' (#80)
* Update dependencies from https://github.com/dotnet/arcade build 20220130.1 (#57) Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.22071.6 -> To Version 7.0.0-beta.22080.1 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * [release/6.0.2xx] Backport CODEOWNERS (#61) So we get appropriate notifications. Extension of #54. * Update dependencies from https://github.com/dotnet/arcade build 20220203.1 (#66) Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.22080.1 -> To Version 7.0.0-beta.22103.1 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update dependencies from https://github.com/dotnet/arcade build 20220211.10 (#71) Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.22103.1 -> To Version 7.0.0-beta.22111.10 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update dependencies from https://github.com/dotnet/arcade build 20220217.2 (#78) [release/6.0.2xx] Update dependencies from dotnet/arcade Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Tanay Parikh <TanayParikh@users.noreply.github.com> Co-authored-by: Hao Kung <HaoK@users.noreply.github.com>
- Loading branch information
1 parent
6a2fcca
commit 51942e6
Showing
4 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
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 | ||
. $PSScriptRoot\tools.ps1 | ||
|
||
|
||
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-PipelineTelemetryError -Category "Build" -Message "Failed to update retention settings for build: $_.Exception.Response.StatusDescription" | ||
ExitWithExitCode 1 | ||
} | ||
} | ||
|
||
Update-BuildRetention -azdoOrgUri $azdoOrgUri -azdoProject $azdoProject -buildId $buildId -token $token | ||
ExitWithExitCode 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
parameters: | ||
# Optional azure devops PAT with build execute permissions for the build's organization, | ||
# only needed if the build that should be retained ran on a different organization than | ||
# the pipeline where this template is executing from | ||
Token: '' | ||
# Optional BuildId to retain, defaults to the current running build | ||
BuildId: '' | ||
# Azure devops Organization URI for the build in the https://dev.azure.com/<organization> format. | ||
# Defaults to the organization the current pipeline is running on | ||
AzdoOrgUri: '$(System.CollectionUri)' | ||
# Azure devops project for the build. Defaults to the project the current pipeline is running on | ||
AzdoProject: '$(System.TeamProject)' | ||
|
||
steps: | ||
- task: powershell@2 | ||
inputs: | ||
targetType: 'filePath' | ||
filePath: eng/common/retain-build.ps1 | ||
pwsh: true | ||
arguments: > | ||
-AzdoOrgUri: ${{parameters.AzdoOrgUri}} | ||
-AzdoProject ${{parameters.AzdoProject}} | ||
-Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} | ||
-BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} | ||
displayName: Enable permanent build retention | ||
env: | ||
SYSTEM_ACCESSTOKEN: $(System.AccessToken) | ||
BUILD_ID: $(Build.BuildId) |
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