Skip to content

Commit 65c2fbe

Browse files
committed
chore: logTail 읽기 워크플로우
1 parent 8e1e49c commit 65c2fbe

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

.github/workflows/ec2-reboot.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: EC2-READ-DEPLOY-LOG
1+
name: EC2-READ-LOGTAIL
22

33
on:
44
workflow_dispatch:
55

66
jobs:
77
read-log:
8-
name: Read CodeDeploy Logs
8+
name: Read CodeDeploy LogTail
99
runs-on: ubuntu-latest
1010

1111
steps:
@@ -16,38 +16,39 @@ jobs:
1616
aws-secret-access-key: ${{ secrets.AWS_PROD_SECRET_KEY }}
1717
aws-region: ap-northeast-2
1818

19-
- name: Get deployment lifecycle events
19+
- name: Get latest deployment logTail
2020
run: |
21-
echo "=== 최근 배포 목록 (최대 5개) ==="
21+
echo "=== 최근 배포 목록 ==="
2222
DEPLOYMENTS=$(aws deploy list-deployments \
2323
--application-name runnect-prod-codedeploy \
2424
--deployment-group-name runnect-prod-codedeploy-group \
25-
--query "deployments[:5]" \
25+
--query "deployments[:3]" \
2626
--output text 2>/dev/null)
2727
echo "Deployments: $DEPLOYMENTS"
2828
2929
for DEP_ID in $DEPLOYMENTS; do
3030
echo ""
3131
echo "================================================"
3232
echo "=== Deployment: $DEP_ID ==="
33-
echo "================================================"
3433
35-
aws deploy get-deployment --deployment-id "$DEP_ID" \
36-
--query "deploymentInfo.{status:status, createTime:createTime, completeTime:completeTime, error:errorInformation}" \
37-
--output json 2>&1
34+
DEP_STATUS=$(aws deploy get-deployment --deployment-id "$DEP_ID" \
35+
--query "deploymentInfo.status" --output text 2>/dev/null)
36+
DEP_TIME=$(aws deploy get-deployment --deployment-id "$DEP_ID" \
37+
--query "deploymentInfo.createTime" --output text 2>/dev/null)
38+
echo "Status: $DEP_STATUS | Created: $DEP_TIME"
3839
39-
echo ""
40-
echo "--- Instance lifecycle events ---"
4140
INSTANCES=$(aws deploy list-deployment-instances \
4241
--deployment-id "$DEP_ID" \
4342
--query "instancesList" \
4443
--output text 2>/dev/null)
4544
4645
for INST in $INSTANCES; do
47-
echo "Instance: $INST"
46+
echo ""
47+
echo "--- Instance: $INST ---"
4848
aws deploy get-deployment-instance \
4949
--deployment-id "$DEP_ID" \
5050
--instance-id "$INST" \
51+
--query "instanceSummary.lifecycleEvents[].{name:lifecycleEventName, status:status, logTail:diagnostics.logTail}" \
5152
--output json 2>&1
5253
done
5354
done

0 commit comments

Comments
 (0)