-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (114 loc) · 4.1 KB
/
be-cd-prod.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: BE CD for Prod
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- backend/**
jobs:
build:
uses: ./.github/workflows/build.yml
with:
profile: prod
secrets:
secret_yml: ${{ secrets.PROD_SECRET_YML }}
deploy-a:
needs: [ build ]
uses: ./.github/workflows/blue-green.yml
with:
self_hosted_runner: prod-a
artifact_name: ${{ needs.build.outputs.artifact_name }}
jar_name: ${{ needs.build.outputs.jar_name }}
profile: prod
app_path: ~/app
deploy-b:
needs: [ build ]
uses: ./.github/workflows/blue-green.yml
with:
self_hosted_runner: prod-b
artifact_name: ${{ needs.build.outputs.artifact_name }}
jar_name: ${{ needs.build.outputs.jar_name }}
profile: prod
app_path: ~/app
rollback-a:
name: "[Failure] Rollback Deploy A"
needs: [ deploy-a, deploy-b ]
if: failure() && (needs.deploy-a.result == 'failure' || needs.deploy-b.result == 'failure')
uses: ./.github/workflows/shutdown.yml
with:
self_hosted_runner: prod-a
port: ${{ needs.deploy-a.outputs.green_port }}
rollback-b:
name: "[Failure] Rollback Deploy B"
needs: [ deploy-a, deploy-b ]
if: failure() && (needs.deploy-a.result == 'failure' || needs.deploy-b.result == 'failure')
uses: ./.github/workflows/shutdown.yml
with:
self_hosted_runner: prod-b
port: ${{ needs.deploy-b.outputs.green_port }}
deploy-failure-notification:
name: "[Failure] Deploy Failure Notification"
needs: [ deploy-a, deploy-b ]
if: failure() && (needs.deploy-a.result == 'failure' || needs.deploy-b.result == 'failure')
runs-on: ubuntu-latest
steps:
- name: Send notification to Discord # todo
run: echo "테스트입니다"
configure-nginx-a:
needs: [ deploy-a, deploy-b ]
uses: ./.github/workflows/nginx-port-forwarding.yml
with:
self_hosted_runner: prod-a
app_path: ~/app
old_port: ${{ needs.deploy-a.outputs.blue_port }}
new_port: ${{ needs.deploy-a.outputs.green_port }}
configure-nginx-b:
needs: [ deploy-a, deploy-b ]
uses: ./.github/workflows/nginx-port-forwarding.yml
with:
self_hosted_runner: prod-b
app_path: ~/app
old_port: ${{ needs.deploy-b.outputs.blue_port }}
new_port: ${{ needs.deploy-b.outputs.green_port }}
rollback-nginx-a:
name: "[Failure] Rollback Nginx A"
needs: [ configure-nginx-a, configure-nginx-b ]
if: failure() && (needs.configure-nginx-a.result == 'failure' || needs.configure-nginx-b.result == 'failure')
uses: ./.github/workflows/nginx-port-forwarding.yml
with:
self_hosted_runner: prod-a
app_path: ~/app
old_port: ${{ needs.configure-nginx-a.outputs.new_port }}
new_port: ${{ needs.configure-nginx-a.outputs.old_port }}
old_shutdown: true
rollback-nginx-b:
name: "[Failure] Rollback Nginx B"
needs: [ configure-nginx-a, configure-nginx-b ]
if: failure() && (needs.configure-nginx-a.result == 'failure' || needs.configure-nginx-b.result == 'failure')
uses: ./.github/workflows/nginx-port-forwarding.yml
with:
self_hosted_runner: prod-b
app_path: ~/app
old_port: ${{ needs.configure-nginx-b.outputs.new_port }}
new_port: ${{ needs.configure-nginx-b.outputs.old_port }}
old_shutdown: true
configure-nginx-faliure-notification:
name: "[Failure] Nginx Failure Notification"
needs: [ configure-nginx-a, configure-nginx-b ]
if: failure() && (needs.configure-nginx-a.result == 'failure' || needs.configure-nginx-b.result == 'failure')
runs-on: ubuntu-latest
steps:
- name: Send notification to Discord # todo
run: echo "테스트입니다"
blue-shutdown-a:
needs: [ configure-nginx-a, configure-nginx-b ]
uses: ./.github/workflows/shutdown.yml
with:
self_hosted_runner: prod-a
port: ${{ needs.configure-nginx-a.outputs.old_port }}
blue-shutdown-b:
needs: [ configure-nginx-a, configure-nginx-b ]
uses: ./.github/workflows/shutdown.yml
with:
self_hosted_runner: prod-b
port: ${{ needs.configure-nginx-b.outputs.old_port }}