fix(ci): stage CUDA source inside GPU-hidden build container
This commit is contained in:
+36
-11
@@ -188,25 +188,48 @@ jobs:
|
||||
STRATA_KAR_PLE: ${{ inputs.hosted_cuda_ple && '1' || '0' }}
|
||||
run: |
|
||||
mkdir -p "$STRATA_BUILD_DIR"
|
||||
docker run --rm --platform linux/amd64 --network bridge --read-only \
|
||||
--user "$(id -u):$(id -g)" --cap-drop ALL --security-opt no-new-privileges \
|
||||
--tmpfs /tmp:rw,nosuid,size=2g \
|
||||
container="leleka-cuda-build-${GITHUB_RUN_ID}"
|
||||
volume="leleka-cuda-build-${GITHUB_RUN_ID}"
|
||||
source_archive="$RUNNER_TEMP/strata-cuda-source.tar"
|
||||
cleanup() {
|
||||
docker rm -f "$container" >/dev/null 2>&1 || true
|
||||
docker volume rm "$volume" >/dev/null 2>&1 || true
|
||||
rm -f -- "$source_archive"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
git -C "$GITHUB_WORKSPACE" archive --format=tar "$GITHUB_SHA" > "$source_archive"
|
||||
docker volume create "$volume" >/dev/null
|
||||
docker create --name "$container" --platform linux/amd64 --network bridge --read-only \
|
||||
--cap-drop ALL --security-opt no-new-privileges \
|
||||
--tmpfs /tmp:rw,nosuid,size=2g --mount "type=volume,src=$volume,dst=/work" \
|
||||
-e CUDA_VISIBLE_DEVICES= -e NVIDIA_VISIBLE_DEVICES=void \
|
||||
-e CUDACXX=/toolkit/bin/nvcc -e CUDAToolkit_ROOT=/toolkit \
|
||||
"$CUDA_BUILDER_IMAGE" /bin/bash -euc 'sleep infinity' >/dev/null
|
||||
docker start "$container" >/dev/null
|
||||
docker exec "$container" mkdir -p /work/workspace /work/toolkit /work/build
|
||||
docker exec "$container" chmod 0777 /work/build
|
||||
# Stage tracked source only. docker cp streams the archive from the
|
||||
# runner container; bind mounts cannot use its path on the daemon host.
|
||||
docker cp "$source_archive" "$container:/work/source.tar"
|
||||
docker exec "$container" tar -xf /work/source.tar -C /work/workspace
|
||||
docker exec "$container" rm /work/source.tar
|
||||
docker cp "$CUDAToolkit_ROOT/." "$container:/work/toolkit/"
|
||||
docker exec --user "$(id -u):$(id -g)" \
|
||||
-e CUDA_VISIBLE_DEVICES= -e NVIDIA_VISIBLE_DEVICES=void \
|
||||
-e CUDACXX=/work/toolkit/bin/nvcc -e CUDAToolkit_ROOT=/work/toolkit \
|
||||
-e CC=/usr/bin/gcc-13 -e CXX=/usr/bin/g++-13 -e CUDAHOSTCXX=/usr/bin/g++-13 \
|
||||
-e BUILD_JOBS=1 -e CUDA_ARCHITECTURES -e STRATA_KAR_PLE \
|
||||
-e STRATA_BUILD_DIR=/build \
|
||||
--mount "type=bind,src=$GITHUB_WORKSPACE,dst=/workspace,readonly" \
|
||||
--mount "type=bind,src=$CUDAToolkit_ROOT,dst=/toolkit,readonly" \
|
||||
--mount "type=bind,src=$STRATA_BUILD_DIR,dst=/build" \
|
||||
"$CUDA_BUILDER_IMAGE" /bin/bash -euo pipefail -c '
|
||||
-e BUILD_JOBS="$BUILD_JOBS" -e CUDA_ARCHITECTURES="$CUDA_ARCHITECTURES" \
|
||||
-e STRATA_KAR_PLE="$STRATA_KAR_PLE" -e STRATA_BUILD_DIR=/work/build \
|
||||
-e SOURCE_REVISION="$GITHUB_SHA" \
|
||||
"$container" /bin/bash -euo pipefail -c '
|
||||
if compgen -G "/dev/nvidia*" >/dev/null; then
|
||||
echo "NVIDIA devices unexpectedly visible in build container" >&2
|
||||
exit 1
|
||||
fi
|
||||
cd /workspace
|
||||
cd /work/workspace
|
||||
scripts/build-static-cuda.sh
|
||||
'
|
||||
docker cp "$container:/work/build/strata" "$STRATA_BUILD_DIR/strata"
|
||||
docker cp "$container:/work/build/BUILD-FEATURES.json" "$STRATA_BUILD_DIR/BUILD-FEATURES.json"
|
||||
- name: Bind compile capability to CUDA toolchain provenance
|
||||
run: |
|
||||
python3 - <<'PYFEATURES'
|
||||
@@ -272,6 +295,8 @@ jobs:
|
||||
linux-static-cli:
|
||||
needs: verify
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CARGO_TARGET_DIR: ${{ github.workspace }}/control-plane/target
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install musl toolchain
|
||||
|
||||
@@ -7,8 +7,11 @@ RUN apt-get update \
|
||||
RUN rustup target add "${RUST_TARGET}"
|
||||
|
||||
WORKDIR /src
|
||||
COPY rust-toolchain.toml ./
|
||||
ENV CARGO_TARGET_DIR=/src/control-plane/target
|
||||
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
|
||||
COPY crates/ ./crates/
|
||||
COPY manifests/ ./manifests/
|
||||
COPY desktop-core/ ./desktop-core/
|
||||
COPY control-plane/ ./control-plane/
|
||||
COPY engine/strata/LICENSE ./engine/strata/LICENSE
|
||||
RUN cargo build --manifest-path control-plane/Cargo.toml --locked --release \
|
||||
|
||||
@@ -14,9 +14,18 @@
|
||||
- The manual keyless-GPU path is now preceded by a CPU-side input gate and depends
|
||||
on `verify`; a false selection must be resolved as skipped before any GPU runner
|
||||
is eligible. This gate does not execute GPU checks or imply GPU availability.
|
||||
- Run `2700` itself remains a failed historical run, and its unmatched keyless
|
||||
job is still queued; this change is not validated until one exact-head Gitea
|
||||
run proves the keyless job skipped and the hosted PLE package completes.
|
||||
- Exact-head Gitea run `2703` (`712de0f6bc4f16686d52c3c98bed2643147178cc`)
|
||||
passed `verify` and the CPU gate; both keyless GPU jobs were skipped. The hosted
|
||||
PLE job exposed that the Docker daemon cannot bind-mount the runner container's
|
||||
`$GITHUB_WORKSPACE`; the build now streams a tracked-source archive into a
|
||||
private Docker volume and supplies the exact source SHA as provenance. The same
|
||||
run found the static CLI target path mismatch and an incomplete scratch-image
|
||||
workspace (missing the root lockfile and local tokenizer workspace crate); the
|
||||
workflow and Dockerfile now use one explicit target directory and include the
|
||||
complete Cargo workspace manifests/sources.
|
||||
- Run `2703` produced no hosted package artifact. The new fixes require one fresh
|
||||
exact-head Gitea run; no GPU inference, model-quality or rollback claim follows
|
||||
from these CPU/build checks.
|
||||
|
||||
## 2026-10-03 — experimental PLE quality arm
|
||||
|
||||
|
||||
@@ -17,6 +17,16 @@ case "${kar_ple}" in
|
||||
*) echo 'STRATA_KAR_PLE must be exactly 0 or 1.' >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
if [[ ${SOURCE_REVISION+x} ]]; then
|
||||
source_revision="${SOURCE_REVISION}"
|
||||
else
|
||||
source_revision="$(git -C "${repo_root}" rev-parse HEAD)"
|
||||
fi
|
||||
if [[ ! "${source_revision}" =~ ^[0-9a-f]{40}$ ]]; then
|
||||
echo 'SOURCE_REVISION must be an exact lowercase 40-character Git commit.' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# CUDACXX/CUDAToolkit_ROOT select an existing toolkit; STRATA_GGML_DIR avoids fetching GGML.
|
||||
cmake_args=(
|
||||
-S "${repo_root}/engine/strata" -B "${build_dir}"
|
||||
@@ -40,18 +50,14 @@ env -u LD_LIBRARY_PATH CUDA_VISIBLE_DEVICES= "${build_dir}/strata" --help
|
||||
|
||||
# This records compile capability only. The runtime still requires an explicit
|
||||
# model/profile selection; PLE is experimental and defaults off at serving time.
|
||||
python3 - "${repo_root}" "${build_dir}/BUILD-FEATURES.json" "${kar_ple}" "${CUDA_ARCHITECTURES:-120}" <<'PYFEATURES'
|
||||
python3 - "${build_dir}/BUILD-FEATURES.json" "${kar_ple}" "${CUDA_ARCHITECTURES:-120}" "${source_revision}" <<'PYFEATURES'
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
repo, destination, ple, architectures = sys.argv[1:]
|
||||
revision = subprocess.check_output(['git', '-C', repo, 'rev-parse', 'HEAD'], text=True).strip()
|
||||
if len(revision) != 40 or any(ch not in '0123456789abcdef' for ch in revision):
|
||||
raise SystemExit('could not record an exact source revision')
|
||||
destination, ple, architectures, revision = sys.argv[1:]
|
||||
record = {
|
||||
'schema_version': 1,
|
||||
'source_revision': revision,
|
||||
|
||||
@@ -42,14 +42,17 @@ class StaticCudaProfileTests(unittest.TestCase):
|
||||
subprocess.run(['git', '-C', str(self.repo), '-c', 'user.email=fixture@example.invalid',
|
||||
'-c', 'user.name=Fixture', 'commit', '-qm', 'mock toolchain fixture'], check=True)
|
||||
|
||||
def run_profile(self, value='unset'):
|
||||
def run_profile(self, value='unset', source_revision=None):
|
||||
env = dict(os.environ)
|
||||
env.update(PATH=f'{self.bin}{os.pathsep}{env["PATH"]}',
|
||||
STRATA_BUILD_DIR=str(self.build), CMAKE_CAPTURE=str(self.capture),
|
||||
CUDA_ARCHITECTURES='120')
|
||||
env.pop('STRATA_KAR_PLE', None)
|
||||
env.pop('SOURCE_REVISION', None)
|
||||
if value != 'unset':
|
||||
env['STRATA_KAR_PLE'] = value
|
||||
if source_revision is not None:
|
||||
env['SOURCE_REVISION'] = source_revision
|
||||
return subprocess.run(['bash', str(self.repo / 'scripts/build-static-cuda.sh')],
|
||||
env=env, text=True, capture_output=True)
|
||||
|
||||
@@ -98,6 +101,20 @@ class StaticCudaProfileTests(unittest.TestCase):
|
||||
self.assertIn('exactly 0 or 1', result.stderr)
|
||||
self.assertFalse(self.capture.exists())
|
||||
|
||||
def test_archive_checkout_records_explicit_exact_source_revision(self):
|
||||
revision = 'a1' * 20
|
||||
(self.repo / '.git').rename(self.repo / '.git-hidden')
|
||||
result = self.run_profile('1', source_revision=revision)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
features = json.loads((self.build / 'BUILD-FEATURES.json').read_text())
|
||||
self.assertEqual(features['source_revision'], revision)
|
||||
|
||||
def test_invalid_source_revision_fails_before_cmake(self):
|
||||
result = self.run_profile('1', source_revision='not-a-commit')
|
||||
self.assertEqual(result.returncode, 2)
|
||||
self.assertIn('SOURCE_REVISION must be an exact lowercase 40-character Git commit', result.stderr)
|
||||
self.assertFalse(self.capture.exists())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user