Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to stop csub from silently ignoring additional .env variables by ensuring the container runtime environment includes the full .env contents (not just a fixed subset).
Changes:
- Build
literal_envby merging the full parsed.envdict with runtime overrides (HOME,NB_UID, etc.). - Adjust how environment flags are added to the generated
runai submitcommand.
Comments suppressed due to low confidence (1)
csub.py:120
literal_envis now built asenv | {...}, which pulls in all keys from the.envfile, including secret values (e.g.,WANDB_API_KEY,HF_TOKEN,GITHUB_TOKEN, etc.). If these are passed through--environment KEY=value, the secret values will end up in the generated command line / logs instead of being sourced from the Kubernetes secret. Consider filtering secret keys out of the dict passed toadd_env_flags, and continue injecting secrets viaadd_secret_env_flags(usingEXTRA_SECRET_KEYSto extend the secret key set).
literal_env = env | {
"HOME": f"/home/{env['LDAP_USERNAME']}",
"NB_USER": env["LDAP_USERNAME"],
"NB_UID": run_uid,
"NB_GROUP": env["LDAP_GROUPNAME"],
"NB_GID": run_gid,
"WORKING_DIR": working_dir,
"SCRATCH_HOME": scratch_home,
"SCRATCH_HOME_ROOT": scratch_root,
"EPFML_LDAP": env["LDAP_USERNAME"],
"HF_HOME": hf_home,
"UV_PYTHON_VERSION": env.get("UV_PYTHON_VERSION", "3.11"),
"TZ": env.get("TZ", "Europe/Zurich"),
# Keep runtime shell and tool caches available when using `runai exec`
"GIT_CONFIG_GLOBAL": f"{scratch_home}/.gitconfig",
"UV_CACHE_DIR": f"{scratch_home}/.cache/uv",
"UV_PYTHON_INSTALL_DIR": f"{scratch_home}/.uv",
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Before, csub was just ignoring extra env from .env file, which is unexpected and leads to bugs