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' }}
|
STRATA_KAR_PLE: ${{ inputs.hosted_cuda_ple && '1' || '0' }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "$STRATA_BUILD_DIR"
|
mkdir -p "$STRATA_BUILD_DIR"
|
||||||
docker run --rm --platform linux/amd64 --network bridge --read-only \
|
container="leleka-cuda-build-${GITHUB_RUN_ID}"
|
||||||
--user "$(id -u):$(id -g)" --cap-drop ALL --security-opt no-new-privileges \
|
volume="leleka-cuda-build-${GITHUB_RUN_ID}"
|
||||||
--tmpfs /tmp:rw,nosuid,size=2g \
|
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 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 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 BUILD_JOBS="$BUILD_JOBS" -e CUDA_ARCHITECTURES="$CUDA_ARCHITECTURES" \
|
||||||
-e STRATA_BUILD_DIR=/build \
|
-e STRATA_KAR_PLE="$STRATA_KAR_PLE" -e STRATA_BUILD_DIR=/work/build \
|
||||||
--mount "type=bind,src=$GITHUB_WORKSPACE,dst=/workspace,readonly" \
|
-e SOURCE_REVISION="$GITHUB_SHA" \
|
||||||
--mount "type=bind,src=$CUDAToolkit_ROOT,dst=/toolkit,readonly" \
|
"$container" /bin/bash -euo pipefail -c '
|
||||||
--mount "type=bind,src=$STRATA_BUILD_DIR,dst=/build" \
|
|
||||||
"$CUDA_BUILDER_IMAGE" /bin/bash -euo pipefail -c '
|
|
||||||
if compgen -G "/dev/nvidia*" >/dev/null; then
|
if compgen -G "/dev/nvidia*" >/dev/null; then
|
||||||
echo "NVIDIA devices unexpectedly visible in build container" >&2
|
echo "NVIDIA devices unexpectedly visible in build container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd /workspace
|
cd /work/workspace
|
||||||
scripts/build-static-cuda.sh
|
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
|
- name: Bind compile capability to CUDA toolchain provenance
|
||||||
run: |
|
run: |
|
||||||
python3 - <<'PYFEATURES'
|
python3 - <<'PYFEATURES'
|
||||||
@@ -272,6 +295,8 @@ jobs:
|
|||||||
linux-static-cli:
|
linux-static-cli:
|
||||||
needs: verify
|
needs: verify
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CARGO_TARGET_DIR: ${{ github.workspace }}/control-plane/target
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install musl toolchain
|
- name: Install musl toolchain
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ RUN apt-get update \
|
|||||||
RUN rustup target add "${RUST_TARGET}"
|
RUN rustup target add "${RUST_TARGET}"
|
||||||
|
|
||||||
WORKDIR /src
|
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 manifests/ ./manifests/
|
||||||
|
COPY desktop-core/ ./desktop-core/
|
||||||
COPY control-plane/ ./control-plane/
|
COPY control-plane/ ./control-plane/
|
||||||
COPY engine/strata/LICENSE ./engine/strata/LICENSE
|
COPY engine/strata/LICENSE ./engine/strata/LICENSE
|
||||||
RUN cargo build --manifest-path control-plane/Cargo.toml --locked --release \
|
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
|
- 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
|
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.
|
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
|
- Exact-head Gitea run `2703` (`712de0f6bc4f16686d52c3c98bed2643147178cc`)
|
||||||
job is still queued; this change is not validated until one exact-head Gitea
|
passed `verify` and the CPU gate; both keyless GPU jobs were skipped. The hosted
|
||||||
run proves the keyless job skipped and the hosted PLE package completes.
|
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
|
## 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 ;;
|
*) echo 'STRATA_KAR_PLE must be exactly 0 or 1.' >&2; exit 2 ;;
|
||||||
esac
|
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.
|
# CUDACXX/CUDAToolkit_ROOT select an existing toolkit; STRATA_GGML_DIR avoids fetching GGML.
|
||||||
cmake_args=(
|
cmake_args=(
|
||||||
-S "${repo_root}/engine/strata" -B "${build_dir}"
|
-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
|
# This records compile capability only. The runtime still requires an explicit
|
||||||
# model/profile selection; PLE is experimental and defaults off at serving time.
|
# 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 json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
repo, destination, ple, architectures = sys.argv[1:]
|
destination, ple, architectures, revision = 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')
|
|
||||||
record = {
|
record = {
|
||||||
'schema_version': 1,
|
'schema_version': 1,
|
||||||
'source_revision': revision,
|
'source_revision': revision,
|
||||||
|
|||||||
@@ -42,14 +42,17 @@ class StaticCudaProfileTests(unittest.TestCase):
|
|||||||
subprocess.run(['git', '-C', str(self.repo), '-c', 'user.email=fixture@example.invalid',
|
subprocess.run(['git', '-C', str(self.repo), '-c', 'user.email=fixture@example.invalid',
|
||||||
'-c', 'user.name=Fixture', 'commit', '-qm', 'mock toolchain fixture'], check=True)
|
'-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 = dict(os.environ)
|
||||||
env.update(PATH=f'{self.bin}{os.pathsep}{env["PATH"]}',
|
env.update(PATH=f'{self.bin}{os.pathsep}{env["PATH"]}',
|
||||||
STRATA_BUILD_DIR=str(self.build), CMAKE_CAPTURE=str(self.capture),
|
STRATA_BUILD_DIR=str(self.build), CMAKE_CAPTURE=str(self.capture),
|
||||||
CUDA_ARCHITECTURES='120')
|
CUDA_ARCHITECTURES='120')
|
||||||
env.pop('STRATA_KAR_PLE', None)
|
env.pop('STRATA_KAR_PLE', None)
|
||||||
|
env.pop('SOURCE_REVISION', None)
|
||||||
if value != 'unset':
|
if value != 'unset':
|
||||||
env['STRATA_KAR_PLE'] = value
|
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')],
|
return subprocess.run(['bash', str(self.repo / 'scripts/build-static-cuda.sh')],
|
||||||
env=env, text=True, capture_output=True)
|
env=env, text=True, capture_output=True)
|
||||||
|
|
||||||
@@ -98,6 +101,20 @@ class StaticCudaProfileTests(unittest.TestCase):
|
|||||||
self.assertIn('exactly 0 or 1', result.stderr)
|
self.assertIn('exactly 0 or 1', result.stderr)
|
||||||
self.assertFalse(self.capture.exists())
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user