Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ci: publish switchyard-server container from main#131

Draft
nachiketb-nvidia wants to merge 1 commit into
mainNVIDIA-NeMo/Switchyard:mainfrom
nachiketb/switchyard-server-containerNVIDIA-NeMo/Switchyard:nachiketb/switchyard-server-containerCopy head branch name to clipboard
Draft

ci: publish switchyard-server container from main#131
nachiketb-nvidia wants to merge 1 commit into
mainNVIDIA-NeMo/Switchyard:mainfrom
nachiketb/switchyard-server-containerNVIDIA-NeMo/Switchyard:nachiketb/switchyard-server-containerCopy head branch name to clipboard

Conversation

@nachiketb-nvidia

@nachiketb-nvidia nachiketb-nvidia commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

  • add a multi-stage Docker image for the Rust switchyard-server binary
  • publish ghcr.io/nvidia-nemo/switchyard-server:main and a seven-character commit tag on pushes to main
  • delete SHA-only package versions after 23 hours with an hourly cleanup job
  • document running the published image with a mounted TOML configuration

Why

switchyard-server can currently be built and run from Cargo, but it has no distributable server container. This adds a GitHub-only container path without introducing registry credentials or publishing from pull requests.

The main and commit tags are built as separate OCI manifests with shared filesystem layers. This lets retention delete the short-SHA version without deleting the moving main tag.

Review

  • the runtime image contains only the release binary and CA certificates and runs as a non-root user
  • publishing is triggered only by pushes to main
  • cleanup only selects versions whose sole tag is a seven-character hexadecimal SHA
  • the OCI source label links the GHCR package to this repository

Validation

  • built crates/switchyard-server/Dockerfile locally
  • ran the image and loaded a TOML config with --dry-run
  • verified the main and short-SHA builds have distinct image IDs
  • cargo test -p switchyard-server
  • cargo fmt --all --check
  • uv run ruff check .
  • workflow YAML parse and git diff --check

Summary by CodeRabbit

  • New Features

    • Added a Docker image for running the switchyard-server service.
    • Added automated publishing of server images to GitHub Container Registry.
    • Added scheduled cleanup of older commit-tagged images.
  • Documentation

    • Added instructions for running the server with Docker, including configuration, API key, and port setup.
  • Chores

    • Excluded build artifacts from Docker build contexts.

Signed-off-by: nachiketb <nachiketb@nvidia.com>
@nachiketb-nvidia
nachiketb-nvidia marked this pull request as ready for review July 23, 2026 22:20
@nachiketb-nvidia
nachiketb-nvidia requested a review from a team as a code owner July 23, 2026 22:20
@nachiketb-nvidia
nachiketb-nvidia marked this pull request as draft July 23, 2026 22:20
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Changes

Container Delivery

Layer / File(s) Summary
Container image build and runtime
.dockerignore, crates/switchyard-server/Dockerfile, crates/switchyard-server/README.md
The Docker build excludes target, compiles switchyard-server in a Rust builder stage, packages it in Debian slim, runs as user 65532:65532 on port 4000, and documents Docker execution.
Registry publishing and tag cleanup
.github/workflows/server-container.yml
A workflow publishes SHA and main image tags to GHCR on pushes and removes matching SHA tags older than 23 hours on schedule.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

I’m a rabbit with a container to pack,
Rust builds the server and sends it on track.
Tags hop to the registry, neat and bright,
Old SHA carrots vanish at night.
Port four-thousand welcomes the flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: publishing the switchyard-server container from main.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/server-container.yml:
- Line 26: Update the actions/checkout@v4 step to disable credential persistence
by setting persist-credentials to false, while leaving the existing direct
GITHUB_TOKEN usage for docker/login-action unchanged.
- Line 26: Update all referenced GitHub Actions in the
workflow—actions/checkout, docker/setup-buildx-action, docker/login-action, and
both docker/build-push-action entries—from mutable version tags to immutable
commit SHAs, preserving their current major-version behavior. Add or retain
Dependabot configuration so these SHA pins can be automatically updated.
- Around line 9-11: Remove the workflow-level permissions block and define
job-level permissions instead: grant publish both contents: read and packages:
write, while cleanup receives only packages: write. Keep these permissions
scoped to the respective jobs so other current or future jobs do not inherit
package-write access.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: da4755e4-0630-4b2c-b358-ce307cd5cd2e

📥 Commits

Reviewing files that changed from the base of the PR and between 7315625 and bba998f.

📒 Files selected for processing (4)
  • .dockerignore
  • .github/workflows/server-container.yml
  • crates/switchyard-server/Dockerfile
  • crates/switchyard-server/README.md

Comment on lines +9 to +11
permissions:
contents: read
packages: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Scope package-write permission to the individual jobs.

A workflow-level packages: write token is unnecessarily available to every current and future job. Remove the global permission block; grant contents: read and packages: write to publish, and only packages: write to cleanup.

Proposed permission scoping
-permissions:
-  contents: read
-  packages: write
-
 jobs:
   publish:
+    permissions:
+      contents: read
+      packages: write
     name: Publish container
...
   cleanup:
+    permissions:
+      packages: write
     name: Delete expired commit images
🧰 Tools
🪛 zizmor (1.26.1)

[error] 11-11: overly broad permissions (excessive-permissions): packages: write is overly broad at the workflow level

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/server-container.yml around lines 9 - 11, Remove the
workflow-level permissions block and define job-level permissions instead: grant
publish both contents: read and packages: write, while cleanup receives only
packages: write. Keep these permissions scoped to the respective jobs so other
current or future jobs do not inherit package-write access.

Source: Linters/SAST tools

if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Do not retain the registry-capable token in Git config.

actions/checkout persists its token by default; subsequent steps can read it from the workspace. This job already passes GITHUB_TOKEN directly to docker/login-action, so disable persistence.

Proposed fix
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@v4
+        with:
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 26-26: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/server-container.yml at line 26, Update the
actions/checkout@v4 step to disable credential persistence by setting
persist-credentials to false, while leaving the existing direct GITHUB_TOKEN
usage for docker/login-action unchanged.

Source: Linters/SAST tools


🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the workflow with line numbers, focusing on the cited region.
sed -n '1,140p' .github/workflows/server-container.yml | cat -n

# Also list all `uses:` references in the file for a quick inventory.
grep -nE '^\s*-\s*uses:|^\s*uses:' .github/workflows/server-container.yml || true

Repository: NVIDIA-NeMo/Switchyard

Length of output: 3903


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba .github/workflows/server-container.yml | sed -n '1,140p' | grep -nE 'uses:|name:|on:|jobs:|runs-on:'

Repository: NVIDIA-NeMo/Switchyard

Length of output: 196


Pin these GitHub Actions to commit SHAs. actions/checkout@v4, docker/setup-buildx-action@v3, docker/login-action@v3, and both docker/build-push-action@v6 uses are still mutable tags; pin them to immutable SHAs and let Dependabot update the pins.

🧰 Tools
🪛 zizmor (1.26.1)

[warning] 26-26: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/server-container.yml at line 26, Update all referenced
GitHub Actions in the workflow—actions/checkout, docker/setup-buildx-action,
docker/login-action, and both docker/build-push-action entries—from mutable
version tags to immutable commit SHAs, preserving their current major-version
behavior. Add or retain Dependabot configuration so these SHA pins can be
automatically updated.

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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.