diff --git a/.gitea/workflows/kar-cuda-compile.yml b/.gitea/workflows/kar-cuda-compile.yml index 6f8f36e0..f19663ae 100644 --- a/.gitea/workflows/kar-cuda-compile.yml +++ b/.gitea/workflows/kar-cuda-compile.yml @@ -26,7 +26,31 @@ jobs: NVIDIA_VISIBLE_DEVICES: void CUDA_VISIBLE_DEVICES: '' steps: - - uses: builtin:checkout + - name: Install pinned Git for private checkout + shell: bash + run: | + set -euo pipefail + apt-get update -qq + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + ca-certificates=20260601~26.04.1 \ + git=1:2.53.0-1ubuntu1 + + - name: Checkout exact pull-request head + shell: bash + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + set -euo pipefail + : "${GITEA_TOKEN:?missing read-only GITEA_TOKEN}" + git init -q + git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" + GIT_CONFIG_COUNT=1 \ + GIT_CONFIG_KEY_0=http.extraheader \ + GIT_CONFIG_VALUE_0="Authorization: token ${GITEA_TOKEN}" \ + git fetch --depth=1 origin "$GITHUB_REF" + git checkout --detach FETCH_HEAD + test "$(git rev-parse HEAD)" = "$GITHUB_SHA" + unset GITEA_TOKEN - name: Compile CUDA component in pinned GPU-hidden container shell: bash @@ -48,7 +72,7 @@ jobs: 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 + dpkg-query -W -f='${Package}=${Version}\n' ca-certificates cmake gcc-13 g++-13 git 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 diff --git a/deploy/kar-cuda-build.lock.json b/deploy/kar-cuda-build.lock.json index ebcc7d8a..1f6e12fb 100644 --- a/deploy/kar-cuda-build.lock.json +++ b/deploy/kar-cuda-build.lock.json @@ -7,6 +7,7 @@ "cmake": "4.2.3-2ubuntu2", "gcc-13": "13.4.0-10ubuntu1", "g++-13": "13.4.0-10ubuntu1", + "git": "1:2.53.0-1ubuntu1", "make": "4.4.1-3", "python3": "3.14.3-0ubuntu2" }, diff --git a/scripts/test-kar-cuda-build-lock.py b/scripts/test-kar-cuda-build-lock.py index 19cb1379..65b1bb43 100644 --- a/scripts/test-kar-cuda-build-lock.py +++ b/scripts/test-kar-cuda-build-lock.py @@ -13,7 +13,7 @@ assert lock['cuda_architecture']=='120' and lock['compile_jobs']==1 assert lock['cuda_toolkit_lock']=='cuda-toolkit.lock.json' toolkit=json.loads((ROOT/'deploy'/lock['cuda_toolkit_lock']).read_text()) assert toolkit['release']==lock['cuda_toolkit_release'] -required={'ca-certificates','cmake','gcc-13','g++-13','make','python3'} +required={'ca-certificates','cmake','gcc-13','g++-13','git','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()) workflow=(ROOT/'.gitea/workflows/kar-cuda-compile.yml').read_text() @@ -23,7 +23,9 @@ assert 'options: --platform' not in workflow assert 'NVIDIA_VISIBLE_DEVICES: void' in workflow assert "CUDA_VISIBLE_DEVICES: ''" in workflow assert 'docker run' not in workflow -assert 'uses: builtin:checkout' in workflow +assert 'git fetch --depth=1 origin "$GITHUB_REF"' in workflow +assert 'GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}' in workflow +assert 'uses: builtin:checkout' not in workflow assert 'actions/checkout@' not in workflow for name,version in lock['apt_packages'].items(): assert f'{name}={version}' in workflow