opensafely-core / backend-server

Infrastructure code for managing partner hosted OpenSAFELY backend servers.
0 stars 2 forks source link

Fix test config to pass on 22.04 #243

Closed bloodearnest closed 2 months ago

bloodearnest commented 2 months ago

We define AIRLOCK_API_TOKEN=$JOB_SERVER_TOKEN in 02_secrets.env, which works fine when JOB_SERVER_TOKEN is defined beforehand. But the tests/config.env gets added to 04_local.env, which sets JOB_SERVER_TOKEN to a test value later on.

For some reason, in 20.04, this was no problem, and AIRLOCK_API_TOKEN was set to the right test value. But in 22.04, docker-compose ends up not setting AIRLOCK_API_TOKEN from the 04_secret.env values.

I am not sure why, but possibly some difference means that docker-compose loads envfiles differently, but this is more strict so is not a bad thing.

madwort commented 2 months ago

huh, weird, I'm sure I tried to do that (setting an env var based on another var) some time ago & couldn't get it to work at all.

madwort commented 2 months ago

actually, my guess is that env files can interpolate from vars set in the shell environment but not from vars set in other env files. finding this in the docker docs is left as an exercise to the reader...

bloodearnest commented 2 months ago

actually, my guess is that env files can interpolate from vars set in the shell environment but not from vars set in other env files. finding this in the docker docs is left as an exercise to the reader...

Huh, yeah, that's probably it