automated terminal push

This commit is contained in:
lenape
2025-08-03 14:07:15 +00:00
parent 634cad010d
commit 282bfad383

View File

@@ -130,52 +130,16 @@ pipeline {
stage('🔧 Setup Tools') {
steps {
script {
// Install Terraform if not available
// Verify Terraform is available
sh '''
echo "✅ Checking for Terraform..."
if ! command -v terraform &> /dev/null; then
echo "Installing Terraform ${TF_VERSION}..."
# Check if wget is available
if ! command -v wget &> /dev/null; then
echo "❌ wget not available. Please install Terraform manually or use a different base image."
echo "❌ Terraform not found. Please install Terraform ${TF_VERSION}"
exit 1
fi
# Download and install Terraform
wget -q https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip || {
echo "❌ Failed to download Terraform"
exit 1
}
unzip -o terraform_${TF_VERSION}_linux_amd64.zip || {
echo "❌ Failed to unzip Terraform"
exit 1
}
chmod +x terraform
# Try to move to system path, fallback to local
if sudo mv terraform /usr/local/bin/ 2>/dev/null; then
echo "✅ Terraform installed to /usr/local/bin/"
elif mv terraform /tmp/ 2>/dev/null; then
export PATH="/tmp:$PATH"
echo "✅ Terraform installed to /tmp/ (added to PATH)"
else
echo "⚠️ Could not install Terraform to system path. Using local copy."
export PATH=".:$PATH"
fi
# Cleanup
rm -f terraform_${TF_VERSION}_linux_amd64.zip
else
echo "✅ Terraform is already installed"
fi
echo "Terraform version:"
terraform version || {
echo "❌ Terraform installation failed or not accessible"
exit 1
}
terraform version
'''
// Verify AWS credentials and permissions via Jenkins credential store
@@ -211,21 +175,20 @@ pipeline {
}
} catch (Exception e) {
error """
❌ AWS Credentials Setup Failed: ${e.getMessage()}
❌ AWS Credentials Setup Failed: ${e.getMessage()}
🔧 Check these in Jenkins:
1. Manage Jenkins → Manage Credentials → Global
2. Verify credential exists: '${params.AWS_CREDENTIALS_ID}' (Type: AWS Credentials)
3. Verify credential exists: '${params.AWS_REGION_ID}' (Type: Secret text)
4. Ensure AWS CLI is installed in Jenkins container
🔧 Check these in Jenkins:
1. Manage Jenkins → Manage Credentials → Global
2. Verify credential exists: '${params.AWS_CREDENTIALS_ID}' (Type: AWS Credentials)
3. Verify credential exists: '${params.AWS_REGION_ID}' (Type: Secret text)
4. Ensure AWS CLI is installed in Jenkins container
💡 Or run with different credential IDs if yours are named differently.
💡 Or run with different credential IDs if yours are named differently.
"""
}
}
}
}
stage('🔍 SonarQube Analysis') {
when {
allOf {