Add complete workspace cleanup before checkout

- Now clears entire workspace except .git directory before checkout
- Ensures absolutely clean state for every build
- Uses safe find command with error suppression
- Guarantees no leftover files from previous builds can interfere
This commit is contained in:
RebeccaNod1 2025-08-14 00:49:33 -05:00
parent 6696ec9ca1
commit 152d638b3f

22
Jenkinsfile vendored
View file

@ -13,6 +13,17 @@ pipeline {
}
stages {
stage('Clean Workspace') {
steps {
echo "🧹 Cleaning entire workspace before checkout..."
sh '''
# Remove everything except .git directory
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} + 2>/dev/null || true
echo "Workspace completely cleaned"
'''
}
}
stage('Checkout') {
steps {
echo "🔍 Checking out LSL project: ${PROJECT_NAME}"
@ -20,17 +31,6 @@ pipeline {
}
}
stage('Clean Workspace') {
steps {
echo "🧹 Cleaning up processed files from previous builds..."
sh '''
# Remove any processed files from previous builds
rm -f processed_*.lsl
echo "Workspace cleaned of processed files"
'''
}
}
stage('LSL Validation') {
steps {
echo "🔧 Validating LSL syntax..."