automated terminal push

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

View File

@@ -212,49 +212,36 @@ pipeline {
script {
// Create comprehensive SonarQube configuration
writeFile file: 'sonar-project.properties', text: """
sonar.projectKey=${env.SONAR_PROJECT_KEY}
sonar.projectName=${env.SONAR_PROJECT_NAME}
sonar.projectVersion=${env.SONAR_PROJECT_VERSION}
sonar.sources=.
sonar.sourceEncoding=UTF-8
sonar.projectKey=${env.SONAR_PROJECT_KEY}
sonar.projectName=${env.SONAR_PROJECT_NAME}
sonar.projectVersion=${env.SONAR_PROJECT_VERSION}
sonar.sources=.
sonar.sourceEncoding=UTF-8
# Terraform-specific configuration
sonar.terraform.file.suffixes=.tf
sonar.exclusions=**/*.tfstate,**/*.tfstate.backup,**/.terraform/**,**/*.tfplan
# Terraform-specific configuration
sonar.terraform.file.suffixes=.tf
sonar.exclusions=**/*.tfstate,**/*.tfstate.backup,**/.terraform/**,**/*.tfplan
# Include scripts in analysis
sonar.inclusions=**/*.tf,**/*.sh
# Include scripts in analysis
sonar.inclusions=**/*.tf,**/*.sh
# Quality gate settings
sonar.qualitygate.wait=true
# Quality gate settings
sonar.qualitygate.wait=true
# Coverage and duplications
sonar.cpd.exclusions=**/*.tf
# Coverage and duplications
sonar.cpd.exclusions=**/*.tf
# Custom properties for enterprise analysis
sonar.tags=terraform,infrastructure,enterprise-cicd
"""
# Custom properties for enterprise analysis
sonar.tags=terraform,infrastructure,enterprise-cicd
"""
// Run SonarQube analysis
try {
// Use the installed SonarQube Scanner
def scannerHome = tool name: 'SonarScanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
withSonarQubeEnv('SonarQube') {
sh '''
echo "🔍 Running SonarQube analysis on Terraform infrastructure..."
# 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
'''
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" }
}
}
}