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
Support for overriding variables inside the container at runtime #424
Conversation
e.g. CONTAINER_LD_LIBRARY_PATH -> LD_LIBRARY_PATH inside the container apptainer#411
Prefix is configurable via SINGULARITY_ENV_PREFIX and defaults to _SENV e.g. _SENV_LD_LIBRARY_PATH=/some/path -> LD_LIBRARY_PATH=/some/path
Hi @jtriley, just wanted to check to see if this is ready for a review. Thanks! |
@gmkurtzer yup this is ready, thanks! |
...removes the strstr call but requires caller to make sure prefix ends with '_' if desired.
@gmkurtzer I reworked this using strcmp and strtok_r as discussed. Ready for a review. |
Any progress on this? Incl. ETA for a released version with this included? |
@jtriley Can you take a look at the lib-refactor branch and rebase to that? It is gonna be a bit messy I know as things will have to move, but I would prefer you get these changes into that rather then have me respin this into that branch. Check out https://github.com/singularityware/singularity/blob/lib-refactor/src/lib/runtime/environment/environment.c for a starting point, and you should see I used your code as a template. Let me know if you have any questions, thanks! |
@gmkurtzer will do |
This has been implemented in the development branch by using the environment variable syntax |
Fixes #411
This allows users to explicitly override environment variables within the container via
SENV_
prefixed environment variables. This prefix gets stripped and the result gets set within the containers's environment. This is especially useful for proxying unsecure variables stripped by ld for suid/sgid executables to the container:singularity_env_override
method tosrc/lib/action/action.c
called bysingularity_action_init
that looks for env variables that start with prefix, strips the prefix, and sets the resulting key/value inside the container.@singularityware-admin