Skip to content

Commit 219e3d9

Browse files
committed
some more ci/cd fixes
1 parent 8854605 commit 219e3d9

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

.github/workflows/deploy-pipeline.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,30 +196,35 @@ jobs:
196196
# Get outputs from Terraform
197197
echo "Getting infrastructure outputs..."
198198
199-
# Capture Terraform outputs with better error handling
199+
# Capture Terraform outputs by writing to files first
200200
echo "Capturing S3 bucket name..."
201-
S3_BUCKET_NAME=$(terraform output -raw s3_bucket_name 2>&1)
202-
if [ $? -ne 0 ]; then
203-
echo "⚠️ Failed to get S3 bucket name from Terraform, using default"
201+
terraform output -raw s3_bucket_name > s3_bucket_name.txt 2>/dev/null || echo "ml-crash-course-data" > s3_bucket_name.txt
202+
S3_BUCKET_NAME=$(cat s3_bucket_name.txt | tr -d '\n\r')
203+
204+
echo "Capturing EKS cluster name..."
205+
terraform output -raw eks_cluster_name > eks_cluster_name.txt 2>/dev/null || echo "ml-crash-course-cluster" > eks_cluster_name.txt
206+
EKS_CLUSTER_NAME=$(cat eks_cluster_name.txt | tr -d '\n\r')
207+
208+
# Fallback to known values if extraction failed
209+
if [ -z "$S3_BUCKET_NAME" ] || [ "$S3_BUCKET_NAME" = "" ]; then
204210
S3_BUCKET_NAME="ml-crash-course-data"
205211
fi
206212
207-
echo "Capturing EKS cluster name..."
208-
EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name 2>&1)
209-
if [ $? -ne 0 ]; then
210-
echo "⚠️ Failed to get EKS cluster name from Terraform, using default"
213+
if [ -z "$EKS_CLUSTER_NAME" ] || [ "$EKS_CLUSTER_NAME" = "" ]; then
211214
EKS_CLUSTER_NAME="ml-crash-course-cluster"
212215
fi
213216
214-
# Clean up any extra output from the commands
215-
S3_BUCKET_NAME=$(echo "$S3_BUCKET_NAME" | head -n1 | tr -d '\n\r')
216-
EKS_CLUSTER_NAME=$(echo "$EKS_CLUSTER_NAME" | head -n1 | tr -d '\n\r')
217-
218217
echo "s3_bucket_name=$S3_BUCKET_NAME" >> $GITHUB_OUTPUT
219218
echo "eks_cluster_name=$EKS_CLUSTER_NAME" >> $GITHUB_OUTPUT
220219
echo "Using S3 Bucket: $S3_BUCKET_NAME"
221220
echo "Using EKS Cluster: $EKS_CLUSTER_NAME"
222221
222+
# Debug: Show the actual values
223+
echo "🔍 Debug - S3 Bucket Name: '$S3_BUCKET_NAME'"
224+
echo "🔍 Debug - EKS Cluster Name: '$EKS_CLUSTER_NAME'"
225+
echo "🔍 Debug - S3 Bucket Name length: ${#S3_BUCKET_NAME}"
226+
echo "🔍 Debug - EKS Cluster Name length: ${#EKS_CLUSTER_NAME}"
227+
223228
# Wait for EKS cluster to be ready
224229
echo "⏳ Waiting for EKS cluster to be ready..."
225230
aws eks wait cluster-active --name "$EKS_CLUSTER_NAME" --region ${{ secrets.AWS_REGION }}

0 commit comments

Comments
 (0)