Skip to content

Commit

Permalink
Merge in 'release/6.0' changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnet-bot committed Oct 12, 2023
2 parents d7d7427 + 375080e commit 301a5c1
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 8 deletions.
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.23408.5">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.23511.8">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>98fd22588fbb0f407faa6a74cb1aa79031306151</Sha>
<Sha>06ccd9430e2e3bd29a381a5b27e7976d11b0ed18</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="6.0.0-beta.23408.5">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="6.0.0-beta.23511.8">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>98fd22588fbb0f407faa6a74cb1aa79031306151</Sha>
<Sha>06ccd9430e2e3bd29a381a5b27e7976d11b0ed18</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
45 changes: 45 additions & 0 deletions eng/common/retain-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

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
28 changes: 28 additions & 0 deletions eng/common/templates/steps/retain-build.yml
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)
8 changes: 4 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "6.0.122",
"dotnet": "6.0.123",
"runtimes": {
"dotnet": [
"3.1.32",
Expand All @@ -13,12 +13,12 @@
}
},
"sdk": {
"version": "6.0.122",
"version": "6.0.123",
"allowPrerelease": true,
"rollForward": "latestMajor"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.23408.5",
"Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.23408.5"
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.23511.8",
"Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.23511.8"
}
}

0 comments on commit 301a5c1

Please sign in to comment.