automated terminal push
This commit is contained in:
24
infrastructure/foundation/Jenkinsfile
vendored
24
infrastructure/foundation/Jenkinsfile
vendored
@@ -237,24 +237,11 @@ sonar.tags=terraform,infrastructure,enterprise-cicd
|
||||
|
||||
// Run SonarQube analysis
|
||||
try {
|
||||
withSonarQubeEnv('SonarQube') {
|
||||
sh '''
|
||||
echo "🔍 Running SonarQube analysis on Terraform infrastructure..."
|
||||
// Use the installed SonarQube Scanner
|
||||
def scannerHome = tool name: 'SonarScanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
|
||||
|
||||
# Check if sonar-scanner is available
|
||||
if command -v sonar-scanner &> /dev/null; then
|
||||
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
|
||||
'''
|
||||
withSonarQubeEnv('SonarQube') {
|
||||
sh "${scannerHome}/bin/sonar-scanner"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
echo "❌ SonarQube analysis failed: ${e.getMessage()}"
|
||||
@@ -275,8 +262,7 @@ sonar.tags=terraform,infrastructure,enterprise-cicd
|
||||
error "Pipeline aborted due to SonarQube failure"
|
||||
}
|
||||
} else {
|
||||
error "SonarQube analysis failed for ${params.ACTION} action"
|
||||
}
|
||||
error "SonarQube analysis failed for ${params.ACTION} action" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user