Skip to content

[runner] Rework env variables exporting #2535

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

Merged
merged 1 commit into from
Apr 21, 2025
Merged

Conversation

un-def
Copy link
Collaborator

@un-def un-def commented Apr 18, 2025

Replace ~/.ssh/environment (processed by OpenSSH) with a shell script exporting env variables. The shell script is sourced in /etc/profile, which is only executed by login shell.

Advantages:

  • multi-line variables support (e.g, DSTACK_NODES_IPS)
  • no hard limit of 1000 variables
  • shared by all users
  • vars are not redefined by pam_env (/etc/environment)
  • it's unlikely that /tmp/dstack_profile and /etc/profile are located on a volume, unlike ~/.ssh; no need for cleanup

Tested supported shells:

  • dash (Debian and derivatives, BusyBox distros, e.g., Alpine)
  • bash as sh (Fedora and downstream distros)
  • bash (almost every distro)

Not supported shells (do not use /etc/profile):

  • zsh
  • fish

Fixes: #2371

Replace `~/.ssh/environment` (processed by OpenSSH) with a shell script
exporting env variables. The shell script is sourced in `/etc/profile`,
which is only executed by login shell.

Advantages:

* multi-line variables support (e.g, `DSTACK_NODES_IPS`)
* no hard limit of 1000 variables
* shared by all users
* vars are not redefined by `pam_env` (`/etc/environment`)
* it's unlikely that `/tmp/dstack_profile` and `/etc/profile`
  are located on a volume, unlike `~/.ssh`; no need for cleanup

Tested supported shells:

* dash (Debian and derivatives, BusyBox distros, e.g., Alpine)
* bash as sh (Fedora and downstream distros)
* bash (almost every distro)

Not supported shells (do not use `/etc/profile`):

* zsh
* fish

Fixes: #2371
@un-def un-def requested a review from r4victor April 18, 2025 15:19
@un-def un-def merged commit b23fae8 into master Apr 21, 2025
24 checks passed
@un-def un-def deleted the 2371_rework_runner_env_vars branch April 21, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Can not log into dev environment when ~/.ssh/environment file becomes too large
2 participants