git-conf
This commit is contained in:
@@ -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
7
scripts/git-pull.sh
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user