-
Notifications
You must be signed in to change notification settings - Fork 6
251 lines (243 loc) · 10.2 KB
/
_shared-run.yaml
File metadata and controls
251 lines (243 loc) · 10.2 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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
on:
workflow_call:
inputs:
config:
type: string
description: "The test configuration in json format."
required: true
send_notification:
type: string
description: "Send discord notification on test failure (default: false)."
default: "false"
use_chatgpt:
type: string
description: "Use AI (Claude Code via OpenRouter) to debug and analyze test failures (default: false)."
default: "false"
s3_bucket:
type: string
description: "The S3 bucket to use for the cache."
default: ""
s3_endpoint:
type: string
description: "The S3 endpoint to use for the cache."
default: ""
s3_insecure:
type: string
description: "Whether to use insecure S3 connection."
default: "false"
s3_path:
type: string
description: "The S3 path to use for the cache."
default: ""
assertoor_image:
type: string
description: "Override assertoor image to use."
default: "ethpandaops/assertoor:master"
stagger_seconds:
type: string
description: "Seconds between staggered job starts (0 to disable)."
default: "0"
secrets:
RANCHER_TOKEN:
description: "The rancher token to login to the rancher server."
RANCHER_URL:
description: "The rancher url to login to the rancher server."
DISCORD_HOOK:
description: 'Discord hook'
required: false
CHATGPT_KEY:
description: 'ChatGPT Key'
required: false
OPENROUTER_API_KEY:
description: 'OpenRouter API Key'
required: false
S3_ACCESS_KEY:
description: 'S3 Access Key'
required: false
S3_SECRET_KEY:
description: 'S3 Secret Key'
required: false
jobs:
get_test:
name: "Prepare Test"
runs-on: ubuntu-latest
outputs:
id: ${{ steps.config.outputs.id }}
name: ${{ steps.config.outputs.name }}
clients: ${{ steps.config.outputs.clients }}
kurtosis: ${{ steps.config.outputs.kurtosis }}
kurtosis_version: ${{ steps.config.outputs.kurtosis_version }}
kurtosis_branch: ${{ steps.config.outputs.kurtosis_branch }}
worker: ${{ steps.config.outputs.worker }}
backend: ${{ steps.config.outputs.backend }}
send_notification: ${{ steps.config.outputs.send_notification }}
pairs: ${{ steps.config.outputs.pairs }}
pairsidx: ${{ steps.config.outputs.pairsidx }}
assertoor_tests: ${{ steps.config.outputs.assertoor_tests }}
kubernetes_cluster: ${{ steps.config.outputs.kubernetes_cluster }}
kubernetes_storageclass: ${{ steps.config.outputs.kubernetes_storageclass }}
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }}
summary_script: ${{ steps.config.outputs.summary_script }}
steps:
- name: "Parse test configuration"
id: config
shell: bash
run: |
send_notification="${{ inputs.send_notification }}"
testcfg=$(
cat <<"EOF"
${{ inputs.config }}
EOF
)
id="$(echo "$testcfg" | jq -r .id)"
name="$(echo "$testcfg" | jq -r .name)"
clients="$(echo "$testcfg" | jq -r .clients)"
kurtosis="$(echo "$testcfg" | jq -r .kurtosis)"
kurtosis_version="$(echo "$testcfg" | jq -r .kurtosis_version)"
kurtosis_branch="$(echo "$testcfg" | jq -r '.kurtosis_branch // ""')"
worker="$(echo "$testcfg" | jq -c .worker)"
backend="$(echo "$testcfg" | jq -r .backend)"
skip_notifications="$(echo "$testcfg" | jq -r .skip_notifications)"
kubernetes_cluster="$(echo "$testcfg" | jq -r .kubernetes.cluster)"
kubernetes_storageclass="$(echo "$testcfg" | jq -r .kubernetes.storageClass)"
pairs="$(echo "$testcfg" | jq -c .clientPairs)"
assertoor_tests="$(echo "$testcfg" | jq -c .assertoorTests)"
summary_script="$(echo "$testcfg" | jq -c .summaryScript)"
echo "ID: $id"
echo "id=$(echo "$id")" >> $GITHUB_OUTPUT
echo "Name: $name"
echo "name=$(echo "$name")" >> $GITHUB_OUTPUT
echo "Clients yaml: $clients"
echo "clients=$(echo "$clients")" >> $GITHUB_OUTPUT
echo "Kurtosis version: $kurtosis_version"
echo "kurtosis_version=$(echo "$kurtosis_version")" >> $GITHUB_OUTPUT
echo "Kurtosis yaml: $kurtosis"
echo "kurtosis=$(echo "$kurtosis")" >> $GITHUB_OUTPUT
echo "Kurtosis package branch: $kurtosis_branch"
echo "kurtosis_branch=$(echo "$kurtosis_branch")" >> $GITHUB_OUTPUT
echo "Worker: $worker"
echo "worker=$(echo "$worker")" >> $GITHUB_OUTPUT
echo "Backend: $backend"
echo "backend=$(echo "$backend")" >> $GITHUB_OUTPUT
if [ "$backend" == "kubernetes" ]; then
echo "Kubernetes Cluster: $kubernetes_cluster"
echo "kubernetes_cluster=$(echo "$kubernetes_cluster")" >> $GITHUB_OUTPUT
echo "Kubernetes Storage Class: $kubernetes_storageclass"
echo "kubernetes_storageclass=$(echo "$kubernetes_storageclass")" >> $GITHUB_OUTPUT
else
echo "kubernetes_cluster=" >> $GITHUB_OUTPUT
echo "kubernetes_storageclass=" >> $GITHUB_OUTPUT
fi
if [ "$skip_notifications" == "true" ]; then
echo "Notifications: false"
echo "send_notification=false" >> $GITHUB_OUTPUT
else
echo "Notifications: $send_notification"
echo "send_notification=$send_notification" >> $GITHUB_OUTPUT
fi
echo "Client Pairs:"
echo "$pairs" | yq -P
echo "pairs=$(echo "$pairs" | jq -c 'to_entries | map({pairs:.value, index:.key})')" >> $GITHUB_OUTPUT
echo "pairsidx=$(echo "$pairs" | jq -c 'to_entries | map(.key)')" >> $GITHUB_OUTPUT
echo "Assertoor Tests:"
echo "$assertoor_tests" | yq -P
echo "assertoor_tests=$(echo "$assertoor_tests")" >> $GITHUB_OUTPUT
echo "Summary Script: $summary_script"
echo "summary_script=$(echo "$summary_script")" >> $GITHUB_OUTPUT
# Generate kubeconfig for kubernetes backend
- name: "Install rancher CLI"
if: ${{ steps.config.outputs.backend == 'kubernetes' }}
shell: bash
run: |
curl -L https://github.com/rancher/cli/releases/download/v2.8.0/rancher-linux-amd64-v2.8.0.tar.gz | tar xvz
mv ./rancher-v2.8.0/rancher /usr/local/bin/rancher
- name: Login to rancher
if: ${{ steps.config.outputs.backend == 'kubernetes' }}
shell: bash
run: |
rancher login --token "${{ secrets.RANCHER_TOKEN }}" "${{ secrets.RANCHER_URL }}" --context c-m-2m5z22jp:p-8vpkn
- name: Login to kubernetes cluster
if: ${{ steps.config.outputs.backend == 'kubernetes' }}
shell: bash
run: |
rancher kubectl config use-context "${{ steps.config.outputs.kubernetes_cluster }}"
- name: Generate kubeconfig
if: ${{ steps.config.outputs.backend == 'kubernetes' }}
id: kubeconfig
shell: bash
run: |
rancher kubectl config view --raw > kubeconfig
echo "kubeconfig=$(cat kubeconfig | base64 -w 0)" >> $GITHUB_OUTPUT
run_test:
needs: get_test
strategy:
fail-fast: false
matrix:
index: ${{ fromJson(needs.get_test.outputs.pairsidx) }}
include: ${{ fromJson(needs.get_test.outputs.pairs) }}
name: "run"
uses: ./.github/workflows/_shared-run-test.yaml
with:
id: "${{ needs.get_test.outputs.id }}-${{ matrix.index }}"
stagger_seconds: ${{ inputs.stagger_seconds }}
name: "${{ needs.get_test.outputs.name }}"
pairs: ${{ matrix.pairs }}
worker: ${{ needs.get_test.outputs.worker }}
kurtosis: ${{ needs.get_test.outputs.kurtosis }}
kurtosis_version: ${{ needs.get_test.outputs.kurtosis_version }}
kurtosis_branch: ${{ needs.get_test.outputs.kurtosis_branch }}
backend: ${{ needs.get_test.outputs.backend }}
kubeCluster: ${{ needs.get_test.outputs.kubernetes_cluster }}
kubeStorageClass: ${{ needs.get_test.outputs.kubernetes_storageclass }}
clients: ${{ needs.get_test.outputs.clients }}
assertoor_tests: ${{ needs.get_test.outputs.assertoor_tests }}
send_notification: ${{ needs.get_test.outputs.send_notification }}
use_chatgpt: ${{ inputs.use_chatgpt }}
s3_bucket: ${{ inputs.s3_bucket }}
s3_endpoint: ${{ inputs.s3_endpoint }}
s3_insecure: ${{ inputs.s3_insecure }}
s3_path: ${{ inputs.s3_path }}
assertoor_image: ${{ inputs.assertoor_image }}
secrets:
KUBECONFIG: ${{ needs.get_test.outputs.kubeconfig }}
DISCORD_HOOK: ${{ secrets.DISCORD_HOOK }}
CHATGPT_KEY: ${{ secrets.CHATGPT_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
generate_summary:
name: "Generate Summary"
if: ${{ always() && needs.get_test.outputs.summary_script != '' }}
runs-on: ubuntu-latest
needs: [get_test, run_test]
steps:
- name: Checkout Repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Get summary artifacts
id: "summary_ids"
run: |
artifacts=$(gh api /repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '[.artifacts[] | {id, name}]')
summary_artifacts=$(echo "$artifacts" | jq -c --arg id "${{ needs.get_test.outputs.id }}" '[.[] | select(.name | test("^summary-" + $id + "-")) | .id]' | tr -d "[]")
echo "artifact_ids=$summary_artifacts" >> $GITHUB_OUTPUT
mkdir ./summaries
env:
GH_TOKEN: ${{ github.token }}
- name: Download summary artifacts
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
artifact-ids: ${{ steps.summary_ids.outputs.artifact_ids }}
path: "./summaries"
- name: "Parse test configuration"
id: config
shell: bash
run: |
summary_script="${{ needs.get_test.outputs.summary_script }}"
pairs=$(
cat <<"EOF"
${{ needs.get_test.outputs.pairs }}
EOF
)
if [ -f "$summary_script" ]; then
source $summary_script
generate_summary
fi