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
1 change: 1 addition & 0 deletions .github/workflows/powershell-script-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
- 'eng/pipelines/ci-official-release.Tests.ps1'
- 'eng/scripts/nuget_release_packages.ps1'
- 'eng/scripts/nuget_release_packages.Tests.ps1'
- 'eng/pipelines/common/non-workload-publish.yml'
- '.github/workflows/powershell-script-tests.yml'
workflow_dispatch:

Expand Down
65 changes: 56 additions & 9 deletions docs/ReleaseProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,72 @@ The .NET MAUI release process uses Arcade and 1ES to build, sign, gather, and pu

The pipeline accepts:

- `commitHash`: the source commit registered in BAR. The default value, `skip`, prevents all preparation, approval, workload-channel, and NuGet publishing jobs.
- `ghOwner` and `ghRepo`: the GitHub owner and repository name used to resolve
the BAR build. Keep `ghOwner: dotnet` and enter `ghRepo: android-libraries`
for an Android libraries release.
- Workload behavior is inferred for `dotnet/android`, `dotnet/macios`, and
`dotnet/maui`. Other enabled repositories use the ordinary NuGet package path.
- `commitHash`: the source commit registered in BAR. The first matching build
returned by Darc is used, preserving the existing workload-release behavior.
The default value, `skip`, prevents
all preparation, approval, workload-channel, and NuGet publishing jobs.
- `pushWorkloadSet`: adds the resolved BAR build to the matching .NET workload release channel.
- `pushNugetOrg`: enables the NuGet.org release stages.
- `pushPackages`: when `false`, gathers and publishes release artifacts without running approvals or requesting the production NuGet service connection.
- `nugetIncludeFilters` and `nugetExcludeFilters`: semicolon-separated wildcard filters applied to package file names. Include filters select workload packs; workload manifests remain selected unless an exclude filter removes them, preserving the previous release behavior.
- `nugetAlreadyAttemptedPackFilters` and `nugetAlreadyAttemptedManifestFilters`: recovery-only wildcard filters for pack or manifest files that a previous task invocation already submitted to NuGet.org. These packages stay in the expected verification set but are withheld from another push while NuGet.org validation is still pending. Use only the parameter for the affected publish stage.
- `pushPackages`: when `false`, gathers and publishes release artifacts without promoting a workload build, running approvals, or requesting the production NuGet service connection.
- `nugetIncludeFilters` and `nugetExcludeFilters`: semicolon-separated wildcard filters applied to package file names. For workload releases, include filters select packs while manifests remain selected unless excluded, preserving the previous behavior. For non-workload releases, the filters select packages for the single release set.
- `nugetAlreadyAttemptedPackFilters` and `nugetAlreadyAttemptedManifestFilters`: workload-only recovery filters for pack or manifest files that a previous task invocation already submitted to NuGet.org. These packages stay in the expected verification set but are withheld from another push while NuGet.org validation is still pending. Use only the parameter for the affected publish stage; non-workload releases reject them.

### Non-workload NuGet packages

For repositories outside the inferred workload set, the generic non-workload path validates the
BAR build against the requested GitHub repository and gathers its shipping
NuGet packages with `darc gather-drop --id <BAR ID>`. Repeated releases of the
same BAR build may encounter packages whose downloadable BAR location was
replaced by NuGet.org after an earlier partial release. The gather continues in
that case, but every selected package that was not downloaded must be confirmed
at its exact ID/version on NuGet.org; an unavailable unpublished package fails
the release. The pipeline also rejects malformed or duplicate packages, applies
the package filters, and filters exact ID/version pairs already on NuGet.org.
All selected `.nupkg` files form one release set. Workload manifests
are rejected so a workload build cannot accidentally bypass MAUI's pack-before-
manifest ordering.

The `NuGetReleaseAudit` artifact records the selected and exact staged package
lists before manual approval. `pushPackages: false` performs the
same resolution, gather, validation, filtering, and audit without promotion or
publishing. Immediately before a real release, the pipeline filters the staged
set again so packages published since preparation do not cause conflicts. It
then uses `1ES.PublishNuget@1` and verifies every selected package on NuGet.org.

Android-libraries BAR builds contain per-build deltas, not the union of channel
assets, so release each pending build in commit order.
Before the first push for any repository, verify that the existing
`nuget.org (dotnetframework)` service connection owns every package ID in the
audit artifact.

Example dry-run inputs:

```yaml
ghOwner: dotnet
ghRepo: android-libraries
commitHash: <FULL_COMMIT_SHA>
pushWorkloadSet: false
pushNugetOrg: true
pushPackages: false
```

### Preparation

The preparation stage resolves the BAR build once and runs one fail-fast `darc gather-drop`, filtered to BAR NuGet package assets. Symbol and other path-based blob assets are not NuGet.org release inputs and are not downloaded. The stage rejects a failed or incomplete package gather, applies the include and exclude filters, and requires non-empty workload-pack and workload-manifest sets.
The preparation stage resolves the BAR build once and runs one `darc gather-drop`, filtered to BAR NuGet package assets. Symbol and other path-based blob assets are not NuGet.org release inputs and are not downloaded. Workload releases gather fail-fast, apply the include and exclude filters, and require non-empty pack and manifest sets. Non-workload releases use the single package set described above; gathering continues on individual download errors, then preparation rejects every selected package that is neither gathered nor already available on NuGet.org.

For every selected package, the stage reads the package ID and version from its nuspec and reports the selected identities and counts. It publishes two 1ES pipeline outputs:
For every gathered package, the stage reads the package ID and version from its nuspec. If a selected non-workload package was not gathered, its ID and version come from the BAR asset metadata and that exact identity must already be available on NuGet.org. The stage reports the selected identities and counts. Workload releases publish two 1ES pipeline outputs:

- `MauiPacksForNuGet`
- `MauiManifestsForNuGet`

These outputs include `expected-packages.json` and the package-availability helper used by the release jobs. They are SBOM-backed by the 1ES pipeline template and are the immutable inputs for publishing and recovery. The preparation stage records the helper's SHA-256 hash, and each production step verifies that hash before executing the artifact copy. A dry run (`pushPackages: false`) produces these artifacts but does not validate service-connection authorization, external NuGet.org authentication, or egress.

### Publishing and ordering
### Workload publishing and ordering

Workload packs and manifests have separate manual approval points. Their production jobs:

Expand All @@ -45,7 +92,7 @@ NuGet.org may reserve a package version and return HTTP 409 before that package

After each publish, the pipeline polls NuGet.org for every expected package ID and normalized version with a 30-minute deadline, then fails with the missing identities if indexing does not complete. The manifest stage depends on successful pack publication and verification, so manifest approval is unavailable until every selected pack is resolvable.

The production service connection must be protected by Azure DevOps Environment and/or service-connection approval checks outside repository YAML. Before production use, release owners must confirm that it owns every selected MAUI package ID and has enough quota for the maximum release payload. If one identity cannot cover the payload, publishing must be split into deterministic sequential batches rather than reintroducing repository API keys.
The production service connection must be protected by Azure DevOps Environment and/or service-connection approval checks outside repository YAML. Before production use, release owners must confirm that it owns every selected package ID and has enough quota for the maximum release payload. If one identity cannot cover the payload, publishing must be split into deterministic sequential batches rather than reintroducing repository API keys.

## Required internal validation

Expand All @@ -66,7 +113,7 @@ An internal Azure Artifacts feed proves task mechanics but not the exact externa

## Recovery

If publishing partially succeeds, rerun with the same commit and selection filters. The availability step removes packages that are already visible on NuGet.org. For packages accepted by the previous invocation but still undergoing NuGet.org validation, set the affected stage's `nugetAlreadyAttemptedPackFilters` or `nugetAlreadyAttemptedManifestFilters` from the package names in the prior task log, leaving the other recovery parameter at `skip`. The task receives only the remaining packages, and post-publish verification checks the complete expected set. Do not release from a different BAR drop.
If publishing partially succeeds, rerun with the same commit and selection filters. The availability step removes packages that are already visible on NuGet.org. For workload packages accepted by the previous invocation but still undergoing NuGet.org validation, set the affected stage's `nugetAlreadyAttemptedPackFilters` or `nugetAlreadyAttemptedManifestFilters` from the package names in the prior task log, leaving the other recovery parameter at `skip`. Non-workload releases have no recovery filter; rerun after accepted packages become visible. Post-publish verification checks the complete expected set. Do not release from a different BAR drop.

Published package contents cannot be replaced. If an incorrect version is published, follow NuGet.org's process to remove it from package search results.

Expand Down
16 changes: 16 additions & 0 deletions docs/design/FeatureSwitches.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ The following switches are toggled for applications running on Mono for `TrimMod
| EnableMauiDiagnostics | Microsoft.Maui.RuntimeFeature.EnableMauiDiagnostics | Enables MAUI specific diagnostics, like VisualDiagnostics and BindingDiagnostics. Defaults to EnableDiagnostics |
| _EnableMauiAspire | Microsoft.Maui.RuntimeFeature.EnableMauiAspire | When enabled, MAUI Aspire integration features are available. **Warning**: Using Aspire outside of Debug configuration may introduce performance and security risks in production. |

## Runtime settings

The following runtime settings accept values other than `true` or `false`.

| MSBuild Property Name | AppContext Setting | Default | Description |
|-|-|-|-|
| MauiUriImageSourceMaxResponseContentBufferSize | Microsoft.Maui.Controls.UriImageSource.MaxResponseContentBufferSize | 52428800 bytes (50 MiB) | Maximum number of response content bytes buffered when downloading a `UriImageSource`. |

Set the maximum `UriImageSource` download size in the app project:

```xml
<PropertyGroup>
<MauiUriImageSourceMaxResponseContentBufferSize>104857600</MauiUriImageSourceMaxResponseContentBufferSize>
</PropertyGroup>
```

## MauiEnableIVisualAssemblyScanning

When this feature is not enabled, custom and third party `IVisual` types will not be automatically discovered and registered.
Expand Down
76 changes: 71 additions & 5 deletions eng/pipelines/ci-official-release.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Describe 'ci-official-release.yml' {
BeforeAll {
$pipelinePath = Join-Path $PSScriptRoot 'ci-official-release.yml'
$pipeline = Get-Content -LiteralPath $pipelinePath -Raw
$nonWorkloadTemplate = Get-Content -LiteralPath (
Join-Path $PSScriptRoot 'common/non-workload-publish.yml') -Raw
}

It 'gathers NuGet package assets without downloading symbol blobs' {
Expand All @@ -21,13 +23,15 @@ Describe 'ci-official-release.yml' {
Should -Not -Match $packageAssetFilter
}

It 'keeps the filtered gather fail-fast' {
$gatherCommands = [regex]::Matches($pipeline, '(?m)^\s*& \$darc gather-drop.*$')
It 'keeps workload gathering fail-fast and validates non-workload misses' {
$gatherCommands = [regex]::Matches($pipeline, '(?m)^\s*& \$darc @gatherArguments.*$')

$gatherCommands.Count | Should -Be 1
$gatherCommands[0].Value | Should -Match '--asset-filter \$packageAssetFilter'
$gatherCommands[0].Value | Should -Not -Match '--continue-on-error'
$pipeline | Should -Match '(?s)& \$darc gather-drop.*?if \(\$LASTEXITCODE -ne 0\) \{\s*throw'
$pipeline | Should -Match ([regex]::Escape("'--asset-filter', `$packageAssetFilter"))
$pipeline | Should -Match '(?s)if \(!\$releaseWorkload\) \{\s*\$gatherArguments \+= ''--continue-on-error'''
$pipeline | Should -Match '(?s)& \$darc @gatherArguments.*?if \(\$gatherFailed -and \$releaseWorkload\) \{\s*throw'
$pipeline | Should -Match 'missing selected packages must already exist on NuGet\.org'
$pipeline | Should -Match '(?s)if \(\$gatherFailed\) \{.*?Write-Warning.*?\$LASTEXITCODE = 0'
}

It 'rejects duplicate package file names before copying release artifacts' {
Expand All @@ -39,4 +43,66 @@ Describe 'ci-official-release.yml' {

$duplicateCheck.Success | Should -BeTrue
}

It 'infers workload releases from the workload repositories' {
$pipeline | Should -Not -Match '(?m)^- name: releaseWorkload$'
@([regex]::Matches($pipeline, "in\(parameters\.ghRepo, 'android', 'macios', 'maui'\)")).Count |
Should -Be 1
$pipeline | Should -Match '(?s)- name: isWorkload.*?value: \$\{\{ and'
$pipeline | Should -Match '\$releaseWorkload = \[bool\]::Parse\(\$env:IS_WORKLOAD\)'
$pipeline | Should -Match '--skip-assets-publishing'
$nonWorkloadTemplate | Should -Not -Match 'skip-assets-publishing|add-build-to-channel'
}

It 'preserves first-match BAR resolution for every repository' {
$pipeline | Should -Not -Match '(?m)^- name: barBuildId$'
$pipeline | Should -Match '--repo \$sourceRepository --commit'
$pipeline | Should -Match '\$build = \$builds\[0\]'
$pipeline | Should -Not -Match 'Expected exactly one BAR build'
$pipeline | Should -Not -Match 'requiredChannel(Name|Id)|build\.channels|5172'
}

It 'publishes a generic audit before approval and supports dry runs' {
$pipeline | Should -Match 'artifactName: NuGetReleaseAudit'
$nonWorkloadTemplate | Should -Match '(?s)dependsOn: prepare_release.*ManualValidation@0'
$pipeline | Should -Match "(?s)eq\(parameters\.pushPackages, true\).*non-workload-publish\.yml"
$nonWorkloadTemplate | Should -Match '(?s)-Action FilterExisting.*?1ES\.PublishNuget@1'
$nonWorkloadTemplate | Should -Match "eq\(variables\['NuGetPackagesToPublish'\], 'true'\)"
$nonWorkloadTemplate | Should -Match '1ES\.PublishNuget@1'
$nonWorkloadTemplate | Should -Match "publishFeedCredentials: 'nuget\.org \(dotnetframework\)'"
$pipeline | Should -Not -Match '(?m)^- name: nugetPublishServiceConnection$'
$pipeline | Should -Not -Match '(?m)^- name: nugetAlreadyAttemptedNonWorkloadFilters$'
$pipeline | Should -Not -Match 'HasPackages'
$nonWorkloadTemplate | Should -Not -Match 'HasPackages'
}

It 'uses the original repository text inputs and rejects workload manifests on the inferred non-workload path' {
$pipeline | Should -Match '(?s)- name: ghRepo.*?default: maui'
$pipeline | Should -Match '(?s)- name: ghOwner.*?default: dotnet'
$pipeline | Should -Not -Match '(?s)- name: ghRepo.*?values:'
$pipeline | Should -Match 'Repository.*is not enabled for this release pipeline'
$pipeline | Should -Match "(?m)^\s*'https://github\.com/dotnet/maui',\r?$"
$pipeline | Should -Match "(?m)^\s*'https://github\.com/dotnet/android',\r?$"
$pipeline | Should -Match "(?m)^\s*'https://github\.com/dotnet/macios',\r?$"
$pipeline | Should -Match "(?m)^\s*'https://github\.com/dotnet/android-libraries'\r?$"
$pipeline | Should -Match 'non-workload release cannot contain workload manifest'
$pipeline | Should -Match '(?s)Name = ''NuGet packages''.*?Packages = \$selectedPackages.*?Identities = \$selectedIdentities'
$pipeline | Should -Match '(?s)-Action FilterExisting.*?selectedPackages.*?stagedPackages'
$pipeline | Should -Match 'belongs to ''\$repository'', not ''\$sourceRepository'''
$pipeline | Should -Match '(?s)\$barPackageAssets = @\(\$build\.assets.*?\$selectedBarAssets = @\(\$barPackageAssets'
$pipeline | Should -Match 'Gathered packages are absent from the selected BAR assets'
}

It 'supports package selection and rejects workload recovery filters for non-workload releases' {
$pipeline | Should -Match '(?s)\$selectedPackages = @\(\$allPackages \| Where-Object \{.*?' +
'Test-AnyFilter \$_.Name \$includeFilters.*?' +
'Test-AnyFilter \$_.Name \$excludeFilters.*?' +
'Package filtering selected no non-workload NuGet packages'
$pipeline | Should -Match '(?s)else \{.*?\$unsupportedFilters = @\(@\(.*?' +
'nugetAlreadyAttemptedPackFilters.*?nugetAlreadyAttemptedManifestFilters.*?' +
'\) \| Where-Object \{ \$_.Values.Count -gt 0 \}\).*?' +
'Non-workload releases do not support workload recovery filters'
$pipeline | Should -Match 'NUGET_ALREADY_ATTEMPTED_PACK_FILTERS: \$\{\{ parameters\.nugetAlreadyAttemptedPackFilters \}\}'
$pipeline | Should -Match 'NUGET_ALREADY_ATTEMPTED_MANIFEST_FILTERS: \$\{\{ parameters\.nugetAlreadyAttemptedManifestFilters \}\}'
}
}
Loading
Loading