Skip to content
Latchkey

Build Prod Template workflow (e2b-dev/code-interpreter)

The Build Prod Template workflow from e2b-dev/code-interpreter, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: e2b-dev/code-interpreter.github/workflows/build_prod_template.ymlLicense Apache-2.0View source

What it does

This is the Build Prod Template workflow from the e2b-dev/code-interpreter repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Build Prod Template

on:
  workflow_dispatch:
    inputs:
      target_environment:
        description: Target environment
        required: true
        type: choice
        default: foxtrot
        options:
          - foxtrot
          - staging
          - juliett
      skip_cache:
        description: Skip build cache
        required: false
        type: boolean
        default: false

concurrency:
  group: Release-${{ github.ref }}-${{ inputs.target_environment }}
  cancel-in-progress: false

permissions:
  contents: read

jobs:
  build-template:
    name: Build E2B template
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Parse .tool-versions
        uses: wistia/parse-tool-versions@v2.1.1
        with:
          filename: '.tool-versions'
          uppercase: 'true'
          prefix: 'tool_version_'

      - uses: actions/setup-python@v6
        with:
          python-version: '${{ env.TOOL_VERSION_PYTHON }}'

      - name: Install development dependencies
        working-directory: ./template
        run: pip install -r requirements-dev.txt

      - name: Resolve target environment
        env:
          TARGET_ENVIRONMENT: ${{ inputs.target_environment }}
          FOXTROT_DOMAIN: ${{ vars.E2B_DOMAIN }}
          FOXTROT_API_KEY: ${{ secrets.E2B_PROD_API_KEY }}
          STAGING_API_KEY: ${{ secrets.E2B_STAGING_API_KEY }}
          JULIETT_API_KEY: ${{ secrets.E2B_JULIETT_API_KEY }}
        run: |
          set -eu

          case "$TARGET_ENVIRONMENT" in
            foxtrot)
              E2B_DOMAIN="$FOXTROT_DOMAIN"
              E2B_API_KEY="$FOXTROT_API_KEY"
              ;;
            staging)
              E2B_DOMAIN="e2b-staging.dev"
              E2B_API_KEY="$STAGING_API_KEY"
              ;;
            juliett)
              E2B_DOMAIN="e2b-juliett.dev"
              E2B_API_KEY="$JULIETT_API_KEY"
              ;;
            *)
              echo "Unknown target environment: $TARGET_ENVIRONMENT" >&2
              exit 1
              ;;
          esac

          if [ -z "$E2B_DOMAIN" ]; then
            echo "Missing E2B domain for target environment: $TARGET_ENVIRONMENT" >&2
            exit 1
          fi

          if [ -z "$E2B_API_KEY" ]; then
            echo "Missing API key secret for target environment: $TARGET_ENVIRONMENT" >&2
            exit 1
          fi

          echo "::add-mask::$E2B_API_KEY"

          {
            echo "E2B_DOMAIN=$E2B_DOMAIN"
            echo "E2B_API_KEY=$E2B_API_KEY"
          } >> "$GITHUB_ENV"

          {
            echo "### Build target"
            echo
            echo "Target: $TARGET_ENVIRONMENT"
            echo "Domain: $E2B_DOMAIN"
          } >> "$GITHUB_STEP_SUMMARY"

      - name: Build E2B template
        id: build-template
        working-directory: ./template
        run: |
          python build_prod.py
        env:
          SKIP_CACHE: ${{ inputs.skip_cache }}

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Build Prod Template
 
on:
  workflow_dispatch:
    inputs:
      target_environment:
        description: Target environment
        required: true
        type: choice
        default: foxtrot
        options:
          - foxtrot
          - staging
          - juliett
      skip_cache:
        description: Skip build cache
        required: false
        type: boolean
        default: false
 
concurrency:
  group: Release-${{ github.ref }}-${{ inputs.target_environment }}
  cancel-in-progress: false
 
permissions:
  contents: read
 
jobs:
  build-template:
    timeout-minutes: 30
    name: Build E2B template
    runs-on: latchkey-small
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
 
      - name: Parse .tool-versions
        uses: wistia/parse-tool-versions@v2.1.1
        with:
          filename: '.tool-versions'
          uppercase: 'true'
          prefix: 'tool_version_'
 
      - uses: actions/setup-python@v6
        with:
          cache: 'pip'
          python-version: '${{ env.TOOL_VERSION_PYTHON }}'
 
      - name: Install development dependencies
        working-directory: ./template
        run: pip install -r requirements-dev.txt
 
      - name: Resolve target environment
        env:
          TARGET_ENVIRONMENT: ${{ inputs.target_environment }}
          FOXTROT_DOMAIN: ${{ vars.E2B_DOMAIN }}
          FOXTROT_API_KEY: ${{ secrets.E2B_PROD_API_KEY }}
          STAGING_API_KEY: ${{ secrets.E2B_STAGING_API_KEY }}
          JULIETT_API_KEY: ${{ secrets.E2B_JULIETT_API_KEY }}
        run: |
          set -eu
 
          case "$TARGET_ENVIRONMENT" in
            foxtrot)
              E2B_DOMAIN="$FOXTROT_DOMAIN"
              E2B_API_KEY="$FOXTROT_API_KEY"
              ;;
            staging)
              E2B_DOMAIN="e2b-staging.dev"
              E2B_API_KEY="$STAGING_API_KEY"
              ;;
            juliett)
              E2B_DOMAIN="e2b-juliett.dev"
              E2B_API_KEY="$JULIETT_API_KEY"
              ;;
            *)
              echo "Unknown target environment: $TARGET_ENVIRONMENT" >&2
              exit 1
              ;;
          esac
 
          if [ -z "$E2B_DOMAIN" ]; then
            echo "Missing E2B domain for target environment: $TARGET_ENVIRONMENT" >&2
            exit 1
          fi
 
          if [ -z "$E2B_API_KEY" ]; then
            echo "Missing API key secret for target environment: $TARGET_ENVIRONMENT" >&2
            exit 1
          fi
 
          echo "::add-mask::$E2B_API_KEY"
 
          {
            echo "E2B_DOMAIN=$E2B_DOMAIN"
            echo "E2B_API_KEY=$E2B_API_KEY"
          } >> "$GITHUB_ENV"
 
          {
            echo "### Build target"
            echo
            echo "Target: $TARGET_ENVIRONMENT"
            echo "Domain: $E2B_DOMAIN"
          } >> "$GITHUB_STEP_SUMMARY"
 
      - name: Build E2B template
        id: build-template
        working-directory: ./template
        run: |
          python build_prod.py
        env:
          SKIP_CACHE: ${{ inputs.skip_cache }}
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow