Skip to content

Commit 0642472

Browse files
committed
Fix secrets file lookup for multi-Python matrix
Use modulo arithmetic to map job index to secrets file index, ensuring that adding Python versions to the matrix doesn't break the secrets file lookup. Each test pattern maps to the same secrets file regardless of Python version. The number of secrets files is determined dynamically from the extracted tarball.
1 parent 8d494ba commit 0642472

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ jobs:
133133
# See the "CI Setup" document for details of how this was set up.
134134
ci/decrypt_secret.sh
135135
tar xvf "${HOME}"/secrets/secrets.tar
136-
cp ./ci_secrets/vuforia_secrets_${{ strategy.job-index }}.env ./vuforia_secrets.env
136+
# Use modulo to map job index to secrets file index.
137+
# This ensures all Python versions for the same test pattern
138+
# use the same secrets file.
139+
NUM_SECRETS_FILES=$(find ./ci_secrets -name 'vuforia_secrets_*.env' | wc -l)
140+
SECRETS_INDEX=$(( ${{ strategy.job-index }} % NUM_SECRETS_FILES ))
141+
cp ./ci_secrets/vuforia_secrets_${SECRETS_INDEX}.env ./vuforia_secrets.env
137142
env:
138143
CI_PATTERN: ${{ matrix.ci_pattern }}
139144
ENCRYPTED_FILE: secrets.tar.gpg

0 commit comments

Comments
 (0)