Skip to content

Add Azure DevOps NuGet release pipeline for nuget.org publishing - #192

Closed
Mike Krüger (mkrueger) wants to merge 2 commits into
mainfrom
dev/mkrueger/nuget-release-pipeline
Closed

Add Azure DevOps NuGet release pipeline for nuget.org publishing#192
Mike Krüger (mkrueger) wants to merge 2 commits into
mainfrom
dev/mkrueger/nuget-release-pipeline

Conversation

@mkrueger

Copy link
Copy Markdown
Collaborator

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.

Split out from the FDD packaging PR "Build framework-dependent (FDD) NuGet packages and zips in Official pipeline" (#191) so the release/publish concern is reviewed independently.

How it works

  • Does not build or sign anything — it consumes the already-signed packages produced by the CosmosDB-Shell-Official build via a pipelines resource.
  • Validates the full package set before publishing, then pushes behind a manual approval on the nuget-org-release Azure DevOps Environment (via a deployment job).
  • dryRun: true (default) validates the package set without pushing; re-run with dryRun: false to publish.
  • trigger: none / pr: none — release is initiated manually only.

Publish contract

Validates and publishes:

  • 6 RID-specific self-contained packages: CosmosDBShell.{win-x64,win-arm64,linux-x64,linux-arm64,osx-x64,osx-arm64}
  • 1 pointer (non-RID) package: CosmosDBShell
  • 1 framework-dependent package: CosmosDBShell.FrameworkDependent

Ordering note: the FDD validation expects packages produced by #191. The pipeline is manual/draft and won't run until setup is complete, so there's no hard merge-order dependency, but #191 should land before the first live release.

One-time setup required before first live run

  1. nuget.org: own the CosmosDBShell and CosmosDBShell.FrameworkDependent package IDs and generate a scoped API key covering both.
  2. Azure DevOps: create the nuget-org-cosmosdbshell NuGet service connection pointing at nuget.org with that key.
  3. Azure DevOps: create the nuget-org-release Environment with the required approvers.
  4. Register this YAML as a pipeline named CosmosDB-Shell-Release-NuGet.

Testing

  • YAML validated (no schema/lint errors).
  • No runtime execution yet — pending the setup steps above.

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.
@github-code-quality

github-code-quality Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in commit 59402d6 in the dev/mkrueger/nuget-r... branch remains at 61%, unchanged from commit 50dea94 in the main branch.


Updated August 18, 2026 09:54 UTC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yml with trigger: none / pr: none and dryRun + debug parameters.
  • Downloads the cosmos_shell_all artifact from the CosmosDB-Shell-Official pipeline, validates the expected package set, and conditionally pushes to nuget.org behind a deployment/environment approval.

Comment thread .pipelines/CosmosDB-Shell-Release-NuGet.yml
@mkrueger
Mike Krüger (mkrueger) marked this pull request as ready for review August 18, 2026 08:44
@mkrueger
Mike Krüger (mkrueger) requested a review from a team August 18, 2026 08:44
… 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.
Copilot AI review requested due to automatic review settings August 18, 2026 09:46
@mkrueger

Copy link
Copy Markdown
Collaborator Author

Fixes

Copilot review comment (.pipelines/CosmosDB-Shell-Release-NuGet.yml): the RID validation only checked that at least one package matched each pattern, so a leftover duplicate would still pass and get pushed to nuget.org. Each RID pattern must now match exactly one file; a duplicate throws and lists the matched names. Verified locally against a valid set, a duplicate win-x64, and a missing linux-arm64 — all three behave correctly.

Stray Windows exes in the build artifact: cosmos_shell_all contained two loose files — out\win-x64\CosmosDBShell.exe and out\win-arm64\CosmosDBShell.exe — alongside the zips and nupkgs. They were kept only so BinSkim had PE files to scan (it doesn't descend into zip/nupkg archives). Fix:

  • 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\ (same signed binaries, just picked up from the staged location).
  • Dropped win-x64/win-arm64 from the trim step's keep-list.

Published artifact now contains only zip/nupkg/_manifest; BinSkim coverage is unchanged. Verified the copy/trim logic locally with a simulated out\ tree.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.                #

Mike Krüger (mkrueger) added a commit that referenced this pull request Aug 19, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants