automated terminal push

This commit is contained in:
lenape
2025-07-15 05:38:19 +00:00
parent 48f08905db
commit d3666b6918

23
Jenkinsfile vendored
View File

@@ -82,19 +82,22 @@ pipeline {
echo "✅ Terraform backend created successfully"
} else {
echo "⚠️ Terraform apply failed, checking if resources already exist..."
def bucketCheck = sh(
script: "aws s3api head-bucket --bucket ${TF_BACKEND_BUCKET} --region ${TF_VAR_aws_region} 2>/dev/null && echo 'exists' || echo 'missing'",
returnStdout: true
).trim()
def tableCheck = sh(
script: "aws dynamodb describe-table --table-name ${TF_DDB_TABLE} --region ${TF_VAR_aws_region} 2>/dev/null && echo 'exists' || echo 'missing'",
returnStdout: true
).trim()
def bucketExists = sh(
script: "aws s3api head-bucket --bucket ${TF_BACKEND_BUCKET} --region ${TF_VAR_aws_region} 2>/dev/null",
returnStatus: true
) == 0
def tableExists = sh(
script: "aws dynamodb describe-table --table-name ${TF_DDB_TABLE} --region ${TF_VAR_aws_region} 2>/dev/null",
returnStatus: true
) == 0
if (bucketCheck == "exists" && tableCheck == "exists") {
if (bucketExists && tableExists) {
echo "✅ Terraform backend already exists - continuing..."
} else {
error("❌ Backend bootstrap failed and resources don't exist. Manual intervention required.")
echo "❌ Backend bootstrap failed and resources don't exist:"
echo " S3 Bucket exists: ${bucketExists}"
echo " DynamoDB Table exists: ${tableExists}"
error("Manual intervention required.")
}
}
}