From 8c19d8244718672633a203a79fee5ef1b34ec4be Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Wed, 7 Oct 2026 13:59:51 +0200 Subject: [PATCH] fix(ci): use pinned GPU-hidden job container --- .gitea/workflows/kar-cuda-compile.yml | 68 ++++++++++++--------------- scripts/test-kar-cuda-build-lock.py | 10 +++- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.gitea/workflows/kar-cuda-compile.yml b/.gitea/workflows/kar-cuda-compile.yml index 8e9720fc..18d00d88 100644 --- a/.gitea/workflows/kar-cuda-compile.yml +++ b/.gitea/workflows/kar-cuda-compile.yml @@ -1,17 +1,6 @@ name: KAR CUDA compile (GPU hidden) on: - push: - paths: - - 'gpu/kar/**' - - 'engine/strata/CMakeLists.txt' - - 'scripts/bootstrap-cuda-toolkit.py' - - 'scripts/build-static-cuda.sh' - - 'scripts/test-kar-expert-cache.sh' - - 'scripts/test-kar-cuda-build-lock.py' - - 'deploy/cuda-toolkit.lock.json' - - 'deploy/kar-cuda-build.lock.json' - - '.gitea/workflows/kar-cuda-compile.yml' pull_request: paths: - 'gpu/kar/**' @@ -31,37 +20,40 @@ jobs: kar-cuda-compile: runs-on: ubuntu-latest timeout-minutes: 150 + container: + image: ubuntu@sha256:88a381d5b5eeb2b35d3ad70925a362c37ce569daf43ede89ff818ec20e4d3794 + options: --platform linux/amd64 + env: + NVIDIA_VISIBLE_DEVICES: void + CUDA_VISIBLE_DEVICES: '' steps: - uses: https://git.vezha.io/actions/checkout@v4 - - name: Build lock check + - name: Compile CUDA component in pinned GPU-hidden container shell: bash run: | set -euo pipefail python3 scripts/test-kar-cuda-build-lock.py - - - name: Compile CUDA component in GPU-hidden Docker - shell: bash - run: | - set -euo pipefail - base="$(python3 -c 'import json; print(json.load(open("deploy/kar-cuda-build.lock.json"))["builder_image"])')" - packages="$(python3 -c 'import json; p=json.load(open("deploy/kar-cuda-build.lock.json"))["apt_packages"]; print(" ".join(f"{k}={v}" for k,v in p.items()))')" - docker run --rm --platform linux/amd64 --network bridge \ - -e NVIDIA_VISIBLE_DEVICES=void -e CUDA_VISIBLE_DEVICES= \ - -e LOCKED_PACKAGES="$packages" \ - -v "$GITHUB_WORKSPACE:/work" -w /work "$base" \ - bash -euxo pipefail -c ' - apt-get update -qq - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $LOCKED_PACKAGES - dpkg-query -W -f="${Package}=${Version}\n" ca-certificates cmake gcc-13 g++-13 make python3 - python3 scripts/test-kar-cuda-build-lock.py - CXX=g++-13 scripts/test-kar-expert-cache.sh - python3 scripts/bootstrap-cuda-toolkit.py --output /tmp/cuda-toolkit - export CUDACXX=/tmp/cuda-toolkit/bin/nvcc - export CUDAToolkit_ROOT=/tmp/cuda-toolkit - export CC=gcc-13 CXX=g++-13 - cmake -S gpu/kar -B /tmp/kar-build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=120 - cmake --build /tmp/kar-build --parallel 1 --target strata-kar-expert-cache-test strata-kar-expert-test strata-kar-expert-miss-test strata-kar-expert-probe - ctest --test-dir /tmp/kar-build --output-on-failure -R "^kar_expert_cache_index$" - test -z "$(nvidia-smi 2>/dev/null || true)" || { echo "unexpected GPU visible in compile container" >&2; exit 1; } - ' + test "$NVIDIA_VISIBLE_DEVICES" = void + test -z "$CUDA_VISIBLE_DEVICES" + if compgen -G '/dev/nvidia*' >/dev/null; then + echo 'unexpected NVIDIA device mounted in CUDA compile job' >&2 + exit 1 + fi + apt-get update -qq + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + ca-certificates=20260601~26.04.1 \ + cmake=4.2.3-2ubuntu2 \ + gcc-13=13.4.0-10ubuntu1 \ + g++-13=13.4.0-10ubuntu1 \ + make=4.4.1-3 \ + python3=3.14.3-0ubuntu2 + dpkg-query -W -f='${Package}=${Version}\n' ca-certificates cmake gcc-13 g++-13 make python3 + CXX=g++-13 scripts/test-kar-expert-cache.sh + python3 scripts/bootstrap-cuda-toolkit.py --output /tmp/cuda-toolkit + export CUDACXX=/tmp/cuda-toolkit/bin/nvcc + export CUDAToolkit_ROOT=/tmp/cuda-toolkit + export CC=gcc-13 CXX=g++-13 + cmake -S gpu/kar -B /tmp/kar-build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=120 + cmake --build /tmp/kar-build --parallel 1 --target strata-kar-expert-cache-test strata-kar-expert-test strata-kar-expert-miss-test strata-kar-expert-probe + ctest --test-dir /tmp/kar-build --output-on-failure -R "^kar_expert_cache_index$" diff --git a/scripts/test-kar-cuda-build-lock.py b/scripts/test-kar-cuda-build-lock.py index a912decc..e7479343 100644 --- a/scripts/test-kar-cuda-build-lock.py +++ b/scripts/test-kar-cuda-build-lock.py @@ -16,4 +16,12 @@ assert toolkit['release']==lock['cuda_toolkit_release'] required={'ca-certificates','cmake','gcc-13','g++-13','make','python3'} assert set(lock['apt_packages'])==required assert all(re.fullmatch(r'[0-9][A-Za-z0-9.+:~_-]*',v) for v in lock['apt_packages'].values()) -print('PASS: pinned CUDA 13.0.1 Linux build image, compiler, CMake and base packages') +workflow=(ROOT/'.gitea/workflows/kar-cuda-compile.yml').read_text() +assert f"image: {lock['builder_image']}" in workflow +assert 'pull_request:' in workflow and '\n push:' not in workflow +assert 'NVIDIA_VISIBLE_DEVICES: void' in workflow +assert "CUDA_VISIBLE_DEVICES: ''" in workflow +assert 'docker run' not in workflow +for name,version in lock['apt_packages'].items(): + assert f'{name}={version}' in workflow +print('PASS: pinned CUDA 13.0.1 GPU-hidden Gitea container and direct packages')