Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENV variable dropped with COMPOSER_CONTAINER_RUN_AS_HOST_USER #46

Open
nbonnotte opened this issue Apr 18, 2024 · 3 comments · May be fixed by #48
Open

ENV variable dropped with COMPOSER_CONTAINER_RUN_AS_HOST_USER #46

nbonnotte opened this issue Apr 18, 2024 · 3 comments · May be fixed by #48

Comments

@nbonnotte
Copy link

I'm using the latest version (eacc17c)

In my variables.env I have

COMPOSER_CONTAINER_RUN_AS_HOST_USER=True
ENV=local
FOO=foo

Then the environment variables FOO is available to Airflow, but not ENV.

The variables are injected into the container:

$ docker exec -ti composer-local-dev-my-composer bash
airflow@ced4020ec909:~$ echo $FOO
foo
airflow@ced4020ec909:~$ echo $ENV
local

But the sudo -E (use in the entrypoint) drops the ENV variable.

Indeed, adding line sudo sudo -V in the entrypoint confirms this:

...
2024-04-18T14:57:18.251159989Z + sudo sudo -V
2024-04-18T14:57:18.251168450Z Running Airflow as user nicolas(1000)
2024-04-18T14:57:18.263092122Z Sudo version 1.8.31
...
2024-04-18T14:57:18.263487539Z Reset the environment to a default set of variables
2024-04-18T14:57:18.263495737Z Environment variables to check for sanity:
2024-04-18T14:57:18.263503981Z  TZ
2024-04-18T14:57:18.263512002Z  TERM
...
2024-04-18T14:57:18.263557707Z Environment variables to remove:
2024-04-18T14:57:18.263565589Z  *=()*
...
2024-04-18T14:57:18.263830321Z  BASH_ENV
2024-04-18T14:57:18.263837391Z  ENV
...
2024-04-18T14:57:18.263941930Z Environment variables to preserve:
...
@ahidalgob
Copy link
Member

Hi, can you explain why is it important to keep the ENV variable? Thank you!

@nbonnotte
Copy link
Author

ENV is not a reserved environment variable. The composer-local-dev documentation does not include a caveat saying the tool can't handle it either. So it looks like a bug to me...

@nbonnotte
Copy link
Author

Note that we have the same issue with PYTHONPATH, see #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants