Skip to content

Commit 9f2db71

Browse files
authored
Pass ssh-agent variables by default (#3572)
1 parent c28c4b1 commit 9f2db71

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

docs/changelog/3572.feature.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Pass ssh-agent variables ``SSH_AGENT_PID`` and ``SSH_AUTH_SOCK`` in ``pass_env`` by default.
2+
- by :user:`daniilgankov`

docs/config.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,14 @@ Base options
552552
- ✅
553553
- ✅
554554
- ✅
555+
* - SSH_AGENT_PID
556+
- ✅
557+
- ✅
558+
- ❌
559+
* - SSH_AUTH_SOCK
560+
- ✅
561+
- ✅
562+
- ❌
555563

556564
More environment variable-related information can be found in :ref:`environment variable substitutions`.
557565

src/tox/tox_env/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ def _default_pass_env(self) -> list[str]: # noqa: PLR6301
267267
"TMPDIR", # temporary file location
268268
"NIX_LD", # nix-ld loader
269269
"NIX_LD_LIBRARY_PATH", # nix-ld library path
270+
"SSH_AGENT_PID", # ssh-agent process ID
271+
"SSH_AUTH_SOCK", # ssh-agent socket path
270272
],
271273
)
272274
return env

tests/session/cmd/test_show_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
135135
+ (["PROGRAMDATA"] if is_win else [])
136136
+ (["PROGRAMFILES"] if is_win else [])
137137
+ (["PROGRAMFILES(x86)"] if is_win else [])
138-
+ ["PYTHON_GIL", "REQUESTS_CA_BUNDLE", "SSL_CERT_FILE"]
138+
+ ["PYTHON_GIL", "REQUESTS_CA_BUNDLE"]
139+
+ (["SSH_AGENT_PID", "SSH_AUTH_SOCK"] if not is_win else [])
140+
+ ["SSL_CERT_FILE"]
139141
+ (["SYSTEMDRIVE", "SYSTEMROOT", "TEMP"] if is_win else [])
140142
+ (["TERM"] if stdout_is_atty else [])
141143
+ (["TMP", "USERPROFILE"] if is_win else ["TMPDIR"])

0 commit comments

Comments
 (0)