Skip to content

Commit 45acbba

Browse files
committed
CI: fail when the ephy_testing_data HEAD hash cannot be resolved
The hash step wrote `dataset_hash=$(git ls-remote ... | cut -f1)` with echo, so its exit status was the one of echo. When git ls-remote failed against gin (HTTP 403, connection failure), the step stayed green, wrote an empty dataset_hash and the cache key degraded to `Linux-datasets-`. Enable pipefail, test both the assignment and the emptiness of the result, emit an ::error:: annotation and exit 1. The step id and names are unchanged, so steps.ephy_testing_data.outputs.dataset_hash still resolves. See #1896.
1 parent ba57b73 commit 45acbba

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎.github/workflows/caches_cron_job.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ jobs:
7070
- name: Get current hash (SHA) of the ephy_testing_data repo
7171
id: ephy_testing_data
7272
run: |
73-
echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT
73+
set -o pipefail
74+
if ! hash="$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" || [ -z "$hash" ]; then
75+
echo "::error::could not resolve ephy_testing_data HEAD on gin; refusing to build a degenerate cache key"
76+
exit 1
77+
fi
78+
echo "dataset_hash=$hash" >> "$GITHUB_OUTPUT"
7479
7580
- uses: actions/cache@v3
7681
# Loading cache of ephys_testing_dataset

‎.github/workflows/io-test.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ jobs:
4242
# the key depend on the last commit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
4343
id: ephy_testing_data
4444
run: |
45-
echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT
45+
set -o pipefail
46+
if ! hash="$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" || [ -z "$hash" ]; then
47+
echo "::error::could not resolve ephy_testing_data HEAD on gin; refusing to build a degenerate cache key"
48+
exit 1
49+
fi
50+
echo "dataset_hash=$hash" >> "$GITHUB_OUTPUT"
4651
4752
- uses: actions/cache/restore@v4
4853
# Loading cache of ephys_testing_dataset

‎.github/workflows/plexon2-testing.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ jobs:
3333
# the key depend on the last commit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
3434
id: ephy_testing_data
3535
run: |
36-
echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT
36+
set -o pipefail
37+
if ! hash="$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" || [ -z "$hash" ]; then
38+
echo "::error::could not resolve ephy_testing_data HEAD on gin; refusing to build a degenerate cache key"
39+
exit 1
40+
fi
41+
echo "dataset_hash=$hash" >> "$GITHUB_OUTPUT"
3742
3843
- uses: actions/cache/restore@v4
3944
# Loading cache of ephys_testing_dataset

0 commit comments

Comments
 (0)