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 )