|
| 1 | +name: "Experiment: ARG ordering test (benchmarks#544)" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + n-limit: |
| 7 | + description: 'Number of images to build' |
| 8 | + required: false |
| 9 | + default: '50' |
| 10 | + type: string |
| 11 | + sdk-commit: |
| 12 | + description: 'SDK commit to test' |
| 13 | + required: false |
| 14 | + default: 'main' |
| 15 | + type: string |
| 16 | + |
| 17 | +jobs: |
| 18 | + test-arg-ordering: |
| 19 | + runs-on: |
| 20 | + labels: blacksmith-32vcpu-ubuntu-2204 |
| 21 | + timeout-minutes: 180 |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + packages: write |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v6 |
| 28 | + with: |
| 29 | + submodules: recursive |
| 30 | + |
| 31 | + - name: Update SDK submodule |
| 32 | + if: ${{ inputs.sdk-commit != '' }} |
| 33 | + run: | |
| 34 | + cd vendor/software-agent-sdk |
| 35 | + git fetch origin ${{ inputs.sdk-commit }} |
| 36 | + git checkout FETCH_HEAD |
| 37 | + SDK_SHA=$(git rev-parse HEAD) |
| 38 | + cd ../.. |
| 39 | + echo "SDK at $SDK_SHA" |
| 40 | +
|
| 41 | + - name: Apply ARG ordering fix |
| 42 | + run: | |
| 43 | + DOCKERFILE="vendor/software-agent-sdk/openhands-agent-server/openhands/agent_server/docker/Dockerfile" |
| 44 | + echo "=== BEFORE fix ===" |
| 45 | + grep -n "OPENHANDS_BUILD_GIT" "$DOCKERFILE" || echo "(ARG not present)" |
| 46 | +
|
| 47 | + # Remove ARG/ENV from current position |
| 48 | + sed -i '/^ARG OPENHANDS_BUILD_GIT_SHA=unknown$/d' "$DOCKERFILE" |
| 49 | + sed -i '/^ARG OPENHANDS_BUILD_GIT_REF=unknown$/d' "$DOCKERFILE" |
| 50 | + sed -i '/^ENV OPENHANDS_BUILD_GIT_SHA=${OPENHANDS_BUILD_GIT_SHA}$/d' "$DOCKERFILE" |
| 51 | + sed -i '/^ENV OPENHANDS_BUILD_GIT_REF=${OPENHANDS_BUILD_GIT_REF}$/d' "$DOCKERFILE" |
| 52 | +
|
| 53 | + # Insert after npm install, before COPY uv |
| 54 | + sed -i '/^COPY --from=ghcr.io\/astral-sh\/uv \/uv \/uvx \/bin\/$/i\ |
| 55 | +ARG OPENHANDS_BUILD_GIT_SHA=unknown\ |
| 56 | +ARG OPENHANDS_BUILD_GIT_REF=unknown\ |
| 57 | +ENV OPENHANDS_BUILD_GIT_SHA=${OPENHANDS_BUILD_GIT_SHA}\ |
| 58 | +ENV OPENHANDS_BUILD_GIT_REF=${OPENHANDS_BUILD_GIT_REF}' "$DOCKERFILE" |
| 59 | + |
| 60 | + echo "=== AFTER fix ===" |
| 61 | + grep -n "OPENHANDS_BUILD_GIT" "$DOCKERFILE" |
| 62 | + |
| 63 | + - name: Set up Docker Buildx with Blacksmith |
| 64 | + uses: useblacksmith/setup-docker-builder@v1 |
| 65 | + |
| 66 | + - name: Log in to GHCR |
| 67 | + uses: docker/login-action@v3 |
| 68 | + with: |
| 69 | + registry: ghcr.io |
| 70 | + username: ${{ github.actor }} |
| 71 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + |
| 73 | + - name: Install uv |
| 74 | + uses: astral-sh/setup-uv@v7 |
| 75 | + with: |
| 76 | + enable-cache: true |
| 77 | + |
| 78 | + - name: Install dependencies |
| 79 | + run: make build |
| 80 | + |
| 81 | + - name: Build images with ARG fix |
| 82 | + run: | |
| 83 | + set -euo pipefail |
| 84 | + N_LIMIT="${{ inputs.n-limit || '50' }}" |
| 85 | + echo "Building $N_LIMIT images with ARG ordering fix..." |
| 86 | + uv run benchmarks/swtbench/build_images.py \ |
| 87 | + --dataset eth-sri/SWT-bench_Verified_bm25_27k_zsp \ |
| 88 | + --split test \ |
| 89 | + --image ghcr.io/openhands/eval-agent-server \ |
| 90 | + --target source-minimal \ |
| 91 | + --max-workers 4 \ |
| 92 | + --build-batch-size 15 \ |
| 93 | + --n-limit "$N_LIMIT" \ |
| 94 | + --force-build \ |
| 95 | + --push |
| 96 | + env: |
| 97 | + DOCKER_BUILDKIT: 1 |
| 98 | + BUILDKIT_PROGRESS: plain |
| 99 | + OPENHANDS_BUILDKIT_CACHE_MODE: "off" |
| 100 | + |
| 101 | + - name: Display build summary |
| 102 | + if: always() |
| 103 | + run: | |
| 104 | + uv run python -m benchmarks.scripts.summarize_build_manifests \ |
| 105 | + --build-root builds \ |
| 106 | + --title "ARG Ordering Experiment Summary" >> "$GITHUB_STEP_SUMMARY" |
| 107 | +
|
| 108 | + - name: Archive build logs |
| 109 | + if: always() |
| 110 | + run: | |
| 111 | + if [ -d builds ]; then |
| 112 | + tar -czf build-logs.tar.gz builds/ |
| 113 | + fi |
| 114 | +
|
| 115 | + - name: Upload build logs |
| 116 | + if: always() |
| 117 | + uses: actions/upload-artifact@v6 |
| 118 | + with: |
| 119 | + name: experiment-logs-${{ github.run_id }} |
| 120 | + path: build-logs.tar.gz |
| 121 | + retention-days: 7 |
| 122 | + if-no-files-found: warn |
0 commit comments