Skip to content
Merged
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
36 changes: 18 additions & 18 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?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.112">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</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.112">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</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.112">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</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.112">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</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.112">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</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.112">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</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.112">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>547c640d5626b2976499cb3433abc741a63d67c5</Sha>
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="11.0.0-prerelease.26411.5">
<Uri>https://github.com/dotnet/xharness</Uri>
Expand All @@ -55,12 +55,12 @@
<Sha>6e107357d924afdb14469eba486c54b2521c006b</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.112">
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</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.112">
<Sha>19bc97f3dd3ab67c7810e4ab179125b7c6a60641</Sha>
<Uri>https://github.com/dotnet/dotnet</Uri>
</Dependency>
<Dependency Name="Microsoft.Android.Sdk.Windows" Version="36.1.95">
Expand Down
8 changes: 4 additions & 4 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</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.112</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkPackageVersion>11.0.0-rc.1.26411.112</MicrosoftNETILLinkPackageVersion>
<SystemThreadingChannelsPackageVersion>11.0.0-rc.1.26411.112</SystemThreadingChannelsPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>11.0.0-rc.1.26411.112</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>
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
}
11 changes: 10 additions & 1 deletion eng/common/SetupNugetSources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
# filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1
# arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token
# env:
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
# Token: $(InternalFeedToken)
#
# Note: This logic is abstracted into enable-internal-sources.yml, which uses
# NuGetAuthenticate or a WIF-backed service connection. Prefer that template
# over calling this script directly.
#
# Note that the NuGetAuthenticate task should be called after SetupNugetSources.
# This ensures that:
Expand All @@ -32,6 +36,11 @@ $ErrorActionPreference = "Stop"
Set-StrictMode -Version 2.0
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# This script only consumes helper functions from tools.ps1 to configure NuGet feeds.
# Skip importing configure-toolset.ps1 so that repo-specific toolset setup (e.g. acquiring
# a bootstrap SDK) is not triggered as a side effect of feed configuration.
$disableConfigureToolsetImport = $true

. $PSScriptRoot\tools.ps1

# Adds or enables the package source with the given name
Expand Down
5 changes: 5 additions & 0 deletions eng/common/SetupNugetSources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ while [[ -h "$source" ]]; do
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

# This script only consumes helper functions from tools.sh to configure NuGet feeds.
# Skip importing configure-toolset.sh so that repo-specific toolset setup (e.g. acquiring
# a bootstrap SDK) is not triggered as a side effect of feed configuration.
disable_configure_toolset_import=1

. "$scriptroot/tools.sh"

if [ ! -f "$ConfigFile" ]; then
Expand Down
28 changes: 26 additions & 2 deletions eng/common/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Param(
[switch] $clean,
[switch][Alias('pb')]$productBuild,
[switch]$fromVMR,
[switch]$disablePipelineSetResult,
[switch][Alias('bl')]$binaryLog,
[string][Alias('bln')]$binaryLogName = '',
[switch][Alias('nobl')]$excludeCIBinarylog,
[switch] $ci,
[switch] $prepareMachine,
Expand All @@ -46,6 +48,7 @@ function Print-Usage() {
Write-Host " -platform <value> Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild"
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
Write-Host " -binaryLog Output binary log (short: -bl)"
Write-Host " -binaryLogName <value> Binary log file name or path; implies -binaryLog (short: -bln)"
Write-Host " -help Print help and exit"
Write-Host ""

Expand Down Expand Up @@ -78,6 +81,7 @@ function Print-Usage() {
Write-Host " -nodeReuse <value> Sets nodereuse msbuild parameter ('true' or 'false')"
Write-Host " -buildCheck Sets /check msbuild parameter"
Write-Host " -fromVMR Set when building from within the VMR"
Write-Host " -disablePipelineSetResult Set to disable masking the actual exit code in the pipeline when the build fails"
Write-Host ""

Write-Host "Command line arguments not listed above are passed thru to msbuild."
Expand All @@ -102,7 +106,19 @@ function Build {
$toolsetBuildProj = InitializeToolset
InitializeCustomToolset

$bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'Build.binlog') } else { '' }
$bl = ''
if ($binaryLog) {
$binaryLogPath = if ([string]::IsNullOrEmpty($binaryLogName)) {
Join-Path $LogDir 'Build.binlog'
} elseif ([System.IO.Path]::IsPathRooted($binaryLogName)) {
$binaryLogName
} else {
Join-Path $LogDir $binaryLogName
}

Create-Directory (Split-Path -Parent $binaryLogPath)
$bl = '/bl:' + $binaryLogPath
}
$platformArg = if ($platform) { "/p:Platform=$platform" } else { '' }
$check = if ($buildCheck) { '/check' } else { '' }

Expand Down Expand Up @@ -159,7 +175,15 @@ try {
if (-not $excludeCIBinarylog) {
$binaryLog = $true
}
$nodeReuse = $false
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
# Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on.
if ($env:MSBUILD_NODEREUSE_ENABLED -ne "1") {
$nodeReuse = $false
}
}

if (-not [string]::IsNullOrEmpty($binaryLogName)) {
$binaryLog = $true
}

if ($nativeToolsOnMachine) {
Expand Down
Loading