-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (121 loc) · 4.51 KB
/
run-performance.yaml
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
name: Run Performance test
on:
workflow_dispatch: # manually triggered
inputs:
test_name:
type: string
description: Folder name under "performance" that contains yaml
required: true
js_ceramic_image:
type: string
description: Image for js-ceramic
required: true
default: ceramicnetwork/js-ceramic:latest
rust_ceramic_image:
type: string
description: Image for rust-ceramic
required: true
default: public.ecr.aws/r5b3e0r5/3box/ceramic-one:latest
scenario_image:
type: string
description: Image for scenario
required: true
default: public.ecr.aws/r5b3e0r5/3box/keramik-runner:latest
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
run-performance-test:
name: Run Performance Test ${{ github.run_id }}
runs-on: ubuntu-latest
environment: cas-scaling-2024
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install yq
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:rmescandon/yq
sudo apt-get update
sudo apt-get install -y yq
- name: Template network
run: |
set -exo pipefail
export RUST_CERAMIC_IMAGE=${{ inputs.rust_ceramic_image }}
export SCENARIO_IMAGE=${{ inputs.scenario_image }}
export JS_CERAMIC_IMAGE=${{ inputs.js_ceramic_image }}
export TEST_NAME=${{ inputs.test_name }}
ls -l performance/$TEST_NAME
export THIS_TEST=${{ inputs.test_name }}-${{ github.run_id }}
mkdir -p performance/$THIS_TEST
# set the network name yaml key to the test names
yq e '.metadata.name = env(THIS_TEST)' performance/$TEST_NAME/network.yaml \
> performance/$THIS_TEST/network.yaml
cat performance/$THIS_TEST/network.yaml
echo "THIS_TEST=$THIS_TEST" >> $GITHUB_ENV
echo "THIS_TEST_NAMESPACE=keramik-${THIS_TEST}" >> $GITHUB_ENV
echo "TEST_NAME=${TEST_NAME}" >> $GITHUB_ENV
- name: Setup GKE auth
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Get GKE credentials
uses: 'google-github-actions/get-gke-credentials@v1'
with:
cluster_name: ${{ vars.GKE_CLUSTER }}
location: ${{ vars.GKE_ZONE }}
- name: Deploy network
run: |
kubectl apply -f performance/$THIS_TEST/network.yaml
- name: Wait for bootstrap to complete
timeout-minutes: 8
run: |
set -exo pipefail
sleep 60
kubectl wait --for=condition=ready \
--timeout=240s \
pod \
-l app=ceramic \
-n ${THIS_TEST_NAMESPACE}
sleep 60
kubectl wait --for=condition=complete \
--timeout=120s \
job/bootstrap \
-n ${THIS_TEST_NAMESPACE}
- name: Template simulation
run: |
set -exo pipefail
yq e '.metadata.namespace = env(THIS_TEST_NAMESPACE)' performance/$TEST_NAME/simulation.yaml \
> performance/$THIS_TEST/simulation.yaml
cat performance/$THIS_TEST/simulation.yaml
- name: Run simulation
run: |
set -exo pipefail
kubectl apply -f performance/$THIS_TEST/simulation.yaml
SIMULATION_RUNTIME=$(yq e '.spec.runTime' performance/$THIS_TEST/simulation.yaml)
echo "SIMULATION_RUNTIME=${SIMULATION_RUNTIME}" >> $GITHUB_ENV
- name: Notify Discord
env:
SIMULATION_COLOR: 3066993
run: |
set -exo pipefail
export SIMULATION_STATUS_TAG="Simulation $THIS_TEST started"
export CLUSTER_NAME=${{ vars.GKE_CLUSTER }}
envsubst < notifications/notification-template.json > message.json
cat message.json
curl -v -H "Content-Type: application/json" -X POST -d @./message.json "${{ secrets.DISCORD_WEBHOOK_URL_SUCCEEDED }}"
- name: Wait for simulation to complete
run: |
set -exo pipefail
# runtime is in minutes
sleep $((${SIMULATION_RUNTIME} * 60))
kubectl wait --for=condition=complete \
--timeout=120s \
job/simulate-manager \
-n ${THIS_TEST_NAMESPACE}
- name: Cleanup
if: always()
run: |
kubectl delete -f performance/$THIS_TEST/network.yaml