Skip to content

Commit 98aa93b

Browse files
Update dependencies from https://github.com/dotnet/arcade build 20260810.9
On relative base path root Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.CMake.Sdk From Version 8.0.0-beta.26405.8 -> To Version 8.0.0-beta.26410.9
1 parent e3b8166 commit 98aa93b

8 files changed

Lines changed: 247 additions & 10 deletions

File tree

eng/Version.Details.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,18 @@
214214
</Dependency>
215215
</ProductDependencies>
216216
<ToolsetDependencies>
217-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.26405.8">
217+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.26410.9">
218218
<Uri>https://github.com/dotnet/arcade</Uri>
219-
<Sha>dcc22d2c84bf1fbbe33978fdc46197968ff0aac5</Sha>
219+
<Sha>0992a0f871c48ccc32eaa49ad89fea8022b8f597</Sha>
220220
<SourceBuild RepoName="arcade" ManagedOnly="true" />
221221
</Dependency>
222-
<Dependency Name="Microsoft.DotNet.CMake.Sdk" Version="8.0.0-beta.26405.8">
222+
<Dependency Name="Microsoft.DotNet.CMake.Sdk" Version="8.0.0-beta.26410.9">
223223
<Uri>https://github.com/dotnet/arcade</Uri>
224-
<Sha>dcc22d2c84bf1fbbe33978fdc46197968ff0aac5</Sha>
224+
<Sha>0992a0f871c48ccc32eaa49ad89fea8022b8f597</Sha>
225225
</Dependency>
226-
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="8.0.0-beta.26405.8">
226+
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="8.0.0-beta.26410.9">
227227
<Uri>https://github.com/dotnet/arcade</Uri>
228-
<Sha>dcc22d2c84bf1fbbe33978fdc46197968ff0aac5</Sha>
228+
<Sha>0992a0f871c48ccc32eaa49ad89fea8022b8f597</Sha>
229229
</Dependency>
230230
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.24306.1">
231231
<Uri>https://github.com/dotnet/arcade-services</Uri>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</PropertyGroup>
4040
<PropertyGroup>
4141
<!-- Dependency from https://github.com/dotnet/arcade -->
42-
<MicrosoftDotNetBuildTasksInstallersPackageVersion>8.0.0-beta.26405.8</MicrosoftDotNetBuildTasksInstallersPackageVersion>
42+
<MicrosoftDotNetBuildTasksInstallersPackageVersion>8.0.0-beta.26410.9</MicrosoftDotNetBuildTasksInstallersPackageVersion>
4343
</PropertyGroup>
4444
<PropertyGroup>
4545
<!-- Dependency from https://github.com/dotnet/arcade-services -->

eng/common/Get-GitHubAppToken.ps1

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Mints a short-lived GitHub App installation access token by signing a JWT
2+
# with a private key stored in Azure Key Vault (RSA, RS256). The signed JWT is
3+
# exchanged with the GitHub API for a token scoped to a single installation.
4+
#
5+
# Requirements:
6+
# - A GitHub App whose private key has been uploaded into Key Vault as an RSA
7+
# key (the PEM converted to a Key Vault *key*, NOT stored as a secret).
8+
# - The caller (the federated Azure service connection used to run this script)
9+
# must have the `Key Vault Crypto User` role (or at minimum the `Sign`
10+
# action) on that key.
11+
# - The App must be installed on the target organization/account
12+
# (`InstallationOwner`) with the permissions/repositories it needs.
13+
#
14+
# Installation tokens (ghs_*) are exempt from the enterprise classic-PAT
15+
# lifetime policy, which is why this replaces the long-lived PAT.
16+
17+
[CmdletBinding()]
18+
param(
19+
# Name of the Key Vault that holds the GitHub App's RSA signing key.
20+
[Parameter(Mandatory = $true)]
21+
[string] $KeyVaultName,
22+
23+
# Name of the RSA key inside the Key Vault (the App's private key).
24+
[Parameter(Mandatory = $true)]
25+
[string] $KeyName,
26+
27+
# The GitHub App's Client ID (the value to put in the `iss` JWT claim).
28+
[Parameter(Mandatory = $true)]
29+
[string] $AppClientId,
30+
31+
# Login of the organization or user account whose installation we should
32+
# mint the token for (e.g. `dotnet`, `microsoft`).
33+
[Parameter(Mandatory = $true)]
34+
[string] $InstallationOwner,
35+
36+
# Optional Azure DevOps pipeline variable name to set with the installation
37+
# token (marked as a secret). When not specified, the token is written to
38+
# stdout instead.
39+
[Parameter(Mandatory = $false)]
40+
[string] $OutputVariableName
41+
)
42+
43+
$ErrorActionPreference = 'Stop'
44+
$PSNativeCommandUseErrorActionPreference = $true
45+
46+
. $PSScriptRoot\pipeline-logging-functions.ps1
47+
48+
function ConvertTo-Base64Url([byte[]] $bytes) {
49+
return [Convert]::ToBase64String($bytes).TrimEnd('=').Replace('+', '-').Replace('/', '_')
50+
}
51+
52+
# Build JWT header and payload. Use [ordered] hashtables so JSON
53+
# serialization is deterministic.
54+
$jwtHeader = [ordered]@{
55+
alg = 'RS256'
56+
typ = 'JWT'
57+
}
58+
$now = [System.DateTimeOffset]::UtcNow
59+
$jwtPayload = [ordered]@{
60+
iat = $now.AddMinutes(-1).ToUnixTimeSeconds()
61+
exp = $now.AddMinutes(5).ToUnixTimeSeconds()
62+
iss = $AppClientId
63+
}
64+
65+
$headerEncoded = ConvertTo-Base64Url ([System.Text.Encoding]::UTF8.GetBytes(($jwtHeader | ConvertTo-Json -Compress)))
66+
$payloadEncoded = ConvertTo-Base64Url ([System.Text.Encoding]::UTF8.GetBytes(($jwtPayload | ConvertTo-Json -Compress)))
67+
$signingInput = "$headerEncoded.$payloadEncoded"
68+
69+
# Key Vault `sign` expects the *digest* (base64), not the raw bytes.
70+
$sha256 = [System.Security.Cryptography.SHA256]::Create()
71+
$digestBytes = $sha256.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($signingInput))
72+
$digestBase64 = [Convert]::ToBase64String($digestBytes)
73+
74+
Write-Host "Signing JWT with key '$KeyName' in vault '$KeyVaultName'..."
75+
try {
76+
$signatureUrl = az keyvault key sign `
77+
--vault-name $KeyVaultName `
78+
--name $KeyName `
79+
--algorithm RS256 `
80+
--digest $digestBase64 `
81+
--query value `
82+
--output tsv `
83+
--only-show-errors
84+
}
85+
catch {
86+
Write-PipelineTelemetryError -Category 'Build' -Message "Failed to sign the JWT via Key Vault (key '$KeyName', vault '$KeyVaultName'): $_. Verify the service connection identity has the 'Key Vault Crypto User' role (Sign action) on the key."
87+
exit 1
88+
}
89+
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($signatureUrl)) {
90+
Write-PipelineTelemetryError -Category 'Build' -Message "'az keyvault key sign' exited with code $LASTEXITCODE for key '$KeyName' in vault '$KeyVaultName'. Verify the service connection identity has the 'Key Vault Crypto User' role (Sign action) on the key."
91+
exit 1
92+
}
93+
$jwt = "$signingInput.$($signatureUrl.Trim())"
94+
95+
$headers = @{
96+
Authorization = "Bearer $jwt"
97+
'X-GitHub-Api-Version' = '2022-11-28'
98+
Accept = 'application/vnd.github+json'
99+
'User-Agent' = 'dotnet-arcade-onelocbuild'
100+
}
101+
102+
Write-Host "Looking up installation for '$InstallationOwner'..."
103+
try {
104+
$installations = @()
105+
$page = 1
106+
do {
107+
$pageInstallations = @(Invoke-RestMethod `
108+
-Uri "https://api.github.com/app/installations?per_page=100&page=$page" `
109+
-Headers $headers `
110+
-Method Get)
111+
$installations += $pageInstallations
112+
$page++
113+
} while ($pageInstallations.Count -eq 100)
114+
}
115+
catch {
116+
Write-PipelineTelemetryError -Category 'Build' -Message "Failed to list GitHub App installations: $_. The signed JWT may be invalid or the App's Client ID ('$AppClientId') may be incorrect."
117+
exit 1
118+
}
119+
$installation = $installations | Where-Object { $_.account.login -ieq $InstallationOwner } | Select-Object -First 1
120+
if (-not $installation) {
121+
$found = ($installations | ForEach-Object { $_.account.login }) -join ', '
122+
Write-PipelineTelemetryError -Category 'Build' -Message "No installation found for '$InstallationOwner'. App is installed on: $found"
123+
exit 1
124+
}
125+
126+
try {
127+
$tokenResponse = Invoke-RestMethod `
128+
-Uri "https://api.github.com/app/installations/$($installation.id)/access_tokens" `
129+
-Headers $headers `
130+
-Method Post `
131+
-ContentType 'application/json'
132+
}
133+
catch {
134+
Write-PipelineTelemetryError -Category 'Build' -Message "Failed to mint an installation access token for '$InstallationOwner' (installation $($installation.id)): $_"
135+
exit 1
136+
}
137+
138+
Write-Host "Got installation token for '$InstallationOwner' (expires $($tokenResponse.expires_at))."
139+
if ($OutputVariableName) {
140+
Write-Host "Setting pipeline variable '$OutputVariableName'."
141+
Write-Host "##vso[task.setvariable variable=$OutputVariableName;issecret=true]$($tokenResponse.token)"
142+
}
143+
else {
144+
Write-Host $tokenResponse.token -ForegroundColor Green
145+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Mints a short-lived GitHub App installation access token by signing a JWT
2+
# with a private key stored in Azure Key Vault (RSA, RS256). The JWT is
3+
# exchanged with the GitHub API for a token scoped to a single installation.
4+
#
5+
# Requirements (per GitHub App you want to authenticate as):
6+
# - A GitHub App with its private key uploaded into Key Vault as an RSA key
7+
# (PEM converted to a key, NOT stored as a secret).
8+
# - The Azure service connection passed via `azureSubscription` must be
9+
# granted the `Key Vault Crypto User` role (or at minimum `Sign` action)
10+
# on that key.
11+
# - The App must be installed on the target organization/account
12+
# (`installationOwner`) with the permissions/repositories you need.
13+
#
14+
# Output: a secret pipeline variable named ${{ parameters.outputVariableName }}
15+
# containing the installation access token. Token lifetime is ~1 hour and is
16+
# automatically scrubbed from logs. Installation tokens are exempt from the
17+
# enterprise classic-PAT lifetime policy.
18+
19+
parameters:
20+
# Azure DevOps service connection (federated) that can call
21+
# `az keyvault key sign` on the App's signing key.
22+
- name: azureSubscription
23+
type: string
24+
25+
# Name of the Key Vault that holds the GitHub App's RSA signing key.
26+
- name: keyVaultName
27+
type: string
28+
29+
# Name of the RSA key inside the Key Vault (the App's private key).
30+
- name: keyName
31+
type: string
32+
33+
# The GitHub App's Client ID (the value to put in the `iss` JWT claim).
34+
# Prefer this over the numeric App ID; GitHub accepts either, but Client ID
35+
# is the documented form going forward.
36+
- name: appClientId
37+
type: string
38+
39+
# Login of the organization or user account whose installation we should
40+
# mint the token for (e.g. `dotnet`, `microsoft`).
41+
- name: installationOwner
42+
type: string
43+
44+
# Name of the pipeline variable that will receive the installation token.
45+
- name: outputVariableName
46+
type: string
47+
48+
- name: is1ESPipeline
49+
type: boolean
50+
51+
- name: stepName
52+
type: string
53+
default: getGitHubAppInstallationToken
54+
55+
- name: condition
56+
type: string
57+
default: ''
58+
59+
- name: displayName
60+
type: string
61+
default: Get GitHub App installation token
62+
63+
steps:
64+
- task: AzureCLI@2
65+
displayName: ${{ parameters.displayName }}
66+
name: ${{ parameters.stepName }}
67+
${{ if ne(parameters.condition, '') }}:
68+
condition: ${{ parameters.condition }}
69+
inputs:
70+
azureSubscription: ${{ parameters.azureSubscription }}
71+
scriptType: pscore
72+
scriptLocation: inlineScript
73+
inlineScript: |
74+
& "$(System.DefaultWorkingDirectory)/eng/common/Get-GitHubAppToken.ps1" `
75+
-KeyVaultName '${{ parameters.keyVaultName }}' `
76+
-KeyName '${{ parameters.keyName }}' `
77+
-AppClientId '${{ parameters.appClientId }}' `
78+
-InstallationOwner '${{ parameters.installationOwner }}' `
79+
-OutputVariableName '${{ parameters.outputVariableName }}'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
steps:
2+
- template: /eng/common/core-templates/steps/get-github-app-token.yml
3+
parameters:
4+
is1ESPipeline: true
5+
6+
${{ each parameter in parameters }}:
7+
${{ parameter.key }}: ${{ parameter.value }}

eng/common/templates/job/execute-sdl.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
displayName: Run SDL tool
3737
condition: and(succeededOrFailed(), eq( ${{ parameters.enable }}, 'true'))
3838
variables:
39-
- group: DotNet-VSTS-Bot
4039
- name: AzDOProjectName
4140
value: ${{ parameters.AzDOProjectName }}
4241
- name: AzDOPipelineId
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
steps:
2+
- template: /eng/common/core-templates/steps/get-github-app-token.yml
3+
parameters:
4+
is1ESPipeline: false
5+
6+
${{ each parameter in parameters }}:
7+
${{ parameter.key }}: ${{ parameter.value }}

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"cmake": "3.21.0"
1212
},
1313
"msbuild-sdks": {
14-
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.26405.8",
15-
"Microsoft.DotNet.CMake.Sdk": "8.0.0-beta.26405.8"
14+
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.26410.9",
15+
"Microsoft.DotNet.CMake.Sdk": "8.0.0-beta.26410.9"
1616
}
1717
}

0 commit comments

Comments
 (0)