-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (107 loc) · 4 KB
/
deploy-image-on-dev.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
name: Deploy new Emeris backend stack image on dev
# This action is executed only via GitHub API call.
# All Emeris repositories call this action when their
# Docker image finished building, and they want it to be
# deployed on Dev environment.
# It works through repository_dispatch, the only type accepted is "dev-push".
# Since we use Helm to do deployments, for each image we need:
# - new image SHA, `image_sha`
# - image name, `image_name`
# - service name, `service_name`
# - repository url, embedded in payload response from GitHub webhook
on:
repository_dispatch:
types: [dev-push-*]
concurrency:
group: ${{ github.event.client_payload.deploy_type }}
cancel-in-progress: false
env:
repo_name: ${{ github.event.client_payload.repo_name }}
branch_name: ${{ github.event.client_payload.branch_name }}
service_name: ${{ github.event.client_payload.service_name }}
image_name: ${{ github.event.client_payload.image_name }}
image_sha: ${{ github.event.client_payload.image_sha }}
version: ${{ github.event.client_payload.version }}
image_tag: ${{ github.event.client_payload.version || github.event.client_payload.image_sha }}
jobs:
deploy-service:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.TENDERBOT_GIT_TOKEN }}
repository: "EmerisHQ/${{ env.repo_name }}"
ref: ${{ env.branch_name }}
- name: Deploy
uses: WyriHaximus/github-action-helm3@v2
with:
kubeconfig: "${{ secrets.KUBECONFIG }}"
exec: |
helm upgrade "${{ env.service_name }}" \
--install \
--namespace emeris \
--set debug=true \
--set fixerKey=${{ secrets.FIXER_KEY }} \
--set image=gcr.io/tendermint-dev/"${{ env.image_name }}":"${{ env.image_tag }}" \
--set daggregationPublicBaseUrl=https://api.dev.emeris.com/v1/daggregation \
--set dexInfoSwapsUrl=https://api.dev.emeris.com/v1/dexinfo/swaps \
--set apiServer.sentryEnvironment=dev \
--set apiServer.sentryDSN=${{ secrets.API_SERVER_SENTRY_DSN }} \
--set priceOracle.sentryEnvironment=dev \
--set priceOracle.sentryDSN=${{ secrets.PRICE_ORACLE_SENTRY_DSN }} \
--set redirectURL=https://develop.emeris-admin.pages.dev/login \
--set test=true \
./helm
ingress:
runs-on: self-hosted
needs: deploy-service
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Deploy
uses: steebchen/[email protected]
with:
config: ${{ secrets.KUBECONFIG_B64 }}
command: apply -n emeris -f ci/dev/ingress.yaml
deploy:
runs-on: self-hosted
needs: deploy-service
steps:
- name: Send GitHub trigger payload to Slack Workflow Builder
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"text": "[DEV] new image deployed",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "[DEV] ${{ env.service_name }} upgraded to ${{ env.image_tag }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BACKEND_GHN }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
emit-integration-test:
if: ${{ github.event.client_payload.deploy_type == 'deploy_dev' }}
runs-on: self-hosted
needs: deploy-service
steps:
- name: Emit integration-test event on demeris-backend
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.TENDERBOT_GIT_TOKEN }}
repository: emerishq/demeris-backend
event-type: integration-test
client-payload: |
{
"env": "dev",
"service_name": "${{ env.service_name }}",
"image_tag": "${{ env.image_tag }}"
}