automated terminal push
This commit is contained in:
45
infrastructure/foundation/Jenkinsfile
vendored
45
infrastructure/foundation/Jenkinsfile
vendored
@@ -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
|
||||
@@ -225,7 +189,6 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('🔍 SonarQube Analysis') {
|
||||
when {
|
||||
allOf {
|
||||
|
||||
Reference in New Issue
Block a user