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
|
REMOTE: http://git.adam-french.co.uk:3000/adamf/usaco.git
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
CACHE: /home/adamf/.cache/usaco-ci/repo.git
|
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:
|
steps:
|
||||||
- name: Export the pushed commit's site/ to a scratch directory
|
- name: Export the pushed commit's site/ to a scratch directory
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -117,7 +119,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
SHA: ${{ github.sha }}
|
SHA: ${{ github.sha }}
|
||||||
CACHE: /home/adamf/.cache/usaco-ci/repo.git
|
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_USER: ${{ secrets.REGISTRY_USER }}
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
# The Dockerfile's `RUN --mount=type=cache` lines need BuildKit.
|
# The Dockerfile's `RUN --mount=type=cache` lines need BuildKit.
|
||||||
@@ -148,7 +150,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
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 \
|
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 \
|
--memory 1g --pids-limit 128 --cap-drop ALL --security-opt no-new-privileges \
|
||||||
"$RUNNER_IMAGE:$SHA" >/dev/null
|
"$RUNNER_IMAGE:$SHA" >/dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user