Repository navigation
95 lines (92 loc) · 3.42 KB
/
Copy pathdeploy.yml
File metadata and controls
95 lines (92 loc) · 3.42 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
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
name: deploy
on: deployment
jobs:
deploy:
# the CodeBuild runner of the deploy workflow, defined in the codebuild
# stack of fluid-hft: it runs as the deploy role, so the job gets its AWS
# credentials from CodeBuild
runs-on: codebuild-quantmind-quantflow-deploy-${{ github.run_id }}-${{ github.run_attempt }}
permissions:
contents: read
env:
K8S_ENV: ${{ github.event.deployment.environment }}
IMAGE_TAG: ${{ github.event.deployment.payload.tag }}
METABLOCK_API_TOKEN: ${{ secrets.METABLOCK_API_TOKEN }}
METABLOCK_ORG_ID: ${{ secrets.METABLOCK_ORG_ID }}
RUST_LOG: info
# rops looks up the latest helm and helm-secrets releases on GitHub
GITHUB_TOKEN: ${{ secrets.TOKEN_DEPLOYMENT }}
steps:
- name: Update deployment status (in_progress)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: "${{ secrets.TOKEN_DEPLOYMENT }}"
deployment-id: ${{ github.event.deployment.id }}
state: "in_progress"
- name: checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.deployment.sha }}
- name: checkout vars
uses: actions/checkout@v4
with:
repository: quantmind/metaplatform
path: metaplatform
token: ${{ secrets.TOKEN_DEPLOYMENT }}
# the Kubernetes API endpoint is private: the runner joins the tailnet
# for the length of the job and reaches it through the vpc-router
# Connector of the tailscale-connector chart in fluid-hft
- name: Join the tailnet
uses: tailscale/github-action@v3
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: install rops
uses: quantmind/rops/.github/actions/setup-rops@main
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_DEPLOYMENT }}
# the CodeBuild runner image does not ship helm
- name: install helm
run: |
rops tools update helm
helm version
- name: Install mozilla sops
uses: mdgreenwald/mozilla-sops-action@v1.4.1
- name: deploy quantflow
run: |
rops charts update
rops charts deploy \
quantflow \
--env ${K8S_ENV} \
--set image.tag=${IMAGE_TAG} \
--wait
- name: Update ingress configuration
uses: quantmind/metablock-ingress@v2
with:
space: quantmind
path: dev/blocks
# tailscaled keeps running after the job, and a CodeBuild build only
# ends once every process in it has exited, so stop it, even when an
# earlier step failed. Logging out also removes the runner from the
# tailnet at once.
- name: Leave the tailnet
if: always()
run: |
sudo tailscale logout || true
sudo pkill tailscaled || true
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: "${{ secrets.TOKEN_DEPLOYMENT }}"
deployment-id: ${{ github.event.deployment.id }}
state: "success"
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: "${{ secrets.TOKEN_DEPLOYMENT }}"
deployment-id: ${{ github.event.deployment.id }}
state: "failure"