-
Notifications
You must be signed in to change notification settings - Fork 239
200 lines (192 loc) · 6.28 KB
/
production.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
"on":
push:
tags:
- production
name: Deploy Porter to Production
jobs:
deploy-start:
name: Mark deploy as started
runs-on: ubuntu-latest
outputs:
deploy-ts: ${{ steps.deploy.outputs.ts }}
steps:
- name: Slack Notification
uses: slackapi/slack-github-action@v1
id: deploy
continue-on-error: true
env:
SLACK_WEBHOOK_URL: ${{ secrets.PORTER_PROD_NOTIFICATIONS_SLACK_WEBHOOK }}
with:
payload: |
{
"text": "porter prod deploy started (In Progress)\n<${{ github.event.pull_request.html_url || github.event.head_commit.url }}|Link to commit>",
"attachments": [
{
"pretext": "Deployment started",
"color": "dbab09",
"fields": [
{
"title": "Status",
"short": true,
"value": "In Progress"
}
]
}
]
}
build-go:
runs-on: ubuntu-latest
needs:
- deploy-start
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: build-go
uses: ./.github/actions/build-go
build-npm:
runs-on: ubuntu-latest
needs:
- deploy-start
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: build-npm
uses: ./.github/actions/build-npm
deploy-porter:
runs-on: ubuntu-latest
needs: [build-go, build-npm]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get Go Binaries
uses: actions/download-artifact@v3
with:
name: go-binaries
path: bin/
- name: Get NPM static files
uses: actions/download-artifact@v3
with:
name: npm-static-files
path: build/
- name: Set Github tag
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build Image
timeout-minutes: 20
uses: porter-dev/[email protected]
with:
command: update build --app porter-ui --tag ${{ steps.vars.outputs.sha_short }} --stream
env:
PORTER_HOST: https://dashboard.internal-tools.porter.run
PORTER_CLUSTER: 9
PORTER_PROJECT: 5
PORTER_TOKEN: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
- name: Push Image
timeout-minutes: 20
uses: porter-dev/[email protected]
with:
command: update push --app porter-ui --tag ${{ steps.vars.outputs.sha_short }} --stream
env:
PORTER_HOST: https://dashboard.internal-tools.porter.run
PORTER_CLUSTER: 9
PORTER_PROJECT: 5
PORTER_TOKEN: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
- name: Update Porter Migration Job
timeout-minutes: 20
uses: porter-dev/[email protected]
with:
command: update config --app migrate --tag ${{ steps.vars.outputs.sha_short }} --stream
env:
PORTER_HOST: https://dashboard.internal-tools.porter.run
PORTER_CLUSTER: 9
PORTER_PROJECT: 5
PORTER_TOKEN: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
- name: Run Migration Job
timeout-minutes: 20
uses: porter-dev/[email protected]
with:
job: migrate
host: https://dashboard.internal-tools.porter.run
cluster: 9
project: 5
token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
- name: Update Porter Server
timeout-minutes: 20
uses: porter-dev/[email protected]
with:
app: porter-ui
cluster: "9"
host: https://dashboard.internal-tools.porter.run
namespace: default
project: "5"
tag: ${{ steps.vars.outputs.sha_short }}
token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
- name: Update Porter Auth
timeout-minutes: 20
uses: porter-dev/[email protected]
with:
app: porter-auth
cluster: "9"
host: https://dashboard.internal-tools.porter.run
namespace: default
project: "5"
tag: ${{ steps.vars.outputs.sha_short }}
token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
deploy-worker-pool:
runs-on: ubuntu-latest
needs: [build-go, build-npm] # don't run this step unless these finish successfully
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set Github tag
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Update Worker Pool (revision cull job)
timeout-minutes: 20
uses: porter-dev/[email protected]
with:
app: cull-helm-revisions
cluster: "9"
host: https://dashboard.internal-tools.porter.run
namespace: default
project: "5"
tag: ${{ steps.vars.outputs.sha_short }}
token: ${{ secrets.PORTER_PRODUCTION_DEPLOYMENT }}
deploy-end:
name: Mark deploy as ended
runs-on: ubuntu-latest
if: always()
needs:
- deploy-start
- deploy-porter
- deploy-worker-pool
steps:
- name: Slack Notification
uses: slackapi/slack-github-action@v1
continue-on-error: true
env:
SLACK_WEBHOOK_URL: ${{ secrets.PORTER_PROD_NOTIFICATIONS_SLACK_WEBHOOK }}
with:
update-ts: ${{ steps.deploy-start.outputs.deploy-ts }}
payload: |
{
"text": "porter prod deploy completed\n<${{ github.event.pull_request.html_url || github.event.head_commit.url }}|Link to commit>",
"attachments": [
{
"pretext": "Deployment completed",
"color": "8590ff",
"fields": [
{
"title": "Porter Result",
"short": true,
"value": "${{ needs.deploy-porter.result }}"
},
{
"title": "Worker Pool Result",
"short": true,
"value": "${{ needs.deploy-worker-pool.result }}"
}
]
}
]
}