-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: merge sandbox image helpers and de-dup integration CI #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Setup OpenShell | ||
| description: Install the pinned OpenShell CLI and wait for the gateway to become ready. | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Install openshell | ||
| # Version is pinned in .openshell-version (the single source of truth, | ||
| # also read by `make openshell`). The install script otherwise | ||
| # grabs the latest tagged release, which can drift past the chart's | ||
| # supervisor image and break the sandbox ssh/tar relay with | ||
| # "supervisor session not found". | ||
| shell: bash | ||
| run: | | ||
| ver="$(cat .openshell-version)" | ||
| test -n "$ver" || { echo "error: .openshell-version is empty"; exit 1; } | ||
| tmp="$(mktemp)" | ||
| curl -fLsS https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh -o "$tmp" | ||
| OPENSHELL_VERSION="$ver" sh "$tmp" | ||
|
|
||
| - name: Wait for gateway | ||
| shell: bash | ||
| run: | | ||
| ready=false | ||
| for _ in $(seq 1 30); do | ||
| if openshell inference get &>/dev/null; then | ||
| ready=true | ||
| break | ||
| fi | ||
| sleep 1 | ||
| done | ||
| if [[ "$ready" != true ]]; then | ||
| openshell gateway list || true | ||
| echo "OpenShell gateway did not become ready" >&2 | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
| ) | ||
|
|
||
| // Version is the build version, set at link time and used to tag versioned | ||
| // sandbox images. | ||
| var Version = "dev" | ||
|
|
||
| // resolveSandboxImagePath resolves a relative Dockerfile directory against | ||
| // harnessDir. An image ref (or an already-absolute path) is returned unchanged. | ||
| func resolveSandboxImagePath(image, harnessDir string) string { | ||
| if image == "" || filepath.IsAbs(image) { | ||
| return image | ||
| } | ||
| candidate := filepath.Join(harnessDir, image) | ||
| if info, err := os.Stat(candidate); err == nil && info.IsDir() { | ||
| return candidate | ||
| } | ||
| return image | ||
| } | ||
|
|
||
| func resolveSandboxImage(agentImage string) string { | ||
| if envImage := os.Getenv("HARNESS_OS_IMAGE"); envImage != "" { | ||
| return envImage | ||
| } | ||
| if agentImage != "" { | ||
| return agentImage | ||
| } | ||
| return versionedImage("sandbox") | ||
| } | ||
|
|
||
| func versionedImage(name string) string { | ||
| base := "quay.io/rcochran/openshell" | ||
| if Version == "" || Version == "dev" { | ||
| return base + ":" + name | ||
| } | ||
| return base + ":" + name + "-" + Version | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: stackrox/harness-openshell
Length of output: 31227
🏁 Script executed:
Repository: stackrox/harness-openshell
Length of output: 13035
🤖 get_repo_knowledge executed:
get_repo_knowledge stackrox/harness-openshell /tmp/coderabbit-repo-knowledge/stackrox-harness-openshell-26b5f74d/conventionsLength of output: 4513
🏁 Script executed:
Repository: stackrox/harness-openshell
Length of output: 2966
Validate
Versionbefore constructing the image tag.Makefileand.github/workflows/images.ymlderiveVersionfromgit describe --tags --alwaysand use it directly insandbox-$(VERSION). A tag such asrelease/fooproduces an invalid image tag and can break image builds or default image pulls. RestrictVersionto valid image-tag characters and length, or normalize it before constructing the reference.🤖 Prompt for AI Agents