Fix resources isues 29

This commit is contained in:
2026-01-22 21:41:07 +01:00
parent a83e6691aa
commit ecdad596bf
5 changed files with 44 additions and 7 deletions

View File

@@ -40,13 +40,27 @@ spec:
cd $(workspaces.source.path)
echo "Git log (last 3 commits):"
git log --oneline -3 || echo "Cannot get git log"
# Check if we have enough history for comparison
COMMIT_COUNT=$(git rev-list --count HEAD 2>/dev/null || echo "0")
echo "Commit count in history: $COMMIT_COUNT"
if [ "$COMMIT_COUNT" -lt 2 ]; then
echo "Not enough git history for change detection (need at least 2 commits)"
echo "Building all services as fallback"
echo "all" > $(results.changed-services.path)
exit 0
fi
# Get the list of changed files
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || echo "")
if [ -z "$CHANGED_FILES" ]; then
# No changes detected, assume all services need building
echo "No git changes detected, building all services"
echo "all" > $(results.changed-services.path)
# Empty commit or something unusual - skip build
echo "No file changes detected in last commit"
echo "infrastructure" > $(results.changed-services.path)
exit 0
fi