Fix webhook deploy git ownership handling

This commit is contained in:
2026-05-27 10:30:36 +02:00
parent 58e646e0a0
commit bb112057b0
+11 -19
View File
@@ -15,17 +15,6 @@ APP_SOURCE_DIR="$WORKSPACE_DIR/$APP_ID"
CATALOG_FILE="$APPFACTORY_DIR/apps/catalog.yml"
TOOLS_DIR="$WORKSPACE_DIR/appfactory-tools"
safe_chown() {
local target="$1"
local uid
local gid
uid="${APP_UID:-$(stat -c '%u' "$WORKSPACE_DIR")}"
gid="${APP_GID:-$(stat -c '%g' "$WORKSPACE_DIR")}"
chown -R "$uid:$gid" "$target" || true
}
if [ ! -d "$APP_SOURCE_DIR" ]; then
echo "Missing app source: $APP_SOURCE_DIR"
exit 1
@@ -36,15 +25,17 @@ if [ ! -f "$APP_SOURCE_DIR/Dockerfile" ]; then
exit 1
fi
safe_chown "$APP_SOURCE_DIR"
echo "Updating source code..."
cd "$APP_SOURCE_DIR"
if [ -d ".git" ]; then
git config --global --add safe.directory "$APP_SOURCE_DIR" || true
git fetch origin main
git reset --hard origin/main
git \
-c safe.directory="$APP_SOURCE_DIR" \
fetch origin main
git \
-c safe.directory="$APP_SOURCE_DIR" \
reset --hard origin/main
fi
echo "Building Docker image..."
@@ -77,9 +68,10 @@ echo "Regenerating generated files..."
echo "Starting app container..."
cd "$APPFACTORY_DIR/deploy"
docker compose -f docker-compose.yml -f apps-compose.yml up -d --force-recreate "$APP_ID"
safe_chown "$APP_SOURCE_DIR"
docker compose \
-f docker-compose.yml \
-f apps-compose.yml \
up -d --force-recreate "$APP_ID"
echo ""
echo "DONE"