Skip to content

Transient error in write-envdir #166

@victorlin

Description

@victorlin

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.

.github/bin/write-envdir

Lines 31 to 34 in faab911

if ! declare | grep -qE "^$name="; then
echo "error: $name is not set" >&2
exit 1
fi

Possible solutions

  1. 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.
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions