From f3d197dc9bf1f0b88a1fa00fe0b1f29ab0a843a0 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Sun, 8 Dec 2024 11:12:46 +0100 Subject: [PATCH] Update to use GIT_SSH_COMMAND --- docker/deployer_docker/webhook/gitea-webhook-handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/deployer_docker/webhook/gitea-webhook-handler.py b/docker/deployer_docker/webhook/gitea-webhook-handler.py index b1168fe..2def9c8 100644 --- a/docker/deployer_docker/webhook/gitea-webhook-handler.py +++ b/docker/deployer_docker/webhook/gitea-webhook-handler.py @@ -19,10 +19,13 @@ API_PASSWORD = os.environ['API_PASSWORD'] DATA_DIR = os.environ['DATA_DIR'] GIT_AUTH_MODE = os.environ['GIT_AUTH_MODE'] +GIT_ENV = os.environ.copy() + if GIT_AUTH_MODE == 'http': auth_option = [] elif GIT_AUTH_MODE == 'ssh': - auth_option = ['--config','core.sshCommand="ssh -i /ssh/ssh-key"','-o','StrictHostKeyChecking=accept-new'] + GIT_ENV["GIT_SSH_COMMAND"] = "ssh -i /ssh/ssh-key" + auth_option=['-o','StrictHostKeyChecking=accept-new'] else: raise ValueError("Invalid GIT_AUTH_MODE") @@ -127,6 +130,7 @@ def execute_git_pull(repo_path): ['git', 'pull'] + auth_option, cwd=repo_path, capture_output=True, + env=GIT_ENV, text=True, timeout=300 # 5-minute timeout )