Skip to content

Add Linux RPM packaging to the official pipeline - #201

Open
Mike Krüger (mkrueger) wants to merge 8 commits into
mainfrom
dev/mkrueger/linux-rpm-packaging
Open

Add Linux RPM packaging to the official pipeline#201
Mike Krüger (mkrueger) wants to merge 8 commits into
mainfrom
dev/mkrueger/linux-rpm-packaging

Conversation

@mkrueger

@mkrueger Mike Krüger (mkrueger) commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Purpose This PR adds small, framework-dependent RPM packages for internal Azure Cloud Shell deployment. They may also be useful in controlled CI environments that already provide the required runtime. These RPMs are not intended as a general-purpose Linux distribution channel. Public/general installation should continue to use the supported distribution mechanisms documented by the project. ## Packaging - builds x86_64 and aarch64 RPMs in the official pipeline - requires the preinstalled .NET 10 runtime (dotnet-runtime-10.0) - installs the launcher as /usr/bin/cosmosdbshell - publishes the RPMs in the dedicated cosmos_shell_rpm artifact - validates architecture, runtime dependency, payload layout, excluded assemblies, and the Azure Cloud Shell 25 MB package limit ## Lightweight RPM feature set The RPM is compiled with CosmosDBShellExcludeMcpAndLsp=true. This defines COSMOSDBSHELL_NO_MCP_LSP, removes the MCP and LSP implementation sources, and omits their package dependencies and embedded MCP server instructions. The RPM retains: - the interactive shell and command-line editor - scripting and structured output - ARM management support - direct and gateway Cosmos DB connectivity - OpenTelemetry tracing and OTLP export through --otel - account-key, static-token, managed-identity, Azure CLI, browser/device-code, and remaining DefaultAzureCredential authentication paths The RPM excludes: - the HTTP MCP server and Model Context Protocol dependencies - the LSP server and OmniSharp/JSON-RPC dependencies - native and managed MSAL broker components used by Visual Studio Code credential authentication Invoking --mcp, --lsp, or --stdio reports that the feature is unavailable and exits with usage code 2 rather than silently doing nothing. ### Measured size impact Like-for-like local linux-x64 framework-dependent publishes were measured after removing libmsalruntime.so, exactly as the RPM pipeline does: | Payload | Original PR #201 build | Reduced build | Savings | | --- | ---: | ---: | ---: | | Uncompressed publish payload | 34.94 MiB | 26.64 MiB | 8.30 MiB (23.8%) | | Compressed payload archive | 11.52 MiB | 8.60 MiB | 2.91 MiB (25.3%) | These are measured publish-payload and tar.gz sizes. Final RPM sizes can differ slightly because of RPM metadata and outer package compression. ## Native MSAL runtime tradeoff The RPM publish intentionally removes libmsalruntime.so. That native library is available only for linux-x64, would roughly double that package's size, and has no linux-arm64 equivalent. Because the native runtime is absent, the RPM also conditionally excludes Azure.Identity.Broker and its managed broker dependencies. VisualStudioCodeCredential does not work in these RPM builds. The shell reports that limitation and continues through the existing fallback chain. Use --azure-cli to select the signed-in Azure CLI identity explicitly in Azure Cloud Shell. The implementation makes this limitation explicit rather than relying on a runtime failure: - the RPM build sets CosmosDBShellExcludeMsalRuntime=true - that defines COSMOSDBSHELL_NO_MSAL_RUNTIME at compile time - the shell reports that VS Code credential authentication is unavailable - authentication continues through the existing fallback chain - tests verify that VS Code credential capability matches the build configuration - pipeline validation fails if native MSAL, managed broker, MCP, or LSP assemblies are accidentally included ## Validation - full test suite: 2,119 passed - normal full-feature application build succeeds - reduced linux-x64 publish succeeds - reduced-build smoke tests verify --version and interactive command execution - --mcp, --lsp, and --stdio return exit code 2 with explicit messages - --otel remains recognized and its endpoint validation remains active - the reduced payload contains four OpenTelemetry assemblies - the reduced payload contains no ModelContextProtocol, OmniSharp, Azure Identity Broker, or Microsoft Identity Client Broker assemblies - localization and connection-capability tests pass

Build framework-dependent x86_64 and aarch64 RPMs that require the .NET 10 runtime, validate their payload and Cloud Shell size limit, and document installation.

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 first-class RPM packaging support to the official OneBranch pipeline so the CosmosDBShell CLI can be installed on RPM-based Linux distributions (including Azure Linux) via a framework-dependent RPM that depends on the preinstalled .NET 10 runtime.

Changes:

  • Adds a governed Linux pipeline job that publishes x86_64 and aarch64 framework-dependent builds and packages them as compressed RPMs, with size/dependency/path validation.
  • Introduces an RPM spec (cosmosdbshell.spec) that installs the binary under /usr/libexec and exposes /usr/bin/cosmosdbshell via a symlink.
  • Documents RPM installation and records the packaging change in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
README.md Documents installing CosmosDBShell via the pipeline-produced RPM artifacts.
packaging/rpm/cosmosdbshell.spec Defines the RPM layout, runtime dependency, and installed file list.
CHANGELOG.md Notes the new official RPM outputs and Cloud Shell size-limit validation.
.pipelines/CosmosDB-Shell-Official.yml Adds a new governed Linux job to build, validate, and publish RPM artifacts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .pipelines/CosmosDB-Shell-Official.yml
@github-code-quality

github-code-quality Bot commented Aug 27, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall line coverage in commit 9858e0e in the dev/mkrueger/linux-r... branch is 62%. The line coverage in commit 4691b41 in the main branch is 61%.

Show a line coverage summary of the most impacted files.
File main 4691b41 dev/mkrueger/linux-r... 9858e0e +/-
D:\a\CosmosDBSh...PatchCommand.cs 28% 18% -10%
D:\a\CosmosDBSh...lInterpreter.cs 66% 62% -4%
D:\a\CosmosDBSh...CommandState.cs 91% 88% -3%
D:\a\CosmosDBSh...QueryCommand.cs 41% 39% -2%
D:\a\CosmosDBSh...\InfoCommand.cs 14% 12% -2%
D:\a\CosmosDBSh...ponseFactory.cs 92% 90% -2%
D:\a\CosmosDBSh...s\UdfCommand.cs 44% 43% -1%
D:\a\CosmosDBSh...iggerCommand.cs 48% 47% -1%
D:\a\CosmosDBSh...SprocCommand.cs 52% 51% -1%
D:\a\CosmosDBSh...ds\RmCommand.cs 17% 19% +2%

Updated September 01, 2026 14:56 UTC

The build containers cannot reach the public Ubuntu archives, so installing the RPM tooling with apt-get failed. Azure Linux is RPM-native and resolves packages from packages.microsoft.com, which is reachable. Also disable RPM debuginfo extraction and binary stripping, which would corrupt the appended .NET single-file bundle.
Copilot AI review requested due to automatic review settings August 27, 2026 07:01

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 4 out of 4 changed files in this pull request and generated no new comments.

Ship the ordinary framework-dependent publish output instead of a single-file bundle, so the package relies on the preinstalled .NET 10 runtime and does not extract itself at startup. Drop libmsalruntime.so, which ships only for linux-x64 and accounted for the entire size difference against linux-arm64.
Copilot AI review requested due to automatic review settings August 27, 2026 07:30

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 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

README.md:80

  • The install example uses dnf, but Azure Linux (called out in the text) typically uses tdnf (and the official pipeline installs RPM tooling via tdnf). As written, the command is likely to fail on the primary target distro; consider documenting both tdnf (Azure Linux / Cloud Shell) and dnf (other RPM distros).
sudo dnf install ./cosmosdbshell-<version>-<release>.<architecture>.rpm
cosmosdbshell

Copilot AI review requested due to automatic review settings August 27, 2026 08:42

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 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread .pipelines/CosmosDB-Shell-Official.yml
Copilot AI review requested due to automatic review settings August 27, 2026 08:52

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 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

README.md:77

  • The README implies these RPM artifacts can be installed on “other RPM-based distributions” with dnf, but the package has a hard dependency on dotnet-runtime-10.0 (from Microsoft’s RPM feeds / packages.microsoft.com). On distros without that repo configured, dnf install will fail even if the .NET runtime was installed by other means. Consider clarifying the prerequisite (Microsoft .NET RPM repo enabled) so the installation steps are actionable.
The official pipeline produces framework-dependent RPMs for Azure Linux and
other RPM-based distributions:

- `cosmosdbshell-<version>-<release>.x86_64.rpm`
- `cosmosdbshell-<version>-<release>.aarch64.rpm`

Copilot AI review requested due to automatic review settings August 27, 2026 10:03

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 8 out of 8 changed files in this pull request and generated no new comments.

Conditionally omit MCP, LSP, and unavailable broker dependencies from RPM builds while retaining the interactive shell, ARM support, direct/gateway connectivity, and OpenTelemetry. Document and validate the reduced RPM feature set.
Copilot AI review requested due to automatic review settings September 1, 2026 12:38

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread CosmosDBShell/Program.cs
#endif

IHost? host = null;
IDisposable? host = null;
Conditionally omit the embedded programming and NoSQL query guides together with the other MCP resources when MCP and LSP are excluded.
Copilot AI review requested due to automatic review settings September 1, 2026 14:53

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 12 out of 12 changed files in this pull request and generated 3 comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

README.md:70

  • This section reads like a general installation pathway for RPM-based distros, but the PR description explicitly scopes RPMs to internal Azure Cloud Shell deployment / controlled CI and says they are not a general-purpose distribution channel. Adding that caveat here would avoid misleading readers.
The official pipeline produces framework-dependent RPMs for Azure Linux and
other RPM-based distributions:

Comment thread CosmosDBShell/Program.cs
Comment on lines +193 to +195
ShellInterpreter.WriteLine(MessageService.GetString("error-lsp-not-included"));
Environment.ExitCode = ShellExitCode.UsageError;
return;
Comment on lines 93 to +97
<PackageReference Include="Fluent.Net" />
<PackageReference Include="Microsoft.Azure.Cosmos" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="ModelContextProtocol" />
<PackageReference Include="ModelContextProtocol.AspNetCore" />
<PackageReference Include="OmniSharp.Extensions.LanguageServer" />
<PackageReference Include="Newtonsoft.Json" Condition="'$(CosmosDBShellExcludeMcpAndLsp)' == 'true'" />
<PackageReference Include="Microsoft.Extensions.Hosting" Condition="'$(CosmosDBShellExcludeMcpAndLsp)' != 'true'" />
<PackageReference Include="ModelContextProtocol" Condition="'$(CosmosDBShellExcludeMcpAndLsp)' != 'true'" />
Comment thread Directory.Packages.props
Comment on lines 13 to 18
<PackageVersion Include="Fluent.Net" Version="1.0.63" />
<PackageVersion Include="Jil" Version="2.17.0" />
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.59.0-preview.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.3.0" />
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