automated terminal push

This commit is contained in:
lenape
2025-08-03 19:40:27 +00:00
parent 4633bd7c36
commit b6d220bf3a

View File

@@ -237,24 +237,11 @@ sonar.tags=terraform,infrastructure,enterprise-cicd
// Run SonarQube analysis // Run SonarQube analysis
try { try {
withSonarQubeEnv('SonarQube') { // Use the installed SonarQube Scanner
sh ''' def scannerHome = tool name: 'SonarScanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
echo "🔍 Running SonarQube analysis on Terraform infrastructure..."
# Check if sonar-scanner is available withSonarQubeEnv('SonarQube') {
if command -v sonar-scanner &> /dev/null; then sh "${scannerHome}/bin/sonar-scanner"
sonar-scanner
else
echo "⚠️ sonar-scanner not found. Attempting to use docker fallback..."
if command -v docker &> /dev/null; then
docker run --rm -v "$(pwd):/usr/src" sonarsource/sonar-scanner-cli
else
echo "❌ Neither sonar-scanner nor docker available"
echo "Please install SonarQube Scanner or skip SonarQube analysis"
exit 1
fi
fi
'''
} }
} catch (Exception e) { } catch (Exception e) {
echo "❌ SonarQube analysis failed: ${e.getMessage()}" echo "❌ SonarQube analysis failed: ${e.getMessage()}"
@@ -275,8 +262,7 @@ sonar.tags=terraform,infrastructure,enterprise-cicd
error "Pipeline aborted due to SonarQube failure" error "Pipeline aborted due to SonarQube failure"
} }
} else { } else {
error "SonarQube analysis failed for ${params.ACTION} action" error "SonarQube analysis failed for ${params.ACTION} action" }
}
} }
} }
} }