ci: publish switchyard-server container from main#131
ci: publish switchyard-server container from main#131nachiketb-nvidia wants to merge 1 commit intomainNVIDIA-NeMo/Switchyard:mainfrom nachiketb/switchyard-server-containerNVIDIA-NeMo/Switchyard:nachiketb/switchyard-server-containerCopy head branch name to clipboard
Conversation
Signed-off-by: nachiketb <nachiketb@nvidia.com>
WalkthroughChangesContainer Delivery
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
.dockerignore.github/workflows/server-container.ymlcrates/switchyard-server/Dockerfilecrates/switchyard-server/README.md
| permissions: | ||
| contents: read | ||
| packages: write |
There was a problem hiding this comment.
🔒 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 |
There was a problem hiding this comment.
🔒 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.
| - 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 || trueRepository: 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.
What
switchyard-serverbinaryghcr.io/nvidia-nemo/switchyard-server:mainand a seven-character commit tag on pushes tomainWhy
switchyard-servercan 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
mainand commit tags are built as separate OCI manifests with shared filesystem layers. This lets retention delete the short-SHA version without deleting the movingmaintag.Review
mainValidation
crates/switchyard-server/Dockerfilelocally--dry-runmainand short-SHA builds have distinct image IDscargo test -p switchyard-servercargo fmt --all --checkuv run ruff check .git diff --checkSummary by CodeRabbit
New Features
switchyard-serverservice.Documentation
Chores