Fix resources isues 29
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ spec:
|
||||
default: "main"
|
||||
- name: depth
|
||||
type: string
|
||||
description: Git clone depth (0 for full history)
|
||||
default: "1"
|
||||
description: Git clone depth (0 for full history, minimum 2 for change detection)
|
||||
default: "2"
|
||||
results:
|
||||
- name: commit-sha
|
||||
description: The commit SHA that was checked out
|
||||
|
||||
Reference in New Issue
Block a user