-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) Β· 1.88 KB
/
ec2-reboot.yml
File metadata and controls
54 lines (46 loc) Β· 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: EC2-READ-LOGTAIL
on:
workflow_dispatch:
jobs:
read-log:
name: Read CodeDeploy LogTail
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 latest deployment logTail
run: |
echo "=== μ΅κ·Ό λ°°ν¬ λͺ©λ‘ ==="
DEPLOYMENTS=$(aws deploy list-deployments \
--application-name runnect-prod-codedeploy \
--deployment-group-name runnect-prod-codedeploy-group \
--query "deployments[:3]" \
--output text 2>/dev/null)
echo "Deployments: $DEPLOYMENTS"
for DEP_ID in $DEPLOYMENTS; do
echo ""
echo "================================================"
echo "=== Deployment: $DEP_ID ==="
DEP_STATUS=$(aws deploy get-deployment --deployment-id "$DEP_ID" \
--query "deploymentInfo.status" --output text 2>/dev/null)
DEP_TIME=$(aws deploy get-deployment --deployment-id "$DEP_ID" \
--query "deploymentInfo.createTime" --output text 2>/dev/null)
echo "Status: $DEP_STATUS | Created: $DEP_TIME"
INSTANCES=$(aws deploy list-deployment-instances \
--deployment-id "$DEP_ID" \
--query "instancesList" \
--output text 2>/dev/null)
for INST in $INSTANCES; do
echo ""
echo "--- Instance: $INST ---"
aws deploy get-deployment-instance \
--deployment-id "$DEP_ID" \
--instance-id "$INST" \
--query "instanceSummary.lifecycleEvents[].{name:lifecycleEventName, status:status, logTail:diagnostics.logTail}" \
--output json 2>&1
done
done