automated terminal push
This commit is contained in:
41
infrastructure/foundation/Jenkinsfile
vendored
41
infrastructure/foundation/Jenkinsfile
vendored
@@ -75,24 +75,24 @@ pipeline {
|
|||||||
echo "Authentication: Jenkins Credential Store (Enterprise Standard)"
|
echo "Authentication: Jenkins Credential Store (Enterprise Standard)"
|
||||||
echo "Build: #${BUILD_NUMBER}"
|
echo "Build: #${BUILD_NUMBER}"
|
||||||
echo "Working Directory: ${env.TF_WORKING_DIR}"
|
echo "Working Directory: ${env.TF_WORKING_DIR}"
|
||||||
|
|
||||||
// Clean workspace and checkout latest code
|
// Clean workspace and checkout latest code
|
||||||
deleteDir()
|
deleteDir()
|
||||||
checkout scm
|
checkout scm
|
||||||
|
|
||||||
// Verify repository structure
|
// Verify repository structure
|
||||||
script {
|
script {
|
||||||
sh '''
|
sh '''
|
||||||
echo "Repository structure validation:"
|
echo "Repository structure validation:"
|
||||||
|
|
||||||
# Check for required directory
|
# Check for required directory
|
||||||
if [ ! -d "${TF_WORKING_DIR}" ]; then
|
if [ ! -d "${TF_WORKING_DIR}" ]; then
|
||||||
echo "❌ Missing foundation directory: ${TF_WORKING_DIR}"
|
echo "❌ Missing foundation directory: ${TF_WORKING_DIR}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${TF_WORKING_DIR}"
|
cd "${TF_WORKING_DIR}"
|
||||||
|
|
||||||
# 1️⃣ Core Terraform files (always required)
|
# 1️⃣ Core Terraform files (always required)
|
||||||
for file in main.tf variables.tf outputs.tf versions.tf; do
|
for file in main.tf variables.tf outputs.tf versions.tf; do
|
||||||
if [ ! -f "$file" ]; then
|
if [ ! -f "$file" ]; then
|
||||||
@@ -101,30 +101,30 @@ pipeline {
|
|||||||
fi
|
fi
|
||||||
echo "✅ Found: $file"
|
echo "✅ Found: $file"
|
||||||
done
|
done
|
||||||
|
|
||||||
# 2️⃣ Bootstrap & cleanup scripts (only if ACTION≠plan AND SKIP_BOOTSTRAP=false)
|
# 2️⃣ Bootstrap & cleanup scripts (only if ACTION≠plan AND SKIP_BOOTSTRAP=false)
|
||||||
if [ "${ACTION}" != "plan" ] && [ "${SKIP_BOOTSTRAP}" != "true" ]; then
|
if [ "${ACTION}" != "plan" ] && [ "${SKIP_BOOTSTRAP}" != "true" ]; then
|
||||||
for file in bootstrap.sh cleanup.sh; do
|
for file in bootstrap.sh cleanup.sh; do
|
||||||
if [ ! -f "$file" ]; then
|
if [ ! -f "$file" ]; then
|
||||||
echo "❌ Missing required file: $file"
|
echo "❌ Missing required file: $file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "✅ Found: $file"
|
echo "✅ Found: $file"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "✅ Skipping bootstrap/cleanup checks (ACTION=${ACTION}, SKIP_BOOTSTRAP=${SKIP_BOOTSTRAP})"
|
echo "✅ Skipping bootstrap/cleanup checks (ACTION=${ACTION}, SKIP_BOOTSTRAP=${SKIP_BOOTSTRAP})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make scripts executable (if they aren't already)
|
# Make scripts executable (if they aren't already)
|
||||||
chmod +x bootstrap.sh cleanup.sh || {
|
chmod +x bootstrap.sh cleanup.sh || {
|
||||||
echo "⚠️ Could not make scripts executable, but continuing..."
|
echo "⚠️ Could not make scripts executable, but continuing..."
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "✅ Repository structure validated"
|
echo "✅ Repository structure validated"
|
||||||
'''
|
'''
|
||||||
}
|
} // end script
|
||||||
}
|
} // end steps
|
||||||
}
|
} // end stage
|
||||||
|
|
||||||
stage('🔧 Setup Tools') {
|
stage('🔧 Setup Tools') {
|
||||||
steps {
|
steps {
|
||||||
@@ -873,5 +873,4 @@ Type 'DESTROY' exactly to confirm:
|
|||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user