CI: scratch directories per run, not per commit
The build runner takes two jobs at once, so the same commit pushed to two branches (main and a feature branch) ran its test job twice in parallel against one src-<sha> directory, and each run's clean-up deleted the other's source mid-test. Suffix the scratch directories (and activity-tracker's throwaway Postgres and network) with the run id. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -54,7 +54,9 @@ jobs:
|
||||
REMOTE: http://git.adam-french.co.uk:3000/adamf/usaco.git
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
CACHE: /home/adamf/.cache/usaco-ci/repo.git
|
||||
SRC: /home/adamf/.cache/usaco-ci/src-${{ github.sha }}
|
||||
# Per run, not just per commit: the build runner takes two jobs at
|
||||
# once, and the same commit pushed to two branches runs twice.
|
||||
SRC: /home/adamf/.cache/usaco-ci/src-${{ github.sha }}-${{ github.run_id }}
|
||||
steps:
|
||||
- name: Export the pushed commit's site/ to a scratch directory
|
||||
shell: bash
|
||||
@@ -117,7 +119,7 @@ jobs:
|
||||
env:
|
||||
SHA: ${{ github.sha }}
|
||||
CACHE: /home/adamf/.cache/usaco-ci/repo.git
|
||||
SRC: /home/adamf/.cache/usaco-ci/publish-${{ github.sha }}
|
||||
SRC: /home/adamf/.cache/usaco-ci/publish-${{ github.sha }}-${{ github.run_id }}
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
# The Dockerfile's `RUN --mount=type=cache` lines need BuildKit.
|
||||
@@ -148,7 +150,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
set -eu
|
||||
name="usaco-runner-ci-$SHA"
|
||||
name="usaco-runner-ci-$SHA-${{ github.run_id }}"
|
||||
docker run -d --name "$name" --read-only --tmpfs /tmp:size=256m,exec \
|
||||
--memory 1g --pids-limit 128 --cap-drop ALL --security-opt no-new-privileges \
|
||||
"$RUNNER_IMAGE:$SHA" >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user