Skip to content

Commit 1b5496b

Browse files
disable tests (#111)
1 parent 2e68d82 commit 1b5496b

File tree

3 files changed

+97
-70
lines changed

3 files changed

+97
-70
lines changed

.changeset/clean-cows-tie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/sandbox": patch
3+
---
4+
5+
trigger a release

.github/workflows/release.yml

Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -64,77 +64,79 @@ jobs:
6464
run: npm run test -w @repo/sandbox-container
6565

6666
# E2E tests run in parallel with unit tests
67-
e2e-tests:
68-
if: ${{ github.repository_owner == 'cloudflare' }}
69-
runs-on: ubuntu-latest
70-
timeout-minutes: 30
71-
72-
steps:
73-
- uses: actions/checkout@v4
74-
75-
- uses: actions/setup-node@v4
76-
with:
77-
node-version: 24
78-
cache: "npm"
79-
80-
- uses: oven-sh/setup-bun@v2
81-
with:
82-
bun-version: latest
83-
84-
- name: Install dependencies
85-
run: npm ci
86-
87-
- name: Build packages
88-
run: npm run build
89-
90-
- name: Set worker name
91-
id: worker-name
92-
run: |
93-
# Use git SHA for unique, meaningful naming (not sequential run number)
94-
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
95-
echo "worker_name=sandbox-e2e-test-worker-release-${SHORT_SHA}" >> $GITHUB_OUTPUT
96-
97-
# Generate unique wrangler config for this release
98-
- name: Generate wrangler config
99-
run: |
100-
cd tests/e2e/test-worker
101-
./generate-config.sh ${{ steps.worker-name.outputs.worker_name }}
102-
103-
- name: Build test worker Docker image
104-
run: npm run docker:local -w @cloudflare/sandbox
105-
106-
- name: Deploy test worker
107-
uses: cloudflare/wrangler-action@v3
108-
with:
109-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
110-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
111-
command: deploy --name ${{ steps.worker-name.outputs.worker_name }}
112-
workingDirectory: tests/e2e/test-worker
113-
114-
- name: Get deployment URL
115-
id: get-url
116-
run: |
117-
echo "worker_url=https://${{ steps.worker-name.outputs.worker_name }}.agents-b8a.workers.dev" >> $GITHUB_OUTPUT
118-
119-
- name: Run E2E tests
120-
run: npx vitest run --config vitest.e2e.config.ts
121-
env:
122-
TEST_WORKER_URL: ${{ steps.get-url.outputs.worker_url }}
123-
CI: true
124-
125-
- name: Cleanup test deployment
126-
if: always()
127-
continue-on-error: true
128-
run: |
129-
cd tests/e2e/test-worker
130-
../../../scripts/cleanup-test-deployment.sh ${{ steps.worker-name.outputs.worker_name }}
131-
env:
132-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
133-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
67+
# e2e-tests:
68+
# if: ${{ github.repository_owner == 'cloudflare' }}
69+
# runs-on: ubuntu-latest
70+
# timeout-minutes: 30
71+
72+
# steps:
73+
# - uses: actions/checkout@v4
74+
75+
# - uses: actions/setup-node@v4
76+
# with:
77+
# node-version: 24
78+
# cache: "npm"
79+
80+
# - uses: oven-sh/setup-bun@v2
81+
# with:
82+
# bun-version: latest
83+
84+
# - name: Install dependencies
85+
# run: npm ci
86+
87+
# - name: Build packages
88+
# run: npm run build
89+
90+
# - name: Set worker name
91+
# id: worker-name
92+
# run: |
93+
# # Use git SHA for unique, meaningful naming (not sequential run number)
94+
# SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
95+
# echo "worker_name=sandbox-e2e-test-worker-release-${SHORT_SHA}" >> $GITHUB_OUTPUT
96+
97+
# # Generate unique wrangler config for this release
98+
# - name: Generate wrangler config
99+
# run: |
100+
# cd tests/e2e/test-worker
101+
# ./generate-config.sh ${{ steps.worker-name.outputs.worker_name }}
102+
103+
# - name: Build test worker Docker image
104+
# run: npm run docker:local -w @cloudflare/sandbox
105+
106+
# - name: Deploy test worker
107+
# uses: cloudflare/wrangler-action@v3
108+
# with:
109+
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
110+
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
111+
# command: deploy --name ${{ steps.worker-name.outputs.worker_name }}
112+
# workingDirectory: tests/e2e/test-worker
113+
114+
# - name: Get deployment URL
115+
# id: get-url
116+
# run: |
117+
# echo "worker_url=https://${{ steps.worker-name.outputs.worker_name }}.agents-b8a.workers.dev" >> $GITHUB_OUTPUT
118+
119+
# - name: Run E2E tests
120+
# run: npx vitest run --config vitest.e2e.config.ts
121+
# env:
122+
# TEST_WORKER_URL: ${{ steps.get-url.outputs.worker_url }}
123+
# CI: true
124+
125+
# - name: Cleanup test deployment
126+
# if: always()
127+
# continue-on-error: true
128+
# run: |
129+
# cd tests/e2e/test-worker
130+
# ../../../scripts/cleanup-test-deployment.sh ${{ steps.worker-name.outputs.worker_name }}
131+
# env:
132+
# CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
133+
# CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
134134

135135
# Prerelease publish - always runs after tests pass
136136
publish-prerelease:
137-
needs: [unit-tests, e2e-tests]
137+
needs: [unit-tests,
138+
# e2e-tests
139+
]
138140
if: ${{ github.repository_owner == 'cloudflare' }}
139141
runs-on: ubuntu-latest
140142
timeout-minutes: 20
@@ -232,4 +234,4 @@ jobs:
232234
env:
233235
GITHUB_TOKEN: ${{ secrets.SANDBOX_GITHUB_TOKEN }}
234236
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
235-
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
237+
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

packages/sandbox/src/sandbox.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ import {
2929
} from "./security";
3030
import { parseSSEStream } from "./sse-parser";
3131

32-
export function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string) {
32+
export function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string, options?: {
33+
baseUrl: string
34+
}) {
3335
const stub = getContainer(ns, id);
3436

3537
// Store the name on first access
3638
stub.setSandboxName?.(id);
3739

40+
if(options?.baseUrl) {
41+
stub.setBaseUrl(options.baseUrl);
42+
}
43+
3844
return stub;
3945
}
4046

@@ -45,6 +51,7 @@ export class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
4551
client: SandboxClient;
4652
private codeInterpreter: CodeInterpreter;
4753
private sandboxName: string | null = null;
54+
private baseUrl: string | null = null;
4855
private portTokens: Map<number, string> = new Map();
4956
private defaultSession: string | null = null;
5057
envVars: Record<string, string> = {};
@@ -98,6 +105,19 @@ export class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
98105
}
99106
}
100107

108+
// RPC method to set the base URL
109+
async setBaseUrl(baseUrl: string): Promise<void> {
110+
if (!this.baseUrl) {
111+
this.baseUrl = baseUrl;
112+
await this.ctx.storage.put('baseUrl', baseUrl);
113+
console.log(`[Sandbox] Stored base URL: ${baseUrl}`);
114+
} else {
115+
if(this.baseUrl !== baseUrl) {
116+
throw new Error('Base URL already set and different from one previously provided');
117+
}
118+
}
119+
}
120+
101121
// RPC method to set environment variables
102122
async setEnvVars(envVars: Record<string, string>): Promise<void> {
103123
// Update local state for new sessions

0 commit comments

Comments
 (0)