@@ -95,6 +95,8 @@ deployment_validation:
9595integration_tests :
9696 stage : integration_tests
9797 timeout : 2h
98+ variables :
99+ IDP_ADMIN_EMAIL : ${GITLAB_USER_EMAIL}
98100 # variables:
99101 # # In order to run tests in another account, add a AWS_CREDS_TARGET_ROLE variable to the Gitlab pipeline variables.
100102 # AWS_CREDS_TARGET_ROLE: ${AWS_CREDS_TARGET_ROLE}
@@ -123,7 +125,7 @@ integration_tests:
123125 - unzip awscliv2.zip
124126 - ./aws/install
125127 # Install boto3 for Python script
126- - pip install boto3
128+ - pip install boto3 rich
127129
128130 script :
129131 - aws --version
@@ -132,7 +134,57 @@ integration_tests:
132134 # Set environment variables for Python script
133135 - export IDP_ACCOUNT_ID=${IDP_ACCOUNT_ID:-020432867916}
134136 - export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-east-1}
135- - export IDP_PIPELINE_NAME=idp -sdlc-deploy-pipeline
137+ - export IDP_PIPELINE_NAME=genaiic -sdlc-deploy-pipeline
136138
137139 # Run integration test deployment
138140 - python3 scripts/integration_test_deployment.py
141+
142+ after_script :
143+ # Display CodeBuild logs directly in GitLab runner console
144+ - |
145+ if [ -f "pipeline_execution_id.txt" ]; then
146+ EXECUTION_ID=$(cat pipeline_execution_id.txt)
147+ echo "Pipeline Execution: $EXECUTION_ID"
148+
149+ # Get CodeBuild ID from the pipeline execution
150+ BUILD_ID=$(aws codepipeline list-action-executions --pipeline-name ${IDP_PIPELINE_NAME:-genaiic-sdlc-deploy-pipeline} --filter pipelineExecutionId=$EXECUTION_ID --query 'actionExecutionDetails[?actionName==`BuildAction`].output.executionResult.externalExecutionId' --output text 2>/dev/null || echo "")
151+
152+ if [ "$BUILD_ID" != "" ] && [ "$BUILD_ID" != "None" ]; then
153+ echo "CodeBuild ID: $BUILD_ID"
154+ # Extract just the build ID part (after the colon)
155+ LOG_STREAM_NAME="${BUILD_ID#*:}"
156+ echo "Log Stream: $LOG_STREAM_NAME"
157+ echo ""
158+ echo "=== DEPLOYMENT SUMMARY ==="
159+ # Wait for CloudWatch Logs to flush all events
160+ echo "Waiting 30 seconds for logs to flush..."
161+ sleep 30
162+ FULL_LOGS=$(aws logs get-log-events --log-group-name "/aws/codebuild/app-sdlc" --log-stream-name "$LOG_STREAM_NAME" --start-from-head --query 'events[].message' --output text 2>/dev/null || echo "Could not retrieve CodeBuild logs")
163+
164+ # Save full logs to artifact
165+ echo "$FULL_LOGS" > codebuild_logs.txt
166+ echo "📁 Full deployment logs saved to: codebuild_logs.txt"
167+
168+ # Extract and show deployment summary (AI or manual)
169+ echo ""
170+ SUMMARY=$(echo "$FULL_LOGS" | grep -A 100 "🤖 Generating deployment summary with Bedrock..." | head -100)
171+
172+ if [ -n "$SUMMARY" ]; then
173+ echo "🤖 Deployment Analysis:"
174+ echo "$SUMMARY"
175+ else
176+ echo "⚠️ No deployment summary found - check codebuild_logs.txt for details"
177+ fi
178+ else
179+ echo "Could not find CodeBuild execution"
180+ fi
181+ else
182+ echo "No pipeline execution ID found"
183+ fi
184+
185+ artifacts :
186+ when : always
187+ paths :
188+ - pipeline_execution_id.txt
189+ - codebuild_logs.txt
190+ expire_in : 1 week
0 commit comments