This commit is contained in:
IGNY8 VPS (Salman)
2025-11-10 11:35:30 +00:00
parent 11268e83bf
commit 83694d3897
2 changed files with 25 additions and 2 deletions

View File

@@ -530,9 +530,25 @@ def gitea_webhook(request):
logger.info(f"[Webhook] Processing push: {commit_count} commit(s) by {pusher} to {repo_full_name}")
# Pull latest code first
try:
import subprocess
logger.info(f"[Webhook] Pulling latest code...")
result = subprocess.run(
['/data/app/igny8/scripts/git-pull.sh'],
capture_output=True,
text=True,
timeout=30,
cwd='/data/app/igny8'
)
if result.returncode == 0:
logger.info(f"[Webhook] Git pull successful: {result.stdout}")
else:
logger.error(f"[Webhook] Git pull failed: {result.stderr}")
except Exception as e:
logger.error(f"[Webhook] Git pull error: {e}")
# Trigger deployment - restart containers
# Note: Git pull is handled by post-receive hook in Gitea
# This webhook restarts containers to apply changes
deployment_success = False
deployment_error = None

7
scripts/git-pull.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
# Simple git pull script for webhook
cd /data/app/igny8
git pull origin main
git update-ref refs/remotes/origin/main HEAD