diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index dbd08d40..b4bbc73f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -35,12 +35,12 @@ jobs: - name: Install build tools run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y cmake ninja-build g++ python3-numpy - name: Install pinned Rust - run: rustup toolchain install 1.99.0 --profile minimal --component rustfmt --component clippy + run: scripts/install-pinned-rustup.sh rustup toolchain install 1.99.0 --profile minimal --component rustfmt --component clippy - name: Local checks run: scripts/check-local.sh keyless-cuda: - if: github.event_name == 'workflow_dispatch' && inputs.keyless_gpu + if: gitea.event_name == 'workflow_dispatch' && gitea.event.inputs.keyless_gpu == 'true' runs-on: [self-hosted, linux, x64, strata-gpu] steps: - uses: actions/checkout@v4 @@ -50,7 +50,7 @@ jobs: run: scripts/check-kar-expert-gpu.sh static-cuda-package: - if: github.event_name == 'workflow_dispatch' && inputs.static_cuda_package && github.event.repository.private + if: gitea.event_name == 'workflow_dispatch' && gitea.event.inputs.static_cuda_package == 'true' && gitea.event.repository.private needs: verify runs-on: [self-hosted, linux, x64, strata-gpu] steps: @@ -63,8 +63,7 @@ jobs: run: nice -n 10 scripts/build-static-cuda.sh - name: Install pinned Rust and musl target run: | - rustup toolchain install 1.99.0 --profile minimal - rustup target add --toolchain 1.99.0 x86_64-unknown-linux-musl + scripts/install-pinned-rustup.sh rustup toolchain install 1.99.0 --profile minimal --target x86_64-unknown-linux-musl command -v musl-gcc - name: Assemble combined private package run: | @@ -106,7 +105,7 @@ jobs: run: rm -rf -- "${RUNNER_TEMP}/strata-static-cuda-${GITHUB_RUN_ID}" "${RUNNER_TEMP}/strata-package-build-${GITHUB_RUN_ID}" hosted-cuda-package: - if: github.event_name == 'workflow_dispatch' && (inputs.hosted_cuda_package || inputs.hosted_cuda_ple) && github.event.repository.private + if: gitea.event_name == 'workflow_dispatch' && (gitea.event.inputs.hosted_cuda_package == 'true' || gitea.event.inputs.hosted_cuda_ple == 'true') && gitea.event.repository.private needs: verify runs-on: ubuntu-latest timeout-minutes: 150 @@ -124,7 +123,7 @@ jobs: echo "CUDACXX=$RUNNER_TEMP/strata-cuda-toolkit/bin/nvcc" >> "$GITHUB_ENV" echo "CUDAToolkit_ROOT=$RUNNER_TEMP/strata-cuda-toolkit" >> "$GITHUB_ENV" echo "STRATA_BUILD_DIR=$RUNNER_TEMP/strata-hosted-cuda-engine" >> "$GITHUB_ENV" - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y musl-tools binutils docker.io + apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates musl-tools binutils docker.io python3 - name: Assemble pinned build-only CUDA components run: python3 scripts/bootstrap-cuda-toolkit.py --output "$CUDAToolkit_ROOT" - name: Build pinned GPU-hidden compiler image @@ -206,8 +205,7 @@ jobs: PYFEATURES - name: Install pinned Rust and musl target run: | - rustup toolchain install 1.99.0 --profile minimal - rustup target add --toolchain 1.99.0 x86_64-unknown-linux-musl + scripts/install-pinned-rustup.sh rustup toolchain install 1.99.0 --profile minimal --target x86_64-unknown-linux-musl - name: Assemble actual combined executable and runtime image run: | # Keep resource evidence even if the hosted runner terminates this job. @@ -263,8 +261,7 @@ jobs: run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y musl-tools cmake binutils python3-numpy docker.io - name: Install pinned Rust and target run: | - rustup toolchain install 1.99.0 --profile minimal - rustup target add --toolchain 1.99.0 x86_64-unknown-linux-musl + scripts/install-pinned-rustup.sh rustup toolchain install 1.99.0 --profile minimal --target x86_64-unknown-linux-musl - name: Build static CLI run: cargo build --manifest-path control-plane/Cargo.toml --locked --release --target x86_64-unknown-linux-musl --bin strata-next - name: Verify ELF and checksum diff --git a/docs/build-validation.md b/docs/build-validation.md index 6edfc9ca..2cabd958 100644 --- a/docs/build-validation.md +++ b/docs/build-validation.md @@ -834,8 +834,29 @@ invalid archives/receipts and do not require CUDA; only a successful manual actual-CUDA job qualifies compilation and packaging. GPU driver loading, full-model/MTP inference, quality and clean-node rollback remain separate gates. +PLE-only packaging is selected with Gitea input `hosted_cuda_ple=true`; its job +uses the CPU runner and hides all GPU devices inside the pinned build container. +The workflow reads Gitea's raw dispatch inputs as strings and explicitly +compares each opt-in to `true`, so a false string cannot enqueue GPU jobs. + +The Rust installer is pinned separately from the compiler toolchain: + +| Dependency | Pin | +| --- | --- | +| rustup-init | 1.29.0, SHA-256 `4acc9acc76d5079515b46346a485974457b5a79893cfb01112423c89aeb5aa10` | +| rustc / cargo | 1.99.0 from `rust-toolchain.toml` | +| CUDA toolkit | 13.0.1 manifest; NVCC 13.0.88, component hashes in `deploy/cuda-toolkit.lock.json` | +| CUDA build image | Ubuntu base digest `f610ab94648195aa356059f5b41d6085c9d4d903c072430cdd1af7bdb646106b`; GCC/G++ 13 | + +The runner's `ubuntu-latest` label and job container image are runner +configuration, not immutable pins; actual OS and apt package versions are +recorded in artifact provenance. Trigger a private build on a committed branch +with the Gitea API (input values are strings): + ```sh -gh workflow run linux.yml --ref COMMITTED_REF -f hosted_cuda_package=true +tea api --repo para/leleka --login git.vezha.io --method POST \ + -d '{"ref":"refs/heads/BRANCH","inputs":{"hosted_cuda_ple":"true"}}' \ + /repos/para/leleka/actions/workflows/linux.yml/dispatches ``` ## Native per-user installation (STRA-72) diff --git a/scripts/install-pinned-rustup.sh b/scripts/install-pinned-rustup.sh new file mode 100755 index 00000000..484997e6 --- /dev/null +++ b/scripts/install-pinned-rustup.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Pin the installer independently of rust-toolchain.toml, which pins rustc/cargo. +readonly RUSTUP_VERSION="1.29.0" +readonly RUSTUP_TARGET="x86_64-unknown-linux-gnu" +readonly RUSTUP_INIT_SHA256="4acc9acc76d5079515b46346a485974457b5a79893cfb01112423c89aeb5aa10" +readonly RUSTUP_INIT_URL="https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${RUSTUP_TARGET}/rustup-init" + +# Give each Actions job an isolated installation so a host's rustup cannot +# silently override the version pinned here. +if [[ -n "${RUNNER_TEMP:-}" && -n "${GITHUB_RUN_ID:-}" ]]; then + rustup_home="${RUNNER_TEMP}/strata-rustup-${GITHUB_RUN_ID}-${GITHUB_JOB:-job}" + export CARGO_HOME="${rustup_home}/cargo" + export RUSTUP_HOME="${rustup_home}/rustup" + mkdir -p "$CARGO_HOME" + if [[ -n "${GITHUB_ENV:-}" ]]; then + printf 'CARGO_HOME=%s\nRUSTUP_HOME=%s\n' "$CARGO_HOME" "$RUSTUP_HOME" >> "$GITHUB_ENV" + fi +fi + +tmp_dir="$(mktemp -d)" +trap 'rm -rf -- "$tmp_dir"' EXIT + +python3 - "$RUSTUP_INIT_URL" "$tmp_dir/rustup-init" <<'PY' +import shutil +import sys +import urllib.request + +request = urllib.request.Request( + sys.argv[1], headers={"User-Agent": "strata-next-pinned-rustup-bootstrap/1"} +) +with urllib.request.urlopen(request, timeout=120) as response: + with open(sys.argv[2], "wb") as output: + shutil.copyfileobj(response, output) +PY + +printf '%s %s\n' "$RUSTUP_INIT_SHA256" "$tmp_dir/rustup-init" | sha256sum --check --status || { + echo "rustup-init ${RUSTUP_VERSION} checksum mismatch" >&2 + exit 1 +} + +chmod 0755 "$tmp_dir/rustup-init" +"$tmp_dir/rustup-init" -y --no-modify-path \ + --default-host "$RUSTUP_TARGET" --default-toolchain none --profile minimal + +export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:$PATH" +if [[ -n "${GITHUB_PATH:-}" ]]; then + printf '%s\n' "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH" +fi +rustup set auto-self-update disable + +actual_version="$(rustup --version | awk 'NR == 1 { print $2 }')" +if [[ "$actual_version" != "$RUSTUP_VERSION" ]]; then + echo "expected rustup ${RUSTUP_VERSION}, got ${actual_version:-unknown}" >&2 + exit 1 +fi + +if (( $# > 0 )); then + "$@" +fi