From 5b0d882912569a4d6b4769279fd28c98fd102c24 Mon Sep 17 00:00:00 2001 From: lenape Date: Sun, 3 Aug 2025 04:11:51 +0000 Subject: [PATCH] automated terminal push --- infrastructure/foundation/Jenkinsfile | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/infrastructure/foundation/Jenkinsfile b/infrastructure/foundation/Jenkinsfile index 6b417d4..b685cda 100644 --- a/infrastructure/foundation/Jenkinsfile +++ b/infrastructure/foundation/Jenkinsfile @@ -64,7 +64,6 @@ pipeline { SONAR_PROJECT_VERSION = "${BUILD_NUMBER}" } - stages { stage('🔍 Checkout & Validation') { steps { echo "=== Enterprise CI/CD Foundation Layer Pipeline ===" @@ -76,25 +75,26 @@ pipeline { echo "Authentication: Jenkins Credential Store (Enterprise Standard)" echo "Build: #${BUILD_NUMBER}" echo "Working Directory: ${env.TF_WORKING_DIR}" - + // Clean workspace and checkout latest code deleteDir() checkout scm - + // Verify repository structure script { sh ''' echo "Repository structure validation:" - # Check for required directories + # Check for required directory if [ ! -d "${TF_WORKING_DIR}" ]; then echo "❌ Missing foundation directory: ${TF_WORKING_DIR}" exit 1 fi - # Check for required files cd "${TF_WORKING_DIR}" - for file in main.tf variables.tf outputs.tf versions.tf bootstrap.sh cleanup.sh; do + + # 1️⃣ Core Terraform files (always required) + for file in main.tf variables.tf outputs.tf versions.tf; do if [ ! -f "$file" ]; then echo "❌ Missing required file: $file" exit 1 @@ -102,6 +102,19 @@ pipeline { echo "✅ Found: $file" done + # 2️⃣ Bootstrap & cleanup scripts (only if ACTION≠plan AND SKIP_BOOTSTRAP=false) + if [ "${ACTION}" != "plan" ] && [ "${SKIP_BOOTSTRAP}" != "true" ]; then + for file in bootstrap.sh cleanup.sh; do + if [ ! -f "$file" ]; then + echo "❌ Missing required file: $file" + exit 1 + fi + echo "✅ Found: $file" + done + else + echo "✅ Skipping bootstrap/cleanup checks (ACTION=${ACTION}, SKIP_BOOTSTRAP=${SKIP_BOOTSTRAP})" + fi + # Make scripts executable (if they aren't already) chmod +x bootstrap.sh cleanup.sh || { echo "⚠️ Could not make scripts executable, but continuing..."