scripts/seed-validation-env.sh:41-46 discovers compose's required-variable
guards by grepping the raw file:
grep -oE '\$\{[A-Za-z_][A-Za-z0-9_]*:\?' "${STACK}/compose.yaml"
That reads YAML comments as well as YAML. Writing a comment in compose.yaml
that mentions the guard syntax — explaining what one does, for instance —
makes the script demand a throwaway value for a variable that does not exist,
and make validate fails with:
compose.yaml guards VAR, which the validation .env does not set.
Add a throwaway value for it to ./scripts/seed-validation-env.sh
Hit this for real while writing #62; the fix was to reword the comment, which is
the wrong way round — documentation should not have to avoid describing the
thing it documents.
The script is otherwise a good piece of work, and the check it performs is
worth keeping: it exists because CI and validate.sh once drifted and a new
guard passed locally and failed in CI.
Fix
Read the parsed structure rather than the text — docker compose config will
not resolve the guards, but python3 -c "import yaml; ..." over the raw file
gives values without comments, and check_compose_health.py already parses
compose.yaml with PyYAML, so the dependency is present.
Failing that, strip comment lines before grepping. Less correct, one line.
Found while verifying #12.
scripts/seed-validation-env.sh:41-46discovers compose's required-variableguards by grepping the raw file:
That reads YAML comments as well as YAML. Writing a comment in
compose.yamlthat mentions the guard syntax — explaining what one does, for instance —
makes the script demand a throwaway value for a variable that does not exist,
and
make validatefails with:Hit this for real while writing #62; the fix was to reword the comment, which is
the wrong way round — documentation should not have to avoid describing the
thing it documents.
The script is otherwise a good piece of work, and the check it performs is
worth keeping: it exists because CI and
validate.shonce drifted and a newguard passed locally and failed in CI.
Fix
Read the parsed structure rather than the text —
docker compose configwillnot resolve the guards, but
python3 -c "import yaml; ..."over the raw filegives values without comments, and
check_compose_health.pyalready parsescompose.yamlwith PyYAML, so the dependency is present.Failing that, strip comment lines before grepping. Less correct, one line.
Found while verifying #12.