-
Notifications
You must be signed in to change notification settings - Fork 17
feat(runtime): support Windows OpenSandbox guests #148
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
Draft
zpzjzj
wants to merge
6
commits into
main
Choose a base branch
from
feat/opensandbox-windows-guest
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fa95273
feat(config): add opensandbox platform and resource settings
zpzjzj 5f9e129
refactor(runtime): use official opensandbox create path
zpzjzj eab317e
feat(runtime): support windows opensandbox guests
zpzjzj e55dae3
fix(ci): isolate Windows OpenSandbox server port
zpzjzj fb6effd
chore: resolving merge conflicts with main
Copilot 14efc56
fix(ci): resolve merge conflict in extended-ci.yml with main
Copilot 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 |
|---|---|---|
|
|
@@ -5,6 +5,12 @@ name: Extended CI | |
| on: | ||
| merge_group: | ||
| workflow_dispatch: | ||
| inputs: | ||
| windows_guest: | ||
| description: Run the real OpenSandbox Windows guest lifecycle test | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
@@ -48,6 +54,109 @@ jobs: | |
| if-no-files-found: ignore | ||
| retention-days: 14 | ||
|
|
||
| e2e-opensandbox-windows: | ||
| name: E2E (OpenSandbox Windows guest) | ||
| if: github.event_name == 'workflow_dispatch' && inputs.windows_guest | ||
| runs-on: self-hosted | ||
| timeout-minutes: 35 | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - name: Check Windows guest prerequisites | ||
| id: prerequisites | ||
| run: | | ||
| available=true | ||
| for device in /dev/kvm /dev/net/tun; do | ||
| if [ ! -r "$device" ] || [ ! -w "$device" ]; then | ||
| echo "::notice::Skipping Windows guest e2e: $device is unavailable or not readable/writable." | ||
| available=false | ||
| fi | ||
| done | ||
| if ! docker info >/dev/null 2>&1; then | ||
| echo "::notice::Skipping Windows guest e2e: Docker is unavailable." | ||
| available=false | ||
| fi | ||
| echo "available=$available" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6 | ||
| if: steps.prerequisites.outputs.available == 'true' | ||
| with: | ||
| go-version: "1.25.x" | ||
| cache: true | ||
|
|
||
| - name: Install uv | ||
| if: steps.prerequisites.outputs.available == 'true' | ||
| uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 | ||
|
|
||
| - name: Install OpenSandbox server with Windows profile | ||
| if: steps.prerequisites.outputs.available == 'true' | ||
| run: | | ||
| uv tool install 'opensandbox-server==0.2.1' | ||
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Start OpenSandbox server | ||
| if: steps.prerequisites.outputs.available == 'true' | ||
| run: | | ||
| api_key="ci-$(openssl rand -hex 16)" | ||
| config="$RUNNER_TEMP/sandbox-windows.toml" | ||
| cat > "$config" <<EOF | ||
| [server] | ||
| host = "127.0.0.1" | ||
| port = 8081 | ||
| api_key = "$api_key" | ||
|
|
||
| [runtime] | ||
| type = "docker" | ||
| execd_image = "opensandbox/execd:v1.0.21" | ||
|
|
||
| [docker] | ||
| network_mode = "host" | ||
| EOF | ||
| log="$RUNNER_TEMP/opensandbox-windows-server.log" | ||
| nohup opensandbox-server --config "$config" > "$log" 2>&1 & | ||
| echo $! > "$RUNNER_TEMP/opensandbox-windows-server.pid" | ||
| for i in $(seq 1 60); do | ||
| if curl -fsS http://127.0.0.1:8081/health 2>/dev/null | grep -q healthy; then | ||
| break | ||
| fi | ||
| if [ "$i" -eq 60 ]; then | ||
| echo "::error::OpenSandbox server did not become healthy within 120s" | ||
| cat "$log" | ||
| exit 1 | ||
| fi | ||
| sleep 2 | ||
| done | ||
| { | ||
| echo "OPENSANDBOX_API_KEY=$api_key" | ||
| echo "OPENSANDBOX_BASE_URL=http://127.0.0.1:8081" | ||
| echo "OPENSANDBOX_WINDOWS_IMAGE=dockurr/windows:latest" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Please pin the Windows image by digest rather than using |
||
| } >> "$GITHUB_ENV" | ||
|
|
||
| - name: Run real Windows guest lifecycle test | ||
| if: steps.prerequisites.outputs.available == 'true' | ||
| run: go test -tags e2e -timeout 1800s -count=1 -v -run TestCustomEngine_OpenSandboxWindowsGuest ./e2e | ||
| env: | ||
| SKILL_UP_WINDOWS_GUEST_E2E: "1" | ||
| SKILL_UP_E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-opensandbox-windows-artifacts | ||
|
|
||
| - name: Upload Windows guest diagnostics | ||
| if: always() && steps.prerequisites.outputs.available == 'true' | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: opensandbox-windows-guest | ||
| path: | | ||
| ${{ runner.temp }}/opensandbox-windows-server.log | ||
| e2e-opensandbox-windows-artifacts/ | ||
| if-no-files-found: ignore | ||
| retention-days: 14 | ||
|
|
||
| - name: Stop OpenSandbox server | ||
| if: always() && steps.prerequisites.outputs.available == 'true' | ||
| run: | | ||
| if [ -f "$RUNNER_TEMP/opensandbox-windows-server.pid" ]; then | ||
| kill "$(cat "$RUNNER_TEMP/opensandbox-windows-server.pid")" 2>/dev/null || true | ||
| fi | ||
|
|
||
| e2e-docker: | ||
| name: E2E (docker runtime) | ||
| runs-on: [self-hosted, linux, x64, docker, trusted] | ||
|
|
||
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
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
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
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.
[P1] Please scope this to a dedicated trusted KVM-capable runner instead of the generic
self-hostedpool. This job checks out and executes the selected ref, installs packages, starts Docker with host networking, and accesses/dev/kvmand/dev/net/tun; scheduling it on any self-hosted runner unnecessarily broadens the blast radius. Labels such as[self-hosted, linux, x64, docker, trusted, kvm]would also prevent the core test from silently landing on an incapable runner.