Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-android -->
<add key="darc-pub-dotnet-android-ff0d29e" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-android-ff0d29ef/nuget/v3/index.json" />
<add key="darc-pub-dotnet-android-dc9a852" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-android-dc9a8524/nuget/v3/index.json" />
<add key="darc-pub-dotnet-android-1361e50" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-android-1361e505/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-android -->
<!-- Begin: Package sources from dotnet-macios -->
Expand All @@ -16,6 +16,8 @@
<!-- End: Package sources from dotnet-maui -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet12" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet12/nuget/v3/index.json" />
<add key="dotnet12-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet12-transport/nuget/v3/index.json" />
<add key="dotnet11" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11/nuget/v3/index.json" />
<add key="dotnet11-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11-transport/nuget/v3/index.json" />
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
Expand Down
48 changes: 24 additions & 24 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="11.0.0-preview.5.26261.101">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="11.0.0-rc.1.26411.119">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink" Version="11.0.0-preview.5.26261.101">
<Dependency Name="Microsoft.NET.ILLink" Version="11.0.0-rc.1.26411.119">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
</Dependency>
<Dependency Name="System.Threading.Channels" Version="11.0.0-preview.5.26261.101">
<Dependency Name="System.Threading.Channels" Version="11.0.0-rc.1.26411.119">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging" Version="11.0.0-preview.5.26261.101">
<Dependency Name="Microsoft.Extensions.Logging" Version="11.0.0-rc.1.26411.119">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
</Dependency>
<Dependency Name="Microsoft.WindowsDesktop.App.Ref" Version="11.0.0-preview.5.26261.101">
<Dependency Name="Microsoft.WindowsDesktop.App.Ref" Version="11.0.0-rc.1.26411.119">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Runtime.Emscripten.3.1.56.Node.win-x64" Version="11.0.0-preview.5.26261.101">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26261.101">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26411.119">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="11.0.0-beta.26261.101">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="11.0.0-beta.26411.119">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="11.0.0-prerelease.26411.5">
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="11.0.0-prerelease.26419.1">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>26a41b1f0f571bf8ca7a4928ef7a8c5b3b8a4612</Sha>
<Sha>8dd9b8e6004e22c7b120af0631f0809865ff2088</Sha>
</Dependency>
<!--
Maui Rollback Version mappings, default means generated from sdk version. Allows for manual override of version similar to https://github.com/dotnet/maui/blob/df8cfcf635a590955a8cc3d6cf7ae6280449dd3f/eng/Versions.props#L138-L146, where the logic comes from:
Expand All @@ -51,21 +51,21 @@
Mapping_Microsoft.tvOS.Sdk:default
-->
<!-- Dependencies for .NET MAUI workload -->
<Dependency Name="Microsoft.Maui.Controls" Version="10.0.110-ci.main.26411.2">
<Sha>bf62313db2cecf3215f10c353720b341aba0a4ee</Sha>
<Dependency Name="Microsoft.Maui.Controls" Version="10.0.110-ci.main.26418.1">
<Sha>5d354a6a14e3136d6d503d5914f9227a9b113835</Sha>
<Uri>https://github.com/dotnet/maui</Uri>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk" Version="11.0.100-preview.5.26261.101">
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Dependency Name="Microsoft.NET.Sdk" Version="11.0.100-rc.1.26411.119">
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
<Uri>https://github.com/dotnet/dotnet</Uri>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="11.0.0-preview.5.26261.101">
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="11.0.0-rc.1.26411.119">
<Sha>7cdb217445905f3342bbb0266a4497b9a014389a</Sha>
<Uri>https://github.com/dotnet/dotnet</Uri>
</Dependency>
<Dependency Name="Microsoft.Android.Sdk.Windows" Version="36.1.95">
<Dependency Name="Microsoft.Android.Sdk.Windows" Version="36.1.107">
<Uri>https://github.com/dotnet/android</Uri>
<Sha>ff0d29ef85743d46ebce52981efc1d063b10c9e4</Sha>
<Sha>dc9a8524138e4b2e26d8a4df04baeb125a01e59b</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100" Version="9.0.1">
<Sha>4c9d1b112c16716c2479e054e9ad4db8b5b8c70c</Sha>
Expand Down
10 changes: 5 additions & 5 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</PropertyGroup>
<!--Package versions-->
<PropertyGroup>
<MicrosoftNETILLinkTasksVersion>11.0.0-preview.5.26261.101</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkPackageVersion>11.0.0-preview.5.26261.101</MicrosoftNETILLinkPackageVersion>
<SystemThreadingChannelsPackageVersion>11.0.0-preview.5.26261.101</SystemThreadingChannelsPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>11.0.0-preview.5.26261.101</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftNETILLinkTasksVersion>11.0.0-rc.1.26411.119</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkPackageVersion>11.0.0-rc.1.26411.119</MicrosoftNETILLinkPackageVersion>
<SystemThreadingChannelsPackageVersion>11.0.0-rc.1.26411.119</SystemThreadingChannelsPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>11.0.0-rc.1.26411.119</MicrosoftExtensionsLoggingPackageVersion>
<BenchmarkDotNetVersion>0.16.0-nightly.20260801.595</BenchmarkDotNetVersion>
<MicrosoftNETRuntimeEmscripten3156Nodewinx64Version>11.0.0-preview.5.26261.101</MicrosoftNETRuntimeEmscripten3156Nodewinx64Version>
<MicrosoftDotNetXHarnessCLIVersion>11.0.0-prerelease.26411.5</MicrosoftDotNetXHarnessCLIVersion>
<MicrosoftDotNetXHarnessCLIVersion>11.0.0-prerelease.26419.1</MicrosoftDotNetXHarnessCLIVersion>
</PropertyGroup>
<!--Package names-->
<PropertyGroup>
Expand Down
154 changes: 154 additions & 0 deletions eng/common/Get-GitHubAppToken.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Mints a short-lived GitHub App installation access token by signing a JWT
# with a private key stored in Azure Key Vault (RSA, RS256). The signed JWT is
# exchanged with the GitHub API for a token scoped to a single installation.
#
# Requirements:
# - A GitHub App whose private key has been uploaded into Key Vault as an RSA
# key (the PEM converted to a Key Vault *key*, NOT stored as a secret).
# - The caller (the federated Azure service connection used to run this script)
# must have the `Key Vault Crypto User` role (or at minimum the `Sign`
# action) on that key.
# - The App must be installed on the target organization/account
# (`InstallationOwner`) with the permissions/repositories it needs.
#
# Installation tokens (ghs_*) are exempt from the enterprise classic-PAT
# lifetime policy, which is why this replaces the long-lived PAT.

[CmdletBinding()]
param(
# Name of the Key Vault that holds the GitHub App's RSA signing key.
[Parameter(Mandatory = $true)]
[string] $KeyVaultName,

# Name of the RSA key inside the Key Vault (the App's private key).
[Parameter(Mandatory = $true)]
[string] $KeyName,

# The GitHub App's Client ID (the value to put in the `iss` JWT claim).
[Parameter(Mandatory = $true)]
[string] $AppClientId,

# Login of the organization or user account whose installation we should
# mint the token for (e.g. `dotnet`, `microsoft`).
[Parameter(Mandatory = $true)]
[string] $InstallationOwner,

# Optional Azure DevOps pipeline variable name to set with the installation
# token (marked as a secret). When not specified, the token is written to
# stdout instead.
[Parameter(Mandatory = $false)]
[string] $OutputVariableName
)

$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

. $PSScriptRoot\pipeline-logging-functions.ps1

function ConvertTo-Base64Url([byte[]] $bytes) {
return [Convert]::ToBase64String($bytes).TrimEnd('=').Replace('+', '-').Replace('/', '_')
}

# Build JWT header and payload. Use [ordered] hashtables so JSON
# serialization is deterministic.
$jwtHeader = [ordered]@{
alg = 'RS256'
typ = 'JWT'
}
$now = [System.DateTimeOffset]::UtcNow
$jwtPayload = [ordered]@{
iat = $now.AddMinutes(-1).ToUnixTimeSeconds()
exp = $now.AddMinutes(5).ToUnixTimeSeconds()
iss = $AppClientId
}

$headerEncoded = ConvertTo-Base64Url ([System.Text.Encoding]::UTF8.GetBytes(($jwtHeader | ConvertTo-Json -Compress)))
$payloadEncoded = ConvertTo-Base64Url ([System.Text.Encoding]::UTF8.GetBytes(($jwtPayload | ConvertTo-Json -Compress)))
$signingInput = "$headerEncoded.$payloadEncoded"

# Key Vault `sign` expects the *digest* (base64), not the raw bytes.
$sha256 = [System.Security.Cryptography.SHA256]::Create()
$digestBytes = $sha256.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($signingInput))
$digestBase64 = [Convert]::ToBase64String($digestBytes)

Write-Host "Signing JWT with key '$KeyName' in vault '$KeyVaultName'..."
$previousNativeCommandErrorPreference = $PSNativeCommandUseErrorActionPreference
try {
# Azure CLI can emit non-fatal Python warnings to stderr even when signing succeeds.
# Use the exit code to determine success for this invocation.
$PSNativeCommandUseErrorActionPreference = $false
$signatureBase64 = az keyvault key sign `
--vault-name $KeyVaultName `
--name $KeyName `
--algorithm RS256 `
--digest $digestBase64 `
--query signature `
--output tsv `
--only-show-errors
$signExitCode = $LASTEXITCODE
}
catch {
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."
exit 1
}
finally {
$PSNativeCommandUseErrorActionPreference = $previousNativeCommandErrorPreference
}
if ($signExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($signatureBase64)) {
Write-PipelineTelemetryError -Category 'Build' -Message "'az keyvault key sign' exited with code $signExitCode for key '$KeyName' in vault '$KeyVaultName'. Verify the service connection identity has the 'Key Vault Crypto User' role (Sign action) on the key."
exit 1
}
$signatureUrl = $signatureBase64.Trim().TrimEnd('=').Replace('+', '-').Replace('/', '_')
$jwt = "$signingInput.$signatureUrl"

$headers = @{
Authorization = "Bearer $jwt"
'X-GitHub-Api-Version' = '2022-11-28'
Accept = 'application/vnd.github+json'
'User-Agent' = 'dotnet-arcade-onelocbuild'
}

Write-Host "Looking up installation for '$InstallationOwner'..."
try {
$installations = @()
$page = 1
do {
$pageInstallations = @(Invoke-RestMethod `
-Uri "https://github.com/ghapi/app/installations?per_page=100&page=$page" `
-Headers $headers `
-Method Get)
$installations += $pageInstallations
$page++
} while ($pageInstallations.Count -eq 100)
}
catch {
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."
exit 1
}
$installation = $installations | Where-Object { $_.account.login -ieq $InstallationOwner } | Select-Object -First 1
if (-not $installation) {
$found = ($installations | ForEach-Object { $_.account.login }) -join ', '
Write-PipelineTelemetryError -Category 'Build' -Message "No installation found for '$InstallationOwner'. App is installed on: $found"
exit 1
}

try {
$tokenResponse = Invoke-RestMethod `
-Uri "https://github.com/ghapi/app/installations/$($installation.id)/access_tokens" `
-Headers $headers `
-Method Post `
-ContentType 'application/json'
}
catch {
Write-PipelineTelemetryError -Category 'Build' -Message "Failed to mint an installation access token for '$InstallationOwner' (installation $($installation.id)): $_"
exit 1
}

Write-Host "Got installation token for '$InstallationOwner' (expires $($tokenResponse.expires_at))."
if ($OutputVariableName) {
Write-Host "Setting pipeline variable '$OutputVariableName'."
Write-Host "##vso[task.setvariable variable=$OutputVariableName;issecret=true]$($tokenResponse.token)"
}
else {
Write-Host $tokenResponse.token -ForegroundColor Green
}
Loading