From c8e2a59ba969f66c44b6bb96e67b712b821a9d1b Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 12:15:18 +0200 Subject: [PATCH 01/54] added GitHub workflows --- .github/workflows/build_template.yml | 61 ++++++++++++++++++++++++++++ .github/workflows/js_tests.yml | 5 +++ .github/workflows/pull_request.yml | 10 +++++ .github/workflows/python_tests.yml | 1 + 4 files changed, 77 insertions(+) create mode 100644 .github/workflows/build_template.yml diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml new file mode 100644 index 00000000..26225828 --- /dev/null +++ b/.github/workflows/build_template.yml @@ -0,0 +1,61 @@ +name: Build Template + +on: + workflow_call: + secrets: + E2B_API_KEY: + required: true + E2B_DOMAIN: + required: true + +permissions: + contents: read + +jobs: + build-docker-image: + name: Build Docker Image + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Set package version + working-directory: ./template + run: | + VERSION=$(cat ../chart_data_extractor/pyproject.toml | grep version | cut -d '"' -f 2) + echo "Version: $VERSION" + sed -i "s/e2b_charts/e2b_charts==${VERSION}/g" requirements.txt + + - name: Build Docker image + uses: docker/build-push-action@v6 + with: + context: ./template + push: false + platforms: linux/amd64 + tags: ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest + + build-template: + name: Build E2B template + runs-on: ubuntu-latest + needs: [build-docker-image] + if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install E2B CLI + run: npm install -g @e2b/cli + + - name: Build e2b + run: e2b template build + working-directory: ./template + env: + E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} \ No newline at end of file diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index f791115a..ae76b831 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -5,6 +5,8 @@ on: secrets: E2B_API_KEY: required: true + E2B_DOMAIN: + required: true permissions: contents: read @@ -49,6 +51,7 @@ jobs: run: pnpm test env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - name: Install Bun uses: oven-sh/setup-bun@v2 @@ -59,6 +62,7 @@ jobs: run: pnpm test:bun env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - name: Install Deno uses: denoland/setup-deno@v1 @@ -69,3 +73,4 @@ jobs: run: pnpm test:deno env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 78b42016..6058b816 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -14,13 +14,23 @@ on: - main jobs: + build-template: + uses: ./.github/workflows/build_template.yml + secrets: + E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} js-sdk: uses: ./.github/workflows/js_tests.yml secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} python-sdk: uses: ./.github/workflows/python_tests.yml secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} charts-tests: uses: ./.github/workflows/charts_tests.yml + secrets: + E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 5bb46fea..aa5162dc 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -43,3 +43,4 @@ jobs: run: poetry run pytest --verbose -x env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} From 9841d005c3a0b8e3768dd62ce172455557af1f89 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:26:35 +0200 Subject: [PATCH 02/54] added test toml template --- .github/workflows/build_template.yml | 4 ++-- template/e2b.test.toml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 template/e2b.test.toml diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 26225828..fcb9370d 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -53,8 +53,8 @@ jobs: - name: Install E2B CLI run: npm install -g @e2b/cli - - name: Build e2b - run: e2b template build + - name: Build E2B template + run: e2b template build --config e2b.test.toml working-directory: ./template env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} diff --git a/template/e2b.test.toml b/template/e2b.test.toml new file mode 100644 index 00000000..913ab3b5 --- /dev/null +++ b/template/e2b.test.toml @@ -0,0 +1,18 @@ +# This is a config for E2B sandbox template. +# You can use template ID (nlhz8vlwyupq845jsdg9) or template name (code-interpreter-v1) to create a sandbox: + +# Python SDK +# from e2b import Sandbox, AsyncSandbox +# sandbox = Sandbox("code-interpreter-v1") # Sync sandbox +# sandbox = await AsyncSandbox.create("code-interpreter-v1") # Async sandbox + +# JS SDK +# import { Sandbox } from 'e2b' +# const sandbox = await Sandbox.create('code-interpreter-v1') + +team_id = "460355b3-4f64-48f9-9a16-4442817f79f5" +memory_mb = 1_024 +start_cmd = "/root/.jupyter/start-up.sh" +dockerfile = "e2b.Dockerfile" +template_name = "code-interpreter-test" +template_id = "nlhz8vlwyupq845jsdg9" From 432cfd9392c46ca3e686eb431a50a56cbb449907 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:46:35 +0200 Subject: [PATCH 03/54] changed tests to use test template in CI --- .github/workflows/build_template.yml | 9 ++++++--- .github/workflows/js_tests.yml | 4 +++- .github/workflows/pull_request.yml | 4 ++++ .github/workflows/python_tests.yml | 4 ++++ js/tests/setup.ts | 6 +++++- python/tests/conftest.py | 12 ++++++++---- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index fcb9370d..2ee895cc 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -6,7 +6,9 @@ on: E2B_API_KEY: required: true E2B_DOMAIN: - required: true + required: false + E2B_TEMPLATE_CONFIG: + required: false permissions: contents: read @@ -54,8 +56,9 @@ jobs: run: npm install -g @e2b/cli - name: Build E2B template - run: e2b template build --config e2b.test.toml + run: e2b template build --config ${{ secrets.E2B_TEMPLATE_CONFIG }} working-directory: ./template env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} \ No newline at end of file + E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }} \ No newline at end of file diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index ae76b831..b57f1aab 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -6,7 +6,9 @@ on: E2B_API_KEY: required: true E2B_DOMAIN: - required: true + required: false + E2B_TEMPLATE_CONFIG: + required: false permissions: contents: read diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6058b816..6dae1c7d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -19,6 +19,8 @@ jobs: secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} + E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }} js-sdk: uses: ./.github/workflows/js_tests.yml secrets: @@ -29,8 +31,10 @@ jobs: secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} charts-tests: uses: ./.github/workflows/charts_tests.yml secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index aa5162dc..7082f993 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -5,6 +5,10 @@ on: secrets: E2B_API_KEY: required: true + E2B_DOMAIN: + required: false + E2B_TEMPLATE_CONFIG: + required: false permissions: contents: read diff --git a/js/tests/setup.ts b/js/tests/setup.ts index b4466365..95ec712f 100644 --- a/js/tests/setup.ts +++ b/js/tests/setup.ts @@ -3,6 +3,8 @@ import { test as base } from 'vitest' const timeoutMs = 60_000 +const template = process.env.E2B_TEMPLATE || 'code-interpreter-v1' + interface SandboxFixture { sandbox: Sandbox } @@ -10,7 +12,9 @@ interface SandboxFixture { export const sandboxTest = base.extend({ sandbox: [ async ({}, use) => { - const sandbox = await Sandbox.create({ timeoutMs }) + const sandbox = await Sandbox.create(template, { + timeoutMs, + }) try { await use(sandbox) } finally { diff --git a/python/tests/conftest.py b/python/tests/conftest.py index efb6c1d7..aa36686c 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -9,10 +9,14 @@ timeout = 60 +@pytest.fixture() +def template(): + return os.getenv("E2B_TEMPLATE", "code-interpreter-v1") + @pytest.fixture() -def sandbox(debug): - sandbox = Sandbox(timeout=timeout) +def sandbox(template, debug): + sandbox = Sandbox(template, timeout=timeout) try: yield sandbox @@ -27,8 +31,8 @@ def sandbox(debug): @pytest_asyncio.fixture -async def async_sandbox(debug): - sandbox = await AsyncSandbox.create(timeout=timeout) +async def async_sandbox(template, debug): + sandbox = await AsyncSandbox.create(template, timeout=timeout) try: yield sandbox From 251ed0f32191d3b6a06695e6d917b88e0a5c3ebd Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:48:46 +0200 Subject: [PATCH 04/54] js sdk and python sdk to wait on template --- .github/workflows/pull_request.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6dae1c7d..78d0a40f 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,11 +23,13 @@ jobs: E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }} js-sdk: uses: ./.github/workflows/js_tests.yml + needs: build-template secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} python-sdk: uses: ./.github/workflows/python_tests.yml + needs: build-template secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} From 7f9394ad0f56c445b4d59a070b355e24946aa1a1 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:54:15 +0200 Subject: [PATCH 05/54] ensured some env variables in yaml --- .github/workflows/js_tests.yml | 5 ++++- .github/workflows/pull_request.yml | 1 + .github/workflows/python_tests.yml | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index b57f1aab..cdc430d9 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -7,7 +7,7 @@ on: required: true E2B_DOMAIN: required: false - E2B_TEMPLATE_CONFIG: + E2B_TEMPLATE: required: false permissions: @@ -54,6 +54,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} - name: Install Bun uses: oven-sh/setup-bun@v2 @@ -65,6 +66,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} - name: Install Deno uses: denoland/setup-deno@v1 @@ -76,3 +78,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 78d0a40f..2df7d456 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -27,6 +27,7 @@ jobs: secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} python-sdk: uses: ./.github/workflows/python_tests.yml needs: build-template diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 7082f993..eccdbf4a 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -7,7 +7,7 @@ on: required: true E2B_DOMAIN: required: false - E2B_TEMPLATE_CONFIG: + E2B_TEMPLATE: required: false permissions: @@ -48,3 +48,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} \ No newline at end of file From c0a626ddeab47fdea2aeb74369a844e79ba95699 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:57:14 +0200 Subject: [PATCH 06/54] added ifs to JS/Python test jobs --- .github/workflows/pull_request.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 2df7d456..431a85ae 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -24,6 +24,7 @@ jobs: js-sdk: uses: ./.github/workflows/js_tests.yml needs: build-template + if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} @@ -31,6 +32,7 @@ jobs: python-sdk: uses: ./.github/workflows/python_tests.yml needs: build-template + if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} From 926634141f0b9807c05eb28ad83a7579e845b200 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:13:33 +0200 Subject: [PATCH 07/54] split secrets and envs --- .github/workflows/js_tests.yml | 9 +++++---- .github/workflows/pull_request.yml | 15 +++++++-------- .github/workflows/python_tests.yml | 5 +++-- js/tests/setup.ts | 2 +- python/tests/conftest.py | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index cdc430d9..f56827c5 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -5,9 +5,10 @@ on: secrets: E2B_API_KEY: required: true + inputs: E2B_DOMAIN: required: false - E2B_TEMPLATE: + E2B_CI_TEMPLATE: required: false permissions: @@ -54,7 +55,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} - name: Install Bun uses: oven-sh/setup-bun@v2 @@ -66,7 +67,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} - name: Install Deno uses: denoland/setup-deno@v1 @@ -78,4 +79,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} \ No newline at end of file + E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 431a85ae..c8fcfa43 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,28 +18,27 @@ jobs: uses: ./.github/workflows/build_template.yml secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + inputs: E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} - E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }} + E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} + E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} js-sdk: uses: ./.github/workflows/js_tests.yml needs: build-template if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + inputs: E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} python-sdk: uses: ./.github/workflows/python_tests.yml needs: build-template if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + inputs: E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} charts-tests: uses: ./.github/workflows/charts_tests.yml - secrets: - E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index eccdbf4a..d534bf91 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -5,9 +5,10 @@ on: secrets: E2B_API_KEY: required: true + inputs: E2B_DOMAIN: required: false - E2B_TEMPLATE: + E2B_CI_TEMPLATE: required: false permissions: @@ -48,4 +49,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }} \ No newline at end of file + E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} \ No newline at end of file diff --git a/js/tests/setup.ts b/js/tests/setup.ts index 95ec712f..cdaf1ad4 100644 --- a/js/tests/setup.ts +++ b/js/tests/setup.ts @@ -3,7 +3,7 @@ import { test as base } from 'vitest' const timeoutMs = 60_000 -const template = process.env.E2B_TEMPLATE || 'code-interpreter-v1' +const template = process.env.E2B_CI_TEMPLATE || 'code-interpreter-v1' interface SandboxFixture { sandbox: Sandbox diff --git a/python/tests/conftest.py b/python/tests/conftest.py index aa36686c..7ee4ed25 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -11,7 +11,7 @@ @pytest.fixture() def template(): - return os.getenv("E2B_TEMPLATE", "code-interpreter-v1") + return os.getenv("E2B_CI_TEMPLATE", "code-interpreter-v1") @pytest.fixture() From efba8aa7e47b116777b340b8cb6c6d837d3045c2 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:16:42 +0200 Subject: [PATCH 08/54] updated checkout github action --- .github/workflows/build_template.yml | 4 ++-- .github/workflows/charts_tests.yml | 2 +- .github/workflows/js_tests.yml | 2 +- .github/workflows/python_tests.yml | 2 +- .github/workflows/release.yml | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 2ee895cc..634f993b 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -48,7 +48,7 @@ jobs: if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/charts_tests.yml b/.github/workflows/charts_tests.yml index 985e7d99..6cbc59e1 100644 --- a/.github/workflows/charts_tests.yml +++ b/.github/workflows/charts_tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index f56827c5..d284660f 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v3 diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index d534bf91..0055266a 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 523f8531..0b29461c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: release: ${{ steps.version.outputs.release }} steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v3 @@ -60,7 +60,7 @@ jobs: template: ${{ steps.template.outputs.release }} steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v3 @@ -117,7 +117,7 @@ jobs: version: ${{ steps.output_version.outputs.version }} steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v3 @@ -177,7 +177,7 @@ jobs: (needs.changes.outputs.template == 'true' || needs.changes.outputs.charts == 'true') steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -220,7 +220,7 @@ jobs: (needs.changes.outputs.template == 'true' || needs.changes.outputs.charts == 'true') steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install E2B CLI @@ -268,7 +268,7 @@ jobs: private-key: ${{ secrets.VERSION_BUMPER_SECRET }} - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ steps.app-token.outputs.token }} From ea59c6a8e782cf1a5050771a01336739f07deb8c Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:17:25 +0200 Subject: [PATCH 09/54] removed fetch-depth as this is default --- .github/workflows/build_template.yml | 4 ---- .github/workflows/release.yml | 5 ----- 2 files changed, 9 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 634f993b..9e305b5b 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -20,8 +20,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -49,8 +47,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Install E2B CLI run: npm install -g @e2b/cli diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b29461c..8ee6313b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -178,8 +178,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -221,8 +219,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Install E2B CLI run: npm install -g @e2b/cli @@ -270,7 +266,6 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 with: - fetch-depth: 0 token: ${{ steps.app-token.outputs.token }} From 2acdbe3f8c3c8b4dd3f7f39ef0edf5d866541d28 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:20:08 +0200 Subject: [PATCH 10/54] changed inputs > with --- .github/workflows/pull_request.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c8fcfa43..0479da22 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,7 +18,7 @@ jobs: uses: ./.github/workflows/build_template.yml secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - inputs: + with: E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} @@ -28,7 +28,7 @@ jobs: if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - inputs: + with: E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} python-sdk: @@ -37,7 +37,7 @@ jobs: if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - inputs: + with: E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} charts-tests: From 5622371ac5df3eeca7360fd69647e1df266340b1 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:21:28 +0200 Subject: [PATCH 11/54] fixed unrecognized named value secrets --- .github/workflows/pull_request.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 0479da22..475d4fad 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -19,7 +19,7 @@ jobs: secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} js-sdk: @@ -29,7 +29,7 @@ jobs: secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} python-sdk: uses: ./.github/workflows/python_tests.yml @@ -38,7 +38,7 @@ jobs: secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} charts-tests: uses: ./.github/workflows/charts_tests.yml From 786b17f34d660d53b5c4897669ca8ec433c469a0 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:23:48 +0200 Subject: [PATCH 12/54] removed unused E2B_CI_TEMPLATE from build_template.yml workflow --- .github/workflows/pull_request.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 475d4fad..239c8c26 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,9 +18,7 @@ jobs: uses: ./.github/workflows/build_template.yml secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} js-sdk: uses: ./.github/workflows/js_tests.yml From 31669b09415659968a9dacfb5a04c2b96caf1299 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:26:53 +0200 Subject: [PATCH 13/54] added inputs types --- .github/workflows/js_tests.yml | 2 ++ .github/workflows/python_tests.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index d284660f..878b53c8 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -8,8 +8,10 @@ on: inputs: E2B_DOMAIN: required: false + type: string E2B_CI_TEMPLATE: required: false + type: string permissions: contents: read diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 0055266a..04d48ce6 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -8,8 +8,10 @@ on: inputs: E2B_DOMAIN: required: false + type: string E2B_CI_TEMPLATE: required: false + type: string permissions: contents: read From aef65ab8631561d3b37fe32aaa64e8c2316902dc Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:33:13 +0200 Subject: [PATCH 14/54] updated build-template workflow --- .github/workflows/build_template.yml | 11 +++++++++-- .github/workflows/pull_request.yml | 2 ++ .github/workflows/python_tests.yml | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 9e305b5b..b0502a45 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -5,10 +5,17 @@ on: secrets: E2B_API_KEY: required: true + E2B_ACCESS_TOKEN: + required: true + DOCKERHUB_USERNAME: + required: true + inputs: E2B_DOMAIN: required: false + type: string E2B_TEMPLATE_CONFIG: - required: false + required: true + type: string permissions: contents: read @@ -56,5 +63,5 @@ jobs: working-directory: ./template env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 239c8c26..c6bf66ef 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,6 +18,8 @@ jobs: uses: ./.github/workflows/build_template.yml secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} js-sdk: diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 04d48ce6..e13441d6 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -50,5 +50,5 @@ jobs: run: poetry run pytest --verbose -x env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} \ No newline at end of file From 2d5555f00952586082f4105219304370acb84f00 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:35:02 +0200 Subject: [PATCH 15/54] added E2B_ACCESS_TOKEN to pull_request.yml --- .github/workflows/pull_request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c6bf66ef..a3b4e86e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -19,6 +19,7 @@ jobs: secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} From 914397728a8243c83f8726c033ad63f20ff2c030 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:41:14 +0200 Subject: [PATCH 16/54] fixes option '--config ' argument missing on CI --- .github/workflows/build_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index b0502a45..4b90bb9a 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -64,4 +64,4 @@ jobs: env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }} \ No newline at end of file + E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} \ No newline at end of file From e229b07da83e352ba5cd6fc6433afa395d597151 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:45:02 +0200 Subject: [PATCH 17/54] combine CI build tasks into separate steps --- .github/workflows/build_template.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 4b90bb9a..4e32097e 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -21,8 +21,8 @@ permissions: contents: read jobs: - build-docker-image: - name: Build Docker Image + build: + name: Build Docker Image and Template runs-on: ubuntu-latest steps: - name: Checkout repository @@ -46,15 +46,6 @@ jobs: platforms: linux/amd64 tags: ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest - build-template: - name: Build E2B template - runs-on: ubuntu-latest - needs: [build-docker-image] - if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install E2B CLI run: npm install -g @e2b/cli From 6f725012769ce1d6f3f756c3f4edffbce4ce18fb Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:53:51 +0200 Subject: [PATCH 18/54] vars > inputs in CI workflows --- .github/workflows/build_template.yml | 5 ++--- .github/workflows/js_tests.yml | 6 +++--- .github/workflows/python_tests.yml | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 4e32097e..14a8ba76 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -50,9 +50,8 @@ jobs: run: npm install -g @e2b/cli - name: Build E2B template - run: e2b template build --config ${{ secrets.E2B_TEMPLATE_CONFIG }} + run: e2b template build --config ${{ inputs.E2B_TEMPLATE_CONFIG }} working-directory: ./template env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} - E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} \ No newline at end of file + E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index 878b53c8..c148a0ad 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -57,7 +57,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} - name: Install Bun uses: oven-sh/setup-bun@v2 @@ -69,7 +69,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} - name: Install Deno uses: denoland/setup-deno@v1 @@ -81,4 +81,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} \ No newline at end of file + E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index e13441d6..972e452a 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -50,5 +50,5 @@ jobs: run: poetry run pytest --verbose -x env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} \ No newline at end of file + E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} + E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} \ No newline at end of file From 444228812b6000aeff895e186dd691410bd6c01b Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:01:49 +0200 Subject: [PATCH 19/54] changed default test tempate name --- template/e2b.test.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/e2b.test.toml b/template/e2b.test.toml index 913ab3b5..c86ffc60 100644 --- a/template/e2b.test.toml +++ b/template/e2b.test.toml @@ -14,5 +14,5 @@ team_id = "460355b3-4f64-48f9-9a16-4442817f79f5" memory_mb = 1_024 start_cmd = "/root/.jupyter/start-up.sh" dockerfile = "e2b.Dockerfile" -template_name = "code-interpreter-test" +template_name = "code-interpreter-cicd-test" template_id = "nlhz8vlwyupq845jsdg9" From 58c3520ba546b5f54c81282a5e139616a95be0ad Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:24:44 +0200 Subject: [PATCH 20/54] dynamic template id for each build --- .github/workflows/build_template.yml | 10 +++++++++- .github/workflows/pull_request.yml | 4 ++-- template/e2b.test.toml | 18 ------------------ 3 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 template/e2b.test.toml diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 14a8ba76..01544201 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -50,8 +50,16 @@ jobs: run: npm install -g @e2b/cli - name: Build E2B template - run: e2b template build --config ${{ inputs.E2B_TEMPLATE_CONFIG }} + id: build-template + run: | + OUTPUT=$(e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile") + echo "build_output=$OUTPUT" >> $GITHUB_OUTPUT + TEMPLATE_ID=$(echo "$OUTPUT" | grep -o '✅ Building sandbox template [a-z0-9]*' | cut -d' ' -f5) + echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} + + - name: Output template ID + run: echo "Template ID: ${{ steps.build-template.outputs.template_id }}" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a3b4e86e..f7fa158d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -31,7 +31,7 @@ jobs: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} python-sdk: uses: ./.github/workflows/python_tests.yml needs: build-template @@ -40,6 +40,6 @@ jobs: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ vars.E2B_CI_TEMPLATE }} + E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} charts-tests: uses: ./.github/workflows/charts_tests.yml diff --git a/template/e2b.test.toml b/template/e2b.test.toml deleted file mode 100644 index c86ffc60..00000000 --- a/template/e2b.test.toml +++ /dev/null @@ -1,18 +0,0 @@ -# This is a config for E2B sandbox template. -# You can use template ID (nlhz8vlwyupq845jsdg9) or template name (code-interpreter-v1) to create a sandbox: - -# Python SDK -# from e2b import Sandbox, AsyncSandbox -# sandbox = Sandbox("code-interpreter-v1") # Sync sandbox -# sandbox = await AsyncSandbox.create("code-interpreter-v1") # Async sandbox - -# JS SDK -# import { Sandbox } from 'e2b' -# const sandbox = await Sandbox.create('code-interpreter-v1') - -team_id = "460355b3-4f64-48f9-9a16-4442817f79f5" -memory_mb = 1_024 -start_cmd = "/root/.jupyter/start-up.sh" -dockerfile = "e2b.Dockerfile" -template_name = "code-interpreter-cicd-test" -template_id = "nlhz8vlwyupq845jsdg9" From 3156d905a5f14845be3ceb28d36d0fad646fa23f Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:26:10 +0200 Subject: [PATCH 21/54] fixes syntax error in build_template.yml --- .github/workflows/build_template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 01544201..e1f02d9a 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -62,4 +62,5 @@ jobs: E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} - name: Output template ID - run: echo "Template ID: ${{ steps.build-template.outputs.template_id }}" + run: | + echo "Template ID: ${{ steps.build-template.outputs.template_id }}" From ed6485e38f58a5ce9d3c183cdd300a298c5d9ec1 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:38:58 +0200 Subject: [PATCH 22/54] remove e2b.toml on CI to be able to override the template --- .github/workflows/build_template.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index e1f02d9a..f3b9ba6c 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -49,6 +49,9 @@ jobs: - name: Install E2B CLI run: npm install -g @e2b/cli + - name: Remove existing e2b.toml + run: rm -f e2b.toml + - name: Build E2B template id: build-template run: | From 407d2f4a990406dc7c54a97fa21582fc20efc710 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:42:00 +0200 Subject: [PATCH 23/54] changed working dir for removing e2b template --- .github/workflows/build_template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index f3b9ba6c..3126d23b 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -50,7 +50,8 @@ jobs: run: npm install -g @e2b/cli - name: Remove existing e2b.toml - run: rm -f e2b.toml + working-directory: ./template + run: rm ./e2b.toml - name: Build E2B template id: build-template From 138a6abe3b6700b89ab9eadd40ab4f9808128784 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:31:49 +0200 Subject: [PATCH 24/54] redirect stderr in e2b template build ci correctly --- .github/workflows/build_template.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 3126d23b..a6de2b8b 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -49,16 +49,12 @@ jobs: - name: Install E2B CLI run: npm install -g @e2b/cli - - name: Remove existing e2b.toml - working-directory: ./template - run: rm ./e2b.toml - - name: Build E2B template id: build-template run: | - OUTPUT=$(e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile") - echo "build_output=$OUTPUT" >> $GITHUB_OUTPUT - TEMPLATE_ID=$(echo "$OUTPUT" | grep -o '✅ Building sandbox template [a-z0-9]*' | cut -d' ' -f5) + rm -f e2b.toml && e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" 2>&1 | tee build_output.txt + echo "build_output=$(cat build_output.txt)" >> $GITHUB_OUTPUT + TEMPLATE_ID=$(cat build_output.txt | grep -o 'Requested build for the sandbox template [a-z0-9]*' | cut -d' ' -f6) echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template env: From bf5f38e6d95553b2057d6ea644c935fc461d2a32 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:40:20 +0200 Subject: [PATCH 25/54] removed unnecessary std redirect in build --- .github/workflows/build_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index a6de2b8b..8ff9d641 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -52,7 +52,7 @@ jobs: - name: Build E2B template id: build-template run: | - rm -f e2b.toml && e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" 2>&1 | tee build_output.txt + rm -f e2b.toml && e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt echo "build_output=$(cat build_output.txt)" >> $GITHUB_OUTPUT TEMPLATE_ID=$(cat build_output.txt | grep -o 'Requested build for the sandbox template [a-z0-9]*' | cut -d' ' -f6) echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT From a604958b3fd5781d434d2819d598cfb71d6006b4 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:56:14 +0200 Subject: [PATCH 26/54] changed template id extraction logic --- .github/workflows/build_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 8ff9d641..f15f6df3 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -54,7 +54,7 @@ jobs: run: | rm -f e2b.toml && e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt echo "build_output=$(cat build_output.txt)" >> $GITHUB_OUTPUT - TEMPLATE_ID=$(cat build_output.txt | grep -o 'Requested build for the sandbox template [a-z0-9]*' | cut -d' ' -f6) + TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template env: From 9361d51eb9909c689049544adb6c245eae54fb02 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:11:26 +0200 Subject: [PATCH 27/54] removed unnecessary line --- .github/workflows/build_template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index f15f6df3..94b021e0 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -52,8 +52,8 @@ jobs: - name: Build E2B template id: build-template run: | - rm -f e2b.toml && e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt - echo "build_output=$(cat build_output.txt)" >> $GITHUB_OUTPUT + rm -f e2b.toml + e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template From e11858dc32a91f8db56ff535b06c610b39c75ef3 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:21:33 +0200 Subject: [PATCH 28/54] removed E2B_TEMPLATE_CONFIG --- .github/workflows/build_template.yml | 3 --- .github/workflows/pull_request.yml | 10 +++++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 94b021e0..824d9594 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -13,9 +13,6 @@ on: E2B_DOMAIN: required: false type: string - E2B_TEMPLATE_CONFIG: - required: true - type: string permissions: contents: read diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f7fa158d..4d8aec54 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -22,7 +22,6 @@ jobs: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEMPLATE_CONFIG: ${{ vars.E2B_TEMPLATE_CONFIG }} js-sdk: uses: ./.github/workflows/js_tests.yml needs: build-template @@ -41,5 +40,14 @@ jobs: with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + # cleanup-build-template: + # uses: ./.github/workflows/cleanup_build_template.yml + # needs: [build-template, js-sdk, python-sdk] + # if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + # secrets: + # E2B_API_KEY: ${{ secrets.E2B_API_KEY }} + # E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + # inputs: + # E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} charts-tests: uses: ./.github/workflows/charts_tests.yml From 0bbe315d97b7f26d3a71a8749f05425ab5772d72 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:30:25 +0200 Subject: [PATCH 29/54] removed unused inputs, added cleanup job --- .github/workflows/build_template.yml | 2 -- .github/workflows/cleanup_build_template.yml | 35 ++++++++++++++++++++ .github/workflows/pull_request.yml | 19 +++++------ 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/cleanup_build_template.yml diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 824d9594..af82228f 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -3,8 +3,6 @@ name: Build Template on: workflow_call: secrets: - E2B_API_KEY: - required: true E2B_ACCESS_TOKEN: required: true DOCKERHUB_USERNAME: diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml new file mode 100644 index 00000000..e6ac6f26 --- /dev/null +++ b/.github/workflows/cleanup_build_template.yml @@ -0,0 +1,35 @@ +name: Cleanup Build Template + +on: + workflow_call: + secrets: + E2B_ACCESS_TOKEN: + required: true + DOCKERHUB_USERNAME: + required: true + inputs: + E2B_DOMAIN: + required: false + type: string + E2B_CI_TEMPLATE: + required: true + type: string + +permissions: + contents: read + +jobs: + cleanup: + name: Cleanup Build Template + runs-on: ubuntu-latest + steps: + - name: Install E2B CLI + run: npm install -g @e2b/cli + + - name: Cleanup E2B template + id: cleanup-template + run: | + e2b template delete --team "460355b3-4f64-48f9-9a16-4442817f79f5" ${{ inputs.E2B_CI_TEMPLATE }} + env: + E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 4d8aec54..559b7b1b 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -17,7 +17,6 @@ jobs: build-template: uses: ./.github/workflows/build_template.yml secrets: - E2B_API_KEY: ${{ secrets.E2B_API_KEY }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} with: @@ -40,14 +39,14 @@ jobs: with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} - # cleanup-build-template: - # uses: ./.github/workflows/cleanup_build_template.yml - # needs: [build-template, js-sdk, python-sdk] - # if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - # secrets: - # E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - # E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} - # inputs: - # E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} + cleanup-build-template: + uses: ./.github/workflows/cleanup_build_template.yml + needs: [build-template, js-sdk, python-sdk] + if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + secrets: + E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + inputs: + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} + E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} charts-tests: uses: ./.github/workflows/charts_tests.yml From 6df9f060ba83402f564a4df305db83e646dc69ba Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:33:42 +0200 Subject: [PATCH 30/54] unexpected value inputs --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 559b7b1b..3c3eb8f7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -45,7 +45,7 @@ jobs: if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} - inputs: + with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} charts-tests: From f1ebc557698c095063880e322879cb1c0722bcb9 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:34:52 +0200 Subject: [PATCH 31/54] remove DOCKERHUB_USERNAME not required --- .github/workflows/cleanup_build_template.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index e6ac6f26..e9acf9fc 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -5,8 +5,6 @@ on: secrets: E2B_ACCESS_TOKEN: required: true - DOCKERHUB_USERNAME: - required: true inputs: E2B_DOMAIN: required: false From fe0fbff69f5a07032cbb896cb1c34a4fe9e3bc38 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:46:04 +0200 Subject: [PATCH 32/54] removed hardcoded team id in CI --- .github/workflows/build_template.yml | 2 +- .github/workflows/cleanup_build_template.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index af82228f..b1a11e84 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -48,7 +48,7 @@ jobs: id: build-template run: | rm -f e2b.toml - e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt + e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index e9acf9fc..d4b66dd7 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -27,7 +27,7 @@ jobs: - name: Cleanup E2B template id: cleanup-template run: | - e2b template delete --team "460355b3-4f64-48f9-9a16-4442817f79f5" ${{ inputs.E2B_CI_TEMPLATE }} + e2b template delete ${{ inputs.E2B_CI_TEMPLATE }} env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} From 7f84ecff0fae50b796529790e4a8ec89a62642d8 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:52:38 +0200 Subject: [PATCH 33/54] fixed GitHub Actions syntax in cleanup --- .github/workflows/cleanup_build_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index d4b66dd7..34914e58 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -27,7 +27,7 @@ jobs: - name: Cleanup E2B template id: cleanup-template run: | - e2b template delete ${{ inputs.E2B_CI_TEMPLATE }} + e2b template delete "${{ inputs.E2B_CI_TEMPLATE }}" env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} From f4bb60f753446af1d22eb6e8496383e3e49d0ed8 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 18:08:25 +0200 Subject: [PATCH 34/54] set outputs correctly in build job --- .github/workflows/build_template.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index b1a11e84..4019961f 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -19,6 +19,8 @@ jobs: build: name: Build Docker Image and Template runs-on: ubuntu-latest + outputs: + template_id: ${{ steps.build-template.outputs.template_id }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -50,6 +52,7 @@ jobs: rm -f e2b.toml e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') + echo "Captured Template ID: $TEMPLATE_ID" echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template env: From fb4023684349ea199b6f591df0200a38e1dce4eb Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 18:08:48 +0200 Subject: [PATCH 35/54] added gha cache for CI/CD template build --- .github/workflows/build_template.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 4019961f..9c2b576d 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -42,6 +42,8 @@ jobs: push: false platforms: linux/amd64 tags: ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest + cache-from: type=gha + cache-to: type=gha,mode=max - name: Install E2B CLI run: npm install -g @e2b/cli From 7129f9d083e503eaec697328f4b2635fee36bc95 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 18:27:40 +0200 Subject: [PATCH 36/54] debug cleanup CI --- .github/workflows/build_template.yml | 5 ++++- .github/workflows/cleanup_build_template.yml | 6 ++++++ .github/workflows/pull_request.yml | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 9c2b576d..a0404e9c 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -56,6 +56,8 @@ jobs: TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') echo "Captured Template ID: $TEMPLATE_ID" echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT + echo "GITHUB_OUTPUT contents:" + cat $GITHUB_OUTPUT working-directory: ./template env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} @@ -63,4 +65,5 @@ jobs: - name: Output template ID run: | - echo "Template ID: ${{ steps.build-template.outputs.template_id }}" + echo "Template ID from step output: ${{ steps.build-template.outputs.template_id }}" + echo "Template ID from job output: ${{ needs.build.outputs.template_id }}" diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index 34914e58..920e6f7c 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -27,6 +27,12 @@ jobs: - name: Cleanup E2B template id: cleanup-template run: | + echo "Raw input value: ${{ inputs.E2B_CI_TEMPLATE }}" + echo "Template ID to delete: '${{ inputs.E2B_CI_TEMPLATE }}'" + if [ -z "${{ inputs.E2B_CI_TEMPLATE }}" ]; then + echo "Error: Template ID is empty" + exit 1 + fi e2b template delete "${{ inputs.E2B_CI_TEMPLATE }}" env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 3c3eb8f7..73d8cb88 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -48,5 +48,7 @@ jobs: with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + env: + DEBUG: "true" charts-tests: uses: ./.github/workflows/charts_tests.yml From 72bd91ec2f754b2d273fe8cadb83ec78bac3fe1b Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 18:28:12 +0200 Subject: [PATCH 37/54] removed unexpected value env --- .github/workflows/pull_request.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 73d8cb88..3c3eb8f7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -48,7 +48,5 @@ jobs: with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} - env: - DEBUG: "true" charts-tests: uses: ./.github/workflows/charts_tests.yml From 330d2dcb6e2e561a8bd91685cde25d4bd82a2a6e Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 18:43:45 +0200 Subject: [PATCH 38/54] rewired outputs in build --- .github/workflows/build_template.yml | 7 ++++--- .github/workflows/cleanup_build_template.yml | 6 ------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index a0404e9c..fad8322b 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -11,6 +11,10 @@ on: E2B_DOMAIN: required: false type: string + outputs: + template_id: + description: "The ID of the built template" + value: ${{ steps.build-template.outputs.template_id }} permissions: contents: read @@ -56,8 +60,6 @@ jobs: TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') echo "Captured Template ID: $TEMPLATE_ID" echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT - echo "GITHUB_OUTPUT contents:" - cat $GITHUB_OUTPUT working-directory: ./template env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} @@ -66,4 +68,3 @@ jobs: - name: Output template ID run: | echo "Template ID from step output: ${{ steps.build-template.outputs.template_id }}" - echo "Template ID from job output: ${{ needs.build.outputs.template_id }}" diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index 920e6f7c..34914e58 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -27,12 +27,6 @@ jobs: - name: Cleanup E2B template id: cleanup-template run: | - echo "Raw input value: ${{ inputs.E2B_CI_TEMPLATE }}" - echo "Template ID to delete: '${{ inputs.E2B_CI_TEMPLATE }}'" - if [ -z "${{ inputs.E2B_CI_TEMPLATE }}" ]; then - echo "Error: Template ID is empty" - exit 1 - fi e2b template delete "${{ inputs.E2B_CI_TEMPLATE }}" env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} From 18c30ba5bf8542408cf4835c6d77a34c9f0fdcc7 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Wed, 4 Jun 2025 18:46:19 +0200 Subject: [PATCH 39/54] outputs in build_template.yml --- .github/workflows/build_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index fad8322b..9978c862 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -14,7 +14,7 @@ on: outputs: template_id: description: "The ID of the built template" - value: ${{ steps.build-template.outputs.template_id }} + value: ${{ jobs.build.outputs.template_id }} permissions: contents: read From 38d6d48b3782395257c7bbfd1a633f23418c0c8c Mon Sep 17 00:00:00 2001 From: Jakub Novak Date: Thu, 5 Jun 2025 13:21:08 +0200 Subject: [PATCH 40/54] Rename to test template --- .../{build_template.yml => build_test_template.yml} | 4 ++-- .github/workflows/cleanup_build_template.yml | 8 ++++---- .github/workflows/js_tests.yml | 10 +++++----- .github/workflows/pull_request.yml | 10 +++++----- .github/workflows/python_tests.yml | 4 ++-- js/tests/setup.ts | 2 +- python/tests/conftest.py | 9 +++++---- 7 files changed, 24 insertions(+), 23 deletions(-) rename .github/workflows/{build_template.yml => build_test_template.yml} (95%) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_test_template.yml similarity index 95% rename from .github/workflows/build_template.yml rename to .github/workflows/build_test_template.yml index 9978c862..6aedf5aa 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_test_template.yml @@ -3,7 +3,7 @@ name: Build Template on: workflow_call: secrets: - E2B_ACCESS_TOKEN: + E2B_TEST_ACCESS_TOKEN: required: true DOCKERHUB_USERNAME: required: true @@ -62,7 +62,7 @@ jobs: echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template env: - E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + E2B_ACCESS_TOKEN: ${{ secrets.E2B_TEST_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} - name: Output template ID diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index 34914e58..5bb273fe 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -3,13 +3,13 @@ name: Cleanup Build Template on: workflow_call: secrets: - E2B_ACCESS_TOKEN: + E2B_TEST_ACCESS_TOKEN: required: true inputs: E2B_DOMAIN: required: false type: string - E2B_CI_TEMPLATE: + E2B_TEST_TEMPLATE: required: true type: string @@ -27,7 +27,7 @@ jobs: - name: Cleanup E2B template id: cleanup-template run: | - e2b template delete "${{ inputs.E2B_CI_TEMPLATE }}" + e2b template delete "${{ inputs.E2B_TEST_TEMPLATE }}" env: - E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + E2B_ACCESS_TOKEN: ${{ secrets.E2B_TEST_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index c148a0ad..65e895a2 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -9,7 +9,7 @@ on: E2B_DOMAIN: required: false type: string - E2B_CI_TEMPLATE: + E2B_TEST_TEMPLATE: required: false type: string @@ -57,19 +57,19 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} + E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} - name: Install Bun uses: oven-sh/setup-bun@v2 with: - version: 1.1.x + bun-version: 1.1.x - name: Run Bun tests run: pnpm test:bun env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} + E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} - name: Install Deno uses: denoland/setup-deno@v1 @@ -81,4 +81,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} \ No newline at end of file + E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 3c3eb8f7..9d7ff6e8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -15,10 +15,10 @@ on: jobs: build-template: - uses: ./.github/workflows/build_template.yml + uses: ./.github/workflows/build_test_template.yml secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + E2B_ACCESS_TOKEN: ${{ secrets.E2B_TEST_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} js-sdk: @@ -29,7 +29,7 @@ jobs: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + E2B_TEST_TEMPLATE: ${{ needs.build-template.outputs.template_id }} python-sdk: uses: ./.github/workflows/python_tests.yml needs: build-template @@ -38,7 +38,7 @@ jobs: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + E2B_TEST_TEMPLATE: ${{ needs.build-template.outputs.template_id }} cleanup-build-template: uses: ./.github/workflows/cleanup_build_template.yml needs: [build-template, js-sdk, python-sdk] @@ -47,6 +47,6 @@ jobs: E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + E2B_TEST_TEMPLATE: ${{ needs.build-template.outputs.template_id }} charts-tests: uses: ./.github/workflows/charts_tests.yml diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 972e452a..2541598b 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -9,7 +9,7 @@ on: E2B_DOMAIN: required: false type: string - E2B_CI_TEMPLATE: + E2B_TEST_TEMPLATE: required: false type: string @@ -51,4 +51,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} - E2B_CI_TEMPLATE: ${{ inputs.E2B_CI_TEMPLATE }} \ No newline at end of file + E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} \ No newline at end of file diff --git a/js/tests/setup.ts b/js/tests/setup.ts index cdaf1ad4..f2c2263f 100644 --- a/js/tests/setup.ts +++ b/js/tests/setup.ts @@ -3,7 +3,7 @@ import { test as base } from 'vitest' const timeoutMs = 60_000 -const template = process.env.E2B_CI_TEMPLATE || 'code-interpreter-v1' +const template = process.env.E2B_TEST_TEMPLATE || 'code-interpreter-v1' interface SandboxFixture { sandbox: Sandbox diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 7ee4ed25..7f805cbc 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -9,9 +9,10 @@ timeout = 60 + @pytest.fixture() def template(): - return os.getenv("E2B_CI_TEMPLATE", "code-interpreter-v1") + return os.getenv("E2B_TEST_TEMPLATE", "code-interpreter-v1") @pytest.fixture() @@ -32,13 +33,13 @@ def sandbox(template, debug): @pytest_asyncio.fixture async def async_sandbox(template, debug): - sandbox = await AsyncSandbox.create(template, timeout=timeout) + async_sandbox = await AsyncSandbox.create(template, timeout=timeout) try: - yield sandbox + yield async_sandbox finally: try: - await sandbox.kill() + await async_sandbox.kill() except: if not debug: warning( From e5aca2511006a4ba43a6e15592e474300b5d1b0e Mon Sep 17 00:00:00 2001 From: Jakub Novak Date: Thu, 5 Jun 2025 13:22:37 +0200 Subject: [PATCH 41/54] Fix secrets --- .github/workflows/build_test_template.yml | 4 ++-- .github/workflows/cleanup_build_template.yml | 4 ++-- .github/workflows/js_tests.yml | 6 +++--- .github/workflows/pull_request.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_test_template.yml b/.github/workflows/build_test_template.yml index 6aedf5aa..0ef9d1c9 100644 --- a/.github/workflows/build_test_template.yml +++ b/.github/workflows/build_test_template.yml @@ -3,7 +3,7 @@ name: Build Template on: workflow_call: secrets: - E2B_TEST_ACCESS_TOKEN: + E2B_TESTS_ACCESS_TOKEN: required: true DOCKERHUB_USERNAME: required: true @@ -62,7 +62,7 @@ jobs: echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template env: - E2B_ACCESS_TOKEN: ${{ secrets.E2B_TEST_ACCESS_TOKEN }} + E2B_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} - name: Output template ID diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index 5bb273fe..f603efc3 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -3,7 +3,7 @@ name: Cleanup Build Template on: workflow_call: secrets: - E2B_TEST_ACCESS_TOKEN: + E2B_TESTS_ACCESS_TOKEN: required: true inputs: E2B_DOMAIN: @@ -29,5 +29,5 @@ jobs: run: | e2b template delete "${{ inputs.E2B_TEST_TEMPLATE }}" env: - E2B_ACCESS_TOKEN: ${{ secrets.E2B_TEST_ACCESS_TOKEN }} + E2B_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index 65e895a2..2cfea459 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -56,7 +56,7 @@ jobs: run: pnpm test env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} - name: Install Bun @@ -68,7 +68,7 @@ jobs: run: pnpm test:bun env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} - name: Install Deno @@ -80,5 +80,5 @@ jobs: run: pnpm test:deno env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} - E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }} + E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9d7ff6e8..a186da30 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,7 +18,7 @@ jobs: uses: ./.github/workflows/build_test_template.yml secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - E2B_ACCESS_TOKEN: ${{ secrets.E2B_TEST_ACCESS_TOKEN }} + E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} js-sdk: @@ -44,7 +44,7 @@ jobs: needs: [build-template, js-sdk, python-sdk] if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: - E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }} + E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} E2B_TEST_TEMPLATE: ${{ needs.build-template.outputs.template_id }} From 7ce915f6df42464105b34fd458a3bce702591970 Mon Sep 17 00:00:00 2001 From: Jakub Novak Date: Thu, 5 Jun 2025 13:55:48 +0200 Subject: [PATCH 42/54] Fix bun version --- .github/workflows/js_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index 2cfea459..c796a7a9 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -62,7 +62,7 @@ jobs: - name: Install Bun uses: oven-sh/setup-bun@v2 with: - bun-version: 1.1.x + bun-version: 1.2.15 - name: Run Bun tests run: pnpm test:bun From 44c2926c9753b9a51471a7ee61813a38db1e53de Mon Sep 17 00:00:00 2001 From: Jakub Novak Date: Thu, 5 Jun 2025 14:08:42 +0200 Subject: [PATCH 43/54] Change to _TESTS_ --- .github/workflows/cleanup_build_template.yml | 4 ++-- .github/workflows/js_tests.yml | 8 ++++---- .github/workflows/pull_request.yml | 6 +++--- .github/workflows/python_tests.yml | 4 ++-- js/tests/setup.ts | 2 +- python/tests/conftest.py | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index f603efc3..570fd036 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -9,7 +9,7 @@ on: E2B_DOMAIN: required: false type: string - E2B_TEST_TEMPLATE: + E2B_TESTS_TEMPLATE: required: true type: string @@ -27,7 +27,7 @@ jobs: - name: Cleanup E2B template id: cleanup-template run: | - e2b template delete "${{ inputs.E2B_TEST_TEMPLATE }}" + e2b template delete "${{ inputs.E2B_TESTS_TEMPLATE }}" env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index c796a7a9..144603f6 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -9,7 +9,7 @@ on: E2B_DOMAIN: required: false type: string - E2B_TEST_TEMPLATE: + E2B_TESTS_TEMPLATE: required: false type: string @@ -57,7 +57,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} + E2B_TESTS_TEMPLATE: ${{ inputs.E2B_TESTS_TEMPLATE }} - name: Install Bun uses: oven-sh/setup-bun@v2 @@ -69,7 +69,7 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} + E2B_TESTS_TEMPLATE: ${{ inputs.E2B_TESTS_TEMPLATE }} - name: Install Deno uses: denoland/setup-deno@v1 @@ -81,4 +81,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} \ No newline at end of file + E2B_TESTS_TEMPLATE: ${{ inputs.E2B_TESTS_TEMPLATE }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a186da30..b39c7f72 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -29,7 +29,7 @@ jobs: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEST_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + E2B_TESTS_TEMPLATE: ${{ needs.build-template.outputs.template_id }} python-sdk: uses: ./.github/workflows/python_tests.yml needs: build-template @@ -38,7 +38,7 @@ jobs: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEST_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + E2B_TESTS_TEMPLATE: ${{ needs.build-template.outputs.template_id }} cleanup-build-template: uses: ./.github/workflows/cleanup_build_template.yml needs: [build-template, js-sdk, python-sdk] @@ -47,6 +47,6 @@ jobs: E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} - E2B_TEST_TEMPLATE: ${{ needs.build-template.outputs.template_id }} + E2B_TESTS_TEMPLATE: ${{ needs.build-template.outputs.template_id }} charts-tests: uses: ./.github/workflows/charts_tests.yml diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 2541598b..22c85536 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -9,7 +9,7 @@ on: E2B_DOMAIN: required: false type: string - E2B_TEST_TEMPLATE: + E2B_TESTS_TEMPLATE: required: false type: string @@ -51,4 +51,4 @@ jobs: env: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} - E2B_TEST_TEMPLATE: ${{ inputs.E2B_TEST_TEMPLATE }} \ No newline at end of file + E2B_TESTS_TEMPLATE: ${{ inputs.E2B_TESTS_TEMPLATE }} \ No newline at end of file diff --git a/js/tests/setup.ts b/js/tests/setup.ts index f2c2263f..52cd7c65 100644 --- a/js/tests/setup.ts +++ b/js/tests/setup.ts @@ -3,7 +3,7 @@ import { test as base } from 'vitest' const timeoutMs = 60_000 -const template = process.env.E2B_TEST_TEMPLATE || 'code-interpreter-v1' +const template = process.env.E2B_TESTS_TEMPLATE || 'code-interpreter-v1' interface SandboxFixture { sandbox: Sandbox diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 7f805cbc..796eab91 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -12,7 +12,7 @@ @pytest.fixture() def template(): - return os.getenv("E2B_TEST_TEMPLATE", "code-interpreter-v1") + return os.getenv("E2B_TESTS_TEMPLATE", "code-interpreter-v1") @pytest.fixture() From c1c6e1e96b5f1dbc38b4c7d76bc18a417f116617 Mon Sep 17 00:00:00 2001 From: Jakub Novak Date: Thu, 5 Jun 2025 14:09:21 +0200 Subject: [PATCH 44/54] Confirm template delete --- .github/workflows/cleanup_build_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup_build_template.yml b/.github/workflows/cleanup_build_template.yml index 570fd036..9878474c 100644 --- a/.github/workflows/cleanup_build_template.yml +++ b/.github/workflows/cleanup_build_template.yml @@ -27,7 +27,7 @@ jobs: - name: Cleanup E2B template id: cleanup-template run: | - e2b template delete "${{ inputs.E2B_TESTS_TEMPLATE }}" + e2b template delete -y "${{ inputs.E2B_TESTS_TEMPLATE }}" env: E2B_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }} From 54f3a423ace95e718df43f6336adff288c449e40 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 14:40:01 +0200 Subject: [PATCH 45/54] pass image id from docker-build step to build-template --- .github/workflows/build_test_template.yml | 7 +++---- .github/workflows/pull_request.yml | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_test_template.yml b/.github/workflows/build_test_template.yml index 0ef9d1c9..8487872b 100644 --- a/.github/workflows/build_test_template.yml +++ b/.github/workflows/build_test_template.yml @@ -5,8 +5,6 @@ on: secrets: E2B_TESTS_ACCESS_TOKEN: required: true - DOCKERHUB_USERNAME: - required: true inputs: E2B_DOMAIN: required: false @@ -40,12 +38,12 @@ jobs: sed -i "s/e2b_charts/e2b_charts==${VERSION}/g" requirements.txt - name: Build Docker image + id: docker-build uses: docker/build-push-action@v6 with: context: ./template push: false platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest cache-from: type=gha cache-to: type=gha,mode=max @@ -56,7 +54,8 @@ jobs: id: build-template run: | rm -f e2b.toml - e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile" | tee build_output.txt + echo "FROM ${{ steps.docker-build.outputs.imageid }}" > test.Dockerfile + e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "test.Dockerfile" | tee build_output.txt TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') echo "Captured Template ID: $TEMPLATE_ID" echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b39c7f72..bbebcc33 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -17,7 +17,6 @@ jobs: build-template: uses: ./.github/workflows/build_test_template.yml secrets: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} with: E2B_DOMAIN: ${{ vars.E2B_DOMAIN }} From a0705d21a8afc16e131293ec9bca4f6972129d9b Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 14:54:22 +0200 Subject: [PATCH 46/54] tagged test docker imag --- .github/workflows/build_test_template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_test_template.yml b/.github/workflows/build_test_template.yml index 8487872b..12de0edb 100644 --- a/.github/workflows/build_test_template.yml +++ b/.github/workflows/build_test_template.yml @@ -46,6 +46,7 @@ jobs: platforms: linux/amd64 cache-from: type=gha cache-to: type=gha,mode=max + tags: e2bdev/code-interpreter-test:latest - name: Install E2B CLI run: npm install -g @e2b/cli @@ -54,7 +55,7 @@ jobs: id: build-template run: | rm -f e2b.toml - echo "FROM ${{ steps.docker-build.outputs.imageid }}" > test.Dockerfile + echo "FROM e2bdev/code-interpreter-test:latest" > test.Dockerfile e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "test.Dockerfile" | tee build_output.txt TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') echo "Captured Template ID: $TEMPLATE_ID" From adc967891589cfa61cd63dcaa6d2af7aec9ab07a Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:00:01 +0200 Subject: [PATCH 47/54] grep template from e2b.toml after the build has been completed --- .github/workflows/build_test_template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test_template.yml b/.github/workflows/build_test_template.yml index 12de0edb..abf90f04 100644 --- a/.github/workflows/build_test_template.yml +++ b/.github/workflows/build_test_template.yml @@ -56,8 +56,8 @@ jobs: run: | rm -f e2b.toml echo "FROM e2bdev/code-interpreter-test:latest" > test.Dockerfile - e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "test.Dockerfile" | tee build_output.txt - TEMPLATE_ID=$(grep "Requested build for the sandbox template" build_output.txt | awk '{print $NF}') + e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "test.Dockerfile" + TEMPLATE_ID=$(grep "template_id" e2b.toml | cut -d '"' -f 2) echo "Captured Template ID: $TEMPLATE_ID" echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT working-directory: ./template From fa779de556802eef627fb6850799ea6dacca15f3 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:07:39 +0200 Subject: [PATCH 48/54] changed tag and added load: true to make the image visible locally --- .github/workflows/build_test_template.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test_template.yml b/.github/workflows/build_test_template.yml index abf90f04..5e32d0d4 100644 --- a/.github/workflows/build_test_template.yml +++ b/.github/workflows/build_test_template.yml @@ -43,10 +43,11 @@ jobs: with: context: ./template push: false + load: true platforms: linux/amd64 cache-from: type=gha cache-to: type=gha,mode=max - tags: e2bdev/code-interpreter-test:latest + tags: code-interpreter-test:latest - name: Install E2B CLI run: npm install -g @e2b/cli @@ -55,7 +56,7 @@ jobs: id: build-template run: | rm -f e2b.toml - echo "FROM e2bdev/code-interpreter-test:latest" > test.Dockerfile + echo "FROM code-interpreter-test:latest" > test.Dockerfile e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "test.Dockerfile" TEMPLATE_ID=$(grep "template_id" e2b.toml | cut -d '"' -f 2) echo "Captured Template ID: $TEMPLATE_ID" From 5b22e5715a1054cbc842bb1af3529c711e9ce9b9 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:18:12 +0200 Subject: [PATCH 49/54] removed the docker image as the CLI is always trying to pull --- .github/workflows/build_test_template.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/build_test_template.yml b/.github/workflows/build_test_template.yml index 5e32d0d4..d6267142 100644 --- a/.github/workflows/build_test_template.yml +++ b/.github/workflows/build_test_template.yml @@ -27,9 +27,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Set package version working-directory: ./template run: | @@ -37,18 +34,6 @@ jobs: echo "Version: $VERSION" sed -i "s/e2b_charts/e2b_charts==${VERSION}/g" requirements.txt - - name: Build Docker image - id: docker-build - uses: docker/build-push-action@v6 - with: - context: ./template - push: false - load: true - platforms: linux/amd64 - cache-from: type=gha - cache-to: type=gha,mode=max - tags: code-interpreter-test:latest - - name: Install E2B CLI run: npm install -g @e2b/cli @@ -56,8 +41,7 @@ jobs: id: build-template run: | rm -f e2b.toml - echo "FROM code-interpreter-test:latest" > test.Dockerfile - e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "test.Dockerfile" + e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "Dockerfile" TEMPLATE_ID=$(grep "template_id" e2b.toml | cut -d '"' -f 2) echo "Captured Template ID: $TEMPLATE_ID" echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT From 0b7180758578a82c5bc9befdafbd333aaa3bc85f Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:48:14 +0200 Subject: [PATCH 50/54] renamed build job --- .github/workflows/build_test_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test_template.yml b/.github/workflows/build_test_template.yml index d6267142..e8d6edb2 100644 --- a/.github/workflows/build_test_template.yml +++ b/.github/workflows/build_test_template.yml @@ -19,7 +19,7 @@ permissions: jobs: build: - name: Build Docker Image and Template + name: Build E2B Template runs-on: ubuntu-latest outputs: template_id: ${{ steps.build-template.outputs.template_id }} From 3fbad08f71f3110ee9d307a2f7eeac2aef0e1d3f Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 16:21:31 +0200 Subject: [PATCH 51/54] changed pr workflow checks --- .github/workflows/pull_request.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index bbebcc33..32423708 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,7 +23,6 @@ jobs: js-sdk: uses: ./.github/workflows/js_tests.yml needs: build-template - if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: @@ -32,7 +31,6 @@ jobs: python-sdk: uses: ./.github/workflows/python_tests.yml needs: build-template - if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_API_KEY: ${{ secrets.E2B_API_KEY }} with: @@ -40,7 +38,7 @@ jobs: E2B_TESTS_TEMPLATE: ${{ needs.build-template.outputs.template_id }} cleanup-build-template: uses: ./.github/workflows/cleanup_build_template.yml - needs: [build-template, js-sdk, python-sdk] + needs: [build-template] if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} From a5a29ca8f3396e6a4b28f98ac888ccecfc449698 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 16:26:49 +0200 Subject: [PATCH 52/54] cleanup wait for js sdk, python sdk --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 32423708..5c79896e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -38,7 +38,7 @@ jobs: E2B_TESTS_TEMPLATE: ${{ needs.build-template.outputs.template_id }} cleanup-build-template: uses: ./.github/workflows/cleanup_build_template.yml - needs: [build-template] + needs: [build-template, js-sdk, python-sdk] if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} From 09abade2f58fad998f99fe47d2e1e2d8bc3856b6 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 16:34:36 +0200 Subject: [PATCH 53/54] Kuba's suggestion --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5c79896e..5e1cd71a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,7 +39,7 @@ jobs: cleanup-build-template: uses: ./.github/workflows/cleanup_build_template.yml needs: [build-template, js-sdk, python-sdk] - if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + if: always() && !contains(needs.build-template.result, 'failure') && !contains(needs.*.result, 'cancelled') secrets: E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} with: From f35487b2e9310e4605a981855f506a9b36262811 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:23:33 +0200 Subject: [PATCH 54/54] changed condition --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5e1cd71a..29aa1e15 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,7 +39,7 @@ jobs: cleanup-build-template: uses: ./.github/workflows/cleanup_build_template.yml needs: [build-template, js-sdk, python-sdk] - if: always() && !contains(needs.build-template.result, 'failure') && !contains(needs.*.result, 'cancelled') + if: always() && !contains(needs.build-template.result, 'failure') && !contains(needs.build-template.result, 'cancelled') secrets: E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }} with: