Add Azure DevOps NuGet release pipeline for nuget.org publishing - #192
Add Azure DevOps NuGet release pipeline for nuget.org publishing#192Mike Krüger (mkrueger) wants to merge 2 commits into
Conversation
Manual-only OneBranch release pipeline that consumes the signed packages from the CosmosDB-Shell-Official build and pushes them to nuget.org behind the nuget-org-release environment approval. Defaults to dryRun=true.
There was a problem hiding this comment.
Pull request overview
Adds a manual-only Azure DevOps (OneBranch) release pipeline to publish the already-signed CosmosDBShell NuGet packages produced by the Official build pipeline to nuget.org, gated by an environment approval and supporting a default dry-run validation mode.
Changes:
- Introduces
.pipelines/CosmosDB-Shell-Release-NuGet.ymlwithtrigger: none/pr: noneanddryRun+debugparameters. - Downloads the
cosmos_shell_allartifact from theCosmosDB-Shell-Officialpipeline, validates the expected package set, and conditionally pushes to nuget.org behind a deployment/environment approval.
… artifact CosmosDB-Shell-Release-NuGet.yml: the RID validation only checked that at least one package matched each pattern, so a leftover duplicate (e.g. two versions of the win-x64 package) would still pass and get pushed to nuget.org alongside the intended one. Each RID pattern now must match exactly one file; a duplicate throws and lists the matched names. CosmosDB-Shell-Official.yml: the published cosmos_shell_all artifact contained two loose Windows exes (out\win-x64\CosmosDBShell.exe, out\win-arm64\CosmosDBShell.exe) alongside the zips and nupkgs, kept only so BinSkim had PE files to scan (it doesn't descend into zip/nupkg archives). Added a step that copies those two exes to _binskim-scan\ outside out\ before the final trim, switched ob_sdl_binskim_scanOutputDirectoryOnly to false so BinSkim scans the whole checkout instead of just out\, and dropped win-x64/win-arm64 from the trim step's keep-list. The published artifact now contains only zip/nupkg/_manifest; BinSkim still gets the same signed exes to scan from the staged location. Addresses a Copilot review comment on PR #192 and the reported stray-exe artifact issue.
FixesCopilot review comment ( Stray Windows exes in the build artifact:
Published artifact now contains only |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
.pipelines/CosmosDB-Shell-Release-NuGet.yml:174
- The release validation requires a CosmosDBShell.FrameworkDependent.* package, but the Official pipeline’s package set validation only expects RID packages plus a single non-RID pointer (and it explicitly rejects CosmosDBShell.any.*). As written, this pipeline will fail validation against the current Official build artifacts and/or may allow an unintended any-RID package to be treated as the pointer.
# The framework-dependent tool package (requires .NET 10
# on the target machine) ships alongside the RID set.
$fdd = $packages | Where-Object { $_.Name -match '^CosmosDBShell\.FrameworkDependent\..+\.nupkg$' }
if (-not $fdd -or $fdd.Count -ne 1) {
$names = @($fdd | ForEach-Object { $_.Name })
.pipelines/CosmosDB-Shell-Release-NuGet.yml:13
- The one-time setup instructions reference a 'CosmosDBShell.FrameworkDependent' package ID, but this repo/pipelines don’t produce that package (the only expected packages are the RID-specific CosmosDBShell. packages plus a single non-RID pointer). This instruction is misleading for the required nuget.org ownership/API key scope.
This issue also appears on line 170 of the same file.
# 1. nuget.org: create/own the 'CosmosDBShell' package ID and the #
# 'CosmosDBShell.FrameworkDependent' package ID under the 'cosmosdbshell' #
# organization and generate a scoped API key covering both. #
…as zips (#191) ## Summary Reworks the **Official build** (`.pipelines/CosmosDB-Shell-Official.yml`) so the two distribution channels have a single, clear purpose each: - **NuGet = framework-dependent.** Publishes exactly one RID-agnostic .NET tool package under the primary PackageId **`CosmosDBShell`** (`tools/net10.0/any`). It resolves the runtime from the machine's installed **.NET 10**, so it's much smaller than a self-contained build. - **Self-contained = zips only.** Standalone, per-RID single-file executables continue to ship as `cosmosdbshell_<rid>_<version>.zip` for users who don't have .NET installed. ## What changed - **Removed** the self-contained RID NuGet packages (`CosmosDBShell.<rid>`) and the non-RID pointer package from publishing. - **Removed** the separate `CosmosDBShell.FrameworkDependent` package — the framework-dependent build is now the primary `CosmosDBShell` package. - **Removed** the framework-dependent zips (`cosmosdbshell_fdd_<rid>_...`); zips are self-contained only. - **Pack**: a single `dotnet pack` with `ToolPackageRuntimeIdentifiers`/`RuntimeIdentifiers` cleared and `SelfContained=false`/`PublishSingleFile=false`, emitting one `tools/net10.0/any` package. - **Payload signing / validation / push** updated to the single package (validation now asserts exactly one `CosmosDBShell` package and rejects any RID/variant package). - `csproj` defaults are unchanged; the framework-dependent behavior is driven entirely by command-line MSBuild overrides, so the self-contained zip publishes and local/GitHub Actions builds are unaffected. ## Result | Channel | Runtime included | Intended user | |---|---|---| | `dotnet tool install CosmosDBShell` | No (needs .NET 10) | Has the .NET 10 SDK/runtime | | `cosmosdbshell_<rid>_<version>.zip` | Yes | Wants a standalone binary | ## Testing - YAML validated (no schema/lint errors). - `dotnet pack` with the pipeline overrides verified locally: produces exactly one `CosmosDBShell.<version>.nupkg` (~36 MB) laid out as `tools/net10.0/any/` with `DotnetToolSettings.xml`. ## Follow-ups (not in this PR) - The nuget.org **release pipeline** (#192) still validates the old 8-package set; it needs to be updated to the single `CosmosDBShell` framework-dependent package. - The GitHub Actions `validate-and-package` workflow and README install docs still describe the per-RID packages; they can be aligned separately if we want the local/validation path to match.
Summary
Adds
.pipelines/CosmosDB-Shell-Release-NuGet.yml, a manual-only Azure DevOps (OneBranch) release pipeline that publishes the already-signed CosmosDBShell NuGet packages to nuget.org.This is an ongoing process — opening as a draft while the one-time Azure DevOps / nuget.org setup is completed.
How it works
CosmosDB-Shell-Officialbuild via apipelinesresource.nuget-org-releaseAzure DevOps Environment (via adeploymentjob).dryRun: true(default) validates the package set without pushing; re-run withdryRun: falseto publish.trigger: none/pr: none— release is initiated manually only.Publish contract
Validates and publishes:
CosmosDBShell.{win-x64,win-arm64,linux-x64,linux-arm64,osx-x64,osx-arm64}CosmosDBShellCosmosDBShell.FrameworkDependentOne-time setup required before first live run
CosmosDBShellandCosmosDBShell.FrameworkDependentpackage IDs and generate a scoped API key covering both.nuget-org-cosmosdbshellNuGet service connection pointing at nuget.org with that key.nuget-org-releaseEnvironment with the required approvers.CosmosDB-Shell-Release-NuGet.Testing