Description
Error from scheduled CI run:
mkdir: created directory '.git/nextstrain/env.d'
Wrote .git/nextstrain/env.d/AWS_ACCESS_KEY_ID
Wrote .git/nextstrain/env.d/AWS_SECRET_ACCESS_KEY
.git/nextstrain/.github/bin/write-envdir: line 31: declare: write error: Broken pipe
error: AWS_DEFAULT_REGION is not set
This appears to be transient due to the condition below, because grep can exit with a match before declare finishes writing.
|
if ! declare | grep -qE "^$name="; then |
|
echo "error: $name is not set" >&2 |
|
exit 1 |
|
fi |
Possible solutions
- Use
[ -z "${!name+x}" ] to check absence.
- This doesn't suffer from the issue of treating declared-but-empty-string-valued variables as unset, but is a more obscure syntax than the current code or option 2.
- Use
! [[ -v $name ]] to check absence.
- This means dropping support for ancient Bash on macOS, requiring macOS developers to install a newer Bash (e.g. from Homebrew), and updating the shebang to
#!/usr/bin/env bash.
Description
Error from scheduled CI run:
This appears to be transient due to the condition below, because
grepcan exit with a match beforedeclarefinishes writing..github/bin/write-envdir
Lines 31 to 34 in faab911
Possible solutions
[ -z "${!name+x}" ]to check absence.! [[ -v $name ]]to check absence.#!/usr/bin/env bash.