-
Notifications
You must be signed in to change notification settings - Fork 0
feat: tarball build pipeline for process injection #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,54 @@ jobs: | |
| echo "Testing LB handler in Docker environment..." | ||
| docker run --rm flash-lb-cpu:test ./test-lb-handler.sh | ||
|
|
||
| tarball: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Build tarball | ||
| env: | ||
| PYTHON_VERSION: "3.11" | ||
| run: bash scripts/build-tarball.sh | ||
|
|
||
| - name: Test tarball in bare ubuntu container | ||
| run: | | ||
| TARBALL=$(ls dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | ||
| docker run --rm -v "$(pwd)/dist:/dist" ubuntu:22.04 \ | ||
| bash -c "tar xzf /dist/$(basename $TARBALL) -C /opt && /opt/flash-worker/bootstrap.sh --test" | ||
|
|
||
| - name: Upload tarball artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: flash-worker-tarball | ||
| path: dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz | ||
| retention-days: 30 | ||
| overwrite: true | ||
|
|
||
| - name: Post artifact link on PR | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| TARBALL=$(basename dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | ||
| RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
| BODY="**Tarball artifact:** [\`${TARBALL}\`](${RUN_URL}#artifacts) | ||
|
|
||
| To test: \`FLASH_WORKER_TARBALL_URL=<download-url> flash deploy\`" | ||
|
Comment on lines
+166
to
+170
|
||
|
|
||
| # Delete previous tarball comments to keep PR clean | ||
| gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \ | ||
| --jq '.[] | select(.body | contains("Tarball artifact:")) | .id' | \ | ||
| xargs -I{} gh api -X DELETE "repos/${{ github.repository }}/issues/comments/{}" 2>/dev/null || true | ||
|
|
||
| gh pr comment "${{ github.event.pull_request.number }}" --body "$BODY" | ||
|
|
||
| docker-validation: | ||
| runs-on: ubuntu-latest | ||
| needs: [test, lint, docker-test, docker-test-lb-cpu] | ||
|
|
@@ -229,6 +277,13 @@ jobs: | |
| cache-from: type=gha,scope=gpu | ||
| cache-to: type=gha,mode=max,scope=gpu | ||
|
|
||
| tarball-release: | ||
| needs: [release] | ||
| if: needs.release.outputs.release_created | ||
| uses: ./.github/workflows/release-tarball.yml | ||
| with: | ||
| tag_name: ${{ needs.release.outputs.tag_name }} | ||
|
|
||
| docker-prod-cpu: | ||
| runs-on: ubuntu-latest | ||
| needs: [release] | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Release Tarball | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dry_run: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "Dry run (build but don't upload)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default: "false" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Triggered by release job in ci.yml via workflow_call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # or manually via workflow_dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_call: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tag_name: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build-tarball: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Set up uv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: astral-sh/setup-uv@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| enable-cache: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Build tarball | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PYTHON_VERSION: "3.11" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bash scripts/build-tarball.sh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Test tarball in bare ubuntu container | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TARBALL=$(ls dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker run --rm -v "$(pwd)/dist:/dist" ubuntu:22.04 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bash -c "tar xzf /dist/$(basename $TARBALL) -C /opt && /opt/flash-worker/bootstrap.sh --test" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload tarball to GitHub Release | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: inputs.dry_run != 'true' && inputs.tag_name != '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ github.token }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TARBALL=$(ls dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+42
to
+51
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TARBALL=$(ls dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | |
| docker run --rm -v "$(pwd)/dist:/dist" ubuntu:22.04 \ | |
| bash -c "tar xzf /dist/$(basename $TARBALL) -C /opt && /opt/flash-worker/bootstrap.sh --test" | |
| - name: Upload tarball to GitHub Release | |
| if: inputs.dry_run != 'true' && inputs.tag_name != '' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| TARBALL=$(ls dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | |
| shopt -s nullglob | |
| tarballs=(dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | |
| if [ "${#tarballs[@]}" -ne 1 ]; then | |
| echo "Expected exactly one tarball in dist/, found ${#tarballs[@]} matches." | |
| exit 1 | |
| fi | |
| TARBALL="${tarballs[0]}" | |
| docker run --rm -v "$(pwd)/dist:/dist" ubuntu:22.04 \ | |
| bash -c "tar xzf /dist/$(basename \"$TARBALL\") -C /opt && /opt/flash-worker/bootstrap.sh --test" | |
| - name: Upload tarball to GitHub Release | |
| if: inputs.dry_run != 'true' && inputs.tag_name != '' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| shopt -s nullglob | |
| tarballs=(dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz) | |
| if [ "${#tarballs[@]}" -ne 1 ]; then | |
| echo "Expected exactly one tarball in dist/, found ${#tarballs[@]} matches." | |
| exit 1 | |
| fi | |
| TARBALL="${tarballs[0]}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ IMAGE = runpod/flash | |
| TAG = $(or $(FLASH_IMAGE_TAG),local) | ||
| FULL_IMAGE = $(IMAGE):$(TAG) | ||
| FULL_IMAGE_CPU = $(IMAGE)-cpu:$(TAG) | ||
| VERSION = $(shell python3 -c "import re; print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', open('src/version.py').read()).group(1))") | ||
| # Must match base image Python: pytorch:2.9.1-cuda12.8-cudnn9-runtime and python:3.11-slim | ||
| TARBALL_PYTHON_VERSION ?= 3.11 | ||
|
|
||
| # Detect host platform for local builds | ||
| ARCH := $(shell uname -m) | ||
|
|
@@ -56,6 +59,27 @@ clean: # Remove build artifacts and cache files | |
| find . -type f -name "*.pyc" -delete | ||
| find . -type f -name "*.pkl" -delete | ||
|
|
||
| # Tarball targets (process-injectable runtime) | ||
| tarball: # Build self-contained runtime tarball (runs in Docker, linux/amd64) | ||
| docker run --rm --platform linux/amd64 \ | ||
| -e PYTHON_VERSION=$(TARBALL_PYTHON_VERSION) \ | ||
| -e UV_CACHE_DIR=/workspace/dist/.uv-cache \ | ||
| -v $(PWD):/workspace -w /workspace \ | ||
| python:3.11-slim \ | ||
| bash -c 'apt-get update -qq && apt-get install -y -qq curl > /dev/null 2>&1 && pip install uv -q && bash scripts/build-tarball.sh' | ||
|
|
||
|
Comment on lines
+62
to
+70
|
||
| tarball-test: tarball # Test tarball in bare ubuntu container | ||
| docker run --rm --platform linux/amd64 -v $(PWD)/dist:/dist ubuntu:22.04 \ | ||
| bash -c 'tar xzf /dist/flash-worker-v$(VERSION)-py$(TARBALL_PYTHON_VERSION)-linux-x86_64.tar.gz -C /opt && /opt/flash-worker/bootstrap.sh --test' | ||
|
|
||
| tarball-test-local: # Test tarball injection with mounted file (no rebuild) | ||
| docker run --rm --platform linux/amd64 \ | ||
| -v $(PWD)/dist/flash-worker-v$(VERSION)-py$(TARBALL_PYTHON_VERSION)-linux-x86_64.tar.gz:/tmp/flash-worker.tar.gz \ | ||
| ubuntu:22.04 \ | ||
| bash -c 'set -e; FW_DIR=/opt/flash-worker; mkdir -p $$FW_DIR; \ | ||
| tar xzf /tmp/flash-worker.tar.gz -C $$FW_DIR --strip-components=1; \ | ||
| $$FW_DIR/bootstrap.sh --test' | ||
|
|
||
| setup: dev # Initialize project and sync dependencies | ||
| @echo "Setup complete. Development environment ready." | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/bin/sh | ||
| # Flash Worker bootstrap -- entry point for process-injected runtime. | ||
| # Launched by dockerArgs after tarball extraction. | ||
| set -e | ||
|
|
||
| FW_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
|
||
| # Self-test mode (used by tarball-test targets) | ||
| if [ "$1" = "--test" ]; then | ||
| echo "Flash Worker bootstrap self-test" | ||
| echo "FW_DIR: $FW_DIR" | ||
| echo "Python: $("$FW_DIR/python/bin/python3" --version)" | ||
| echo "uv: $("$FW_DIR/uv" --version)" | ||
| "$FW_DIR/venv/bin/python" -c "import pydantic; print(f'pydantic {pydantic.__version__}')" | ||
| "$FW_DIR/venv/bin/python" -c "import fastapi; print(f'fastapi {fastapi.__version__}')" | ||
| echo "Version: $(cat "$FW_DIR/.version")" | ||
| echo "Self-test passed" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Isolated flash-worker environment | ||
| export PATH="$FW_DIR/venv/bin:$FW_DIR/python/bin:$FW_DIR:$PATH" | ||
| export VIRTUAL_ENV="$FW_DIR/venv" | ||
| PYTHON_MINOR=$("$FW_DIR/python/bin/python3" -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") | ||
| export PYTHONPATH="$FW_DIR/src:$VIRTUAL_ENV/lib/python${PYTHON_MINOR}/site-packages${PYTHONPATH:+:$PYTHONPATH}" | ||
|
|
||
| # Signal tarball mode for dependency installer | ||
| export FLASH_WORKER_INSTALL_DIR="$FW_DIR" | ||
|
|
||
| # Mode detection (same contract as Docker images) | ||
| ENDPOINT_TYPE="${FLASH_ENDPOINT_TYPE:-qb}" | ||
|
|
||
| if [ "$ENDPOINT_TYPE" = "lb" ]; then | ||
| exec uvicorn lb_handler:app \ | ||
| --host 0.0.0.0 \ | ||
| --port 80 \ | ||
| --timeout-keep-alive 600 \ | ||
| --app-dir "$FW_DIR/src" | ||
| else | ||
| exec python3 "$FW_DIR/src/handler.py" | ||
| fi |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,158 @@ | ||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||
| # Build a self-contained flash-worker tarball for process injection. | ||||||||||||||||||||||||||||||||||||||
| # Output: dist/flash-worker-v{VERSION}-py{PYTHON_VERSION}-linux-x86_64.tar.gz | ||||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||||||||||||||||||||||||||||||||||||||
| REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Read version from source | ||||||||||||||||||||||||||||||||||||||
| VERSION=$(python3 -c " | ||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||
| text = open('$REPO_ROOT/src/version.py').read() | ||||||||||||||||||||||||||||||||||||||
| print(re.search(r'__version__\\s*=\\s*\"([^\"]+)\"', text).group(1)) | ||||||||||||||||||||||||||||||||||||||
| ") | ||||||||||||||||||||||||||||||||||||||
| echo "Building flash-worker tarball v${VERSION}" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Configuration | ||||||||||||||||||||||||||||||||||||||
| PYTHON_VERSION="${PYTHON_VERSION:-3.11}" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Validate Python version against project requirement (>=3.10, <3.15) | ||||||||||||||||||||||||||||||||||||||
| PY_MINOR=$(echo "$PYTHON_VERSION" | cut -d. -f2) | ||||||||||||||||||||||||||||||||||||||
| if [ "$PY_MINOR" -lt 10 ] || [ "$PY_MINOR" -ge 15 ]; then | ||||||||||||||||||||||||||||||||||||||
| echo "ERROR: Python ${PYTHON_VERSION} is outside project requirement (>=3.10, <3.15)" | ||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| UV_VERSION="0.7.19" | ||||||||||||||||||||||||||||||||||||||
| UV_URL="https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Build in container-local tmpdir to avoid macOS case-insensitive filesystem issues | ||||||||||||||||||||||||||||||||||||||
| BUILD_DIR="/tmp/flash-worker-build" | ||||||||||||||||||||||||||||||||||||||
| TARBALL_ROOT="$BUILD_DIR/flash-worker" | ||||||||||||||||||||||||||||||||||||||
| OUTPUT_DIR="$REPO_ROOT/dist" | ||||||||||||||||||||||||||||||||||||||
| TARBALL_NAME="flash-worker-v${VERSION}-py${PYTHON_VERSION}-linux-x86_64.tar.gz" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Clean previous build | ||||||||||||||||||||||||||||||||||||||
| rm -rf "$BUILD_DIR" | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+37
|
||||||||||||||||||||||||||||||||||||||
| BUILD_DIR="/tmp/flash-worker-build" | |
| TARBALL_ROOT="$BUILD_DIR/flash-worker" | |
| OUTPUT_DIR="$REPO_ROOT/dist" | |
| TARBALL_NAME="flash-worker-v${VERSION}-py${PYTHON_VERSION}-linux-x86_64.tar.gz" | |
| # Clean previous build | |
| rm -rf "$BUILD_DIR" | |
| BUILD_DIR="$(mktemp -d -t flash-worker-build.XXXXXX)" | |
| TARBALL_ROOT="$BUILD_DIR/flash-worker" | |
| OUTPUT_DIR="$REPO_ROOT/dist" | |
| TARBALL_NAME="flash-worker-v${VERSION}-py${PYTHON_VERSION}-linux-x86_64.tar.gz" | |
| cleanup() { | |
| if [ -n "${BUILD_DIR:-}" ] && [ -d "$BUILD_DIR" ]; then | |
| rm -rf "$BUILD_DIR" | |
| fi | |
| } | |
| trap cleanup EXIT |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script pins UV_VERSION for the tarball, but uses whatever uv is on PATH for uv python install and uv export. This can make builds non-reproducible across environments (host uv version != tarball uv). Consider extracting/using the pinned uv binary for all uv operations (or asserting the host uv --version matches UV_VERSION).
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tar ... 2>/dev/null || true suppresses extraction failures for the bundled uv, which can make subsequent failures (e.g., at chmod +x) harder to diagnose. Consider removing || true/stderr suppression and explicitly erroring if the expected uv binary isn’t extracted.
| tar xzf "$OUTPUT_DIR/.cache/uv-${UV_VERSION}.tar.gz" -C "$TARBALL_ROOT" --no-same-owner --strip-components=1 "uv-x86_64-unknown-linux-gnu/uv" 2>/dev/null || true | |
| else | |
| curl -fsSL "$UV_URL" -o "$OUTPUT_DIR/.cache/uv-${UV_VERSION}.tar.gz" | |
| tar xzf "$OUTPUT_DIR/.cache/uv-${UV_VERSION}.tar.gz" -C "$TARBALL_ROOT" --no-same-owner --strip-components=1 "uv-x86_64-unknown-linux-gnu/uv" 2>/dev/null || true | |
| fi | |
| tar xzf "$OUTPUT_DIR/.cache/uv-${UV_VERSION}.tar.gz" -C "$TARBALL_ROOT" --no-same-owner --strip-components=1 "uv-x86_64-unknown-linux-gnu/uv" | |
| else | |
| curl -fsSL "$UV_URL" -o "$OUTPUT_DIR/.cache/uv-${UV_VERSION}.tar.gz" | |
| tar xzf "$OUTPUT_DIR/.cache/uv-${UV_VERSION}.tar.gz" -C "$TARBALL_ROOT" --no-same-owner --strip-components=1 "uv-x86_64-unknown-linux-gnu/uv" | |
| fi | |
| if [ ! -f "$TARBALL_ROOT/uv" ]; then | |
| echo "ERROR: Failed to extract uv binary to $TARBALL_ROOT/uv" | |
| exit 1 | |
| fi |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp -r "$REPO_ROOT/src/"*.py "$TARBALL_ROOT/src/" runs before $TARBALL_ROOT/src is created and its failure is ignored, and then the script copies the same files again in a loop. Creating the destination directory first and using a single copy mechanism would avoid silent failures and reduce duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the tarball self-test step,
TARBALL=$(ls dist/flash-worker-v*-py3.11-linux-x86_64.tar.gz)and then$(basename $TARBALL)can behave unexpectedly if the glob matches 0 or >1 files (or if filenames contain spaces). Consider using a safer selection pattern (e.g., ensure exactly one match) and quoting variables when passing them intobasename/the docker command.