EC2-READ-LOGTAIL #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: EC2-READ-DEPLOY-LOG | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| read-log: | |
| name: Read CodeDeploy Logs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_PROD_ACCESS_KEY }} | |
| aws-secret-access-key: ${{ secrets.AWS_PROD_SECRET_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: Get deployment lifecycle events | |
| run: | | |
| echo "=== 최근 배포 목록 (최대 5개) ===" | |
| DEPLOYMENTS=$(aws deploy list-deployments \ | |
| --application-name runnect-prod-codedeploy \ | |
| --deployment-group-name runnect-prod-codedeploy-group \ | |
| --query "deployments[:5]" \ | |
| --output text 2>/dev/null) | |
| echo "Deployments: $DEPLOYMENTS" | |
| for DEP_ID in $DEPLOYMENTS; do | |
| echo "" | |
| echo "================================================" | |
| echo "=== Deployment: $DEP_ID ===" | |
| echo "================================================" | |
| aws deploy get-deployment --deployment-id "$DEP_ID" \ | |
| --query "deploymentInfo.{status:status, createTime:createTime, completeTime:completeTime, error:errorInformation}" \ | |
| --output json 2>&1 | |
| echo "" | |
| echo "--- Instance lifecycle events ---" | |
| INSTANCES=$(aws deploy list-deployment-instances \ | |
| --deployment-id "$DEP_ID" \ | |
| --query "instancesList" \ | |
| --output text 2>/dev/null) | |
| for INST in $INSTANCES; do | |
| echo "Instance: $INST" | |
| aws deploy get-deployment-instance \ | |
| --deployment-id "$DEP_ID" \ | |
| --instance-id "$INST" \ | |
| --output json 2>&1 | |
| done | |
| done |