-
Notifications
You must be signed in to change notification settings - Fork 139
282 lines (253 loc) · 9.96 KB
/
acceptance.yaml
File metadata and controls
282 lines (253 loc) · 9.96 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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# SPDX-License-Identifier: Apache-2.0
name: End-to-end Tests
on:
pull_request:
branches:
- "main"
- "release/**"
paths:
- ".github/workflows/acceptance.yaml"
- "test/**"
push:
branches:
- "main"
- "release/**"
workflow_dispatch:
inputs:
branch:
description: "Branch"
required: true
type: string
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
acceptance:
runs-on: hiero-mirror-node-linux-large
strategy:
fail-fast: false
matrix:
stream-type:
- RECORD
- BLOCK
timeout-minutes: 50
env:
BLOCK_NODE_CHART_VERSION: v0.24.2
CONSENSUS_VERSION: v0.69.1-rc.3
HELM_RELEASE_NAME: mirror-1
SOLO_CLUSTER_NAME: test
SOLO_NAMESPACE: mirror
SOLO_CLUSTER_SETUP_NAMESPACE: solo
SOLO_DEPLOYMENT: solo-deployment
SOLO_VERSION: v0.52.0
permissions:
pull-requests: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || '' }}
- name: Setup Node
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 24
- name: Install Helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
with:
version: "3.19.2"
- name: Setup Kind
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
with:
cluster_name: ${{ env.SOLO_CLUSTER_NAME }}
kubectl_version: v1.33.7
- name: Install JDK
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
- name: Install Solo CLI via npm
run: npm install -g @hashgraph/solo@${SOLO_VERSION}
- name: Determine base and tag
timeout-minutes: 15
run: |
set -ex
TAG=$(sed -nE 's/^version: (.+)$/\1/p' charts/hedera-mirror/Chart.yaml)
BASE=""
TRIGGERED_BY_TAG=false
if [[ "$TAG" != *SNAPSHOT ]]; then
BASE="v$TAG"
# The dereferenced tag corresponds to the commit the annotated tag refers to
DEREFERENCED_TAG="v${TAG}^{}"
git ls-remote --tags origin "${DEREFERENCED_TAG}" | grep $(git rev-parse HEAD) && TRIGGERED_BY_TAG=true \
|| true
fi
echo "BASE=${BASE}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "TRIGGERED_BY_TAG=${TRIGGERED_BY_TAG}" >> $GITHUB_ENV
if [[ "$TRIGGERED_BY_TAG" == "true" ]]; then
# wait for images becoming ready if it's a tagged commit
for module in grpc importer monitor rest rest-java test web3; do
while ! docker manifest inspect "gcr.io/mirrornode/hedera-mirror-$module:$TAG" >/dev/null 2>&1; do
sleep 10
done
done
fi
- name: Find changed modules
id: changeset
if: env.TRIGGERED_BY_TAG != 'true'
uses: step-security/paths-filter@6eee183b0d2fd101d3f8ee2935c127bca14c5625 # v3.0.5
with:
base: ${{ env.BASE }}
filters: |
grpc:
- 'grpc/**'
importer:
- 'importer/**'
monitor:
- 'monitor/**'
rest:
- 'rest/!(check-state-proof|monitoring)?(/**)'
rest-java:
- 'rest-java/**'
test:
- 'test/**'
web3:
- 'web3/**'
- name: Build images
if: env.TRIGGERED_BY_TAG != 'true' && steps.changeset.outputs.changes != '[]'
run: |
set -ex
echo '${{ steps.changeset.outputs.changes }}' | jq -r '.[]' | while read module; do
./gradlew ":${module}:dockerBuild" -x :rest:monitoring:dockerBuild -PimageTag="${TAG}"
kind load docker-image "gcr.io/mirrornode/hedera-mirror-${module}:${TAG}" -n "${SOLO_CLUSTER_NAME}"
done
- name: Setup Solo Cluster
run: |
set -ex
solo init
solo cluster-ref config connect --cluster-ref kind-"${SOLO_CLUSTER_NAME}" \
--context kind-"${SOLO_CLUSTER_NAME}"
solo deployment config create --deployment "${SOLO_DEPLOYMENT}" --namespace "${SOLO_NAMESPACE}"
solo deployment cluster attach --deployment "${SOLO_DEPLOYMENT}" --cluster-ref kind-"${SOLO_CLUSTER_NAME}" \
--num-consensus-nodes 1
solo cluster-ref config setup --cluster-ref kind-"${SOLO_CLUSTER_NAME}"
if [ "${{ matrix.stream-type }}" = "BLOCK" ]; then
solo block node add --deployment "${SOLO_DEPLOYMENT}" --cluster-ref kind-"${SOLO_CLUSTER_NAME}" \
--chart-version "${BLOCK_NODE_CHART_VERSION}" --release-tag "${CONSENSUS_VERSION}"
fi
solo keys consensus generate --gossip-keys --tls-keys --deployment "${SOLO_DEPLOYMENT}" -i node1
solo consensus network deploy --deployment "${SOLO_DEPLOYMENT}" --release-tag "${CONSENSUS_VERSION}"
solo consensus node setup --deployment "${SOLO_DEPLOYMENT}" -i node1 --release-tag "${CONSENSUS_VERSION}"
solo consensus node start --deployment "${SOLO_DEPLOYMENT}" -i node1
if [ "${{ matrix.stream-type }}" = "BLOCK" ]; then
cat <<EOF > mirror.yaml
importer:
env:
HIERO_MIRROR_IMPORTER_BLOCK_NODES_0_HOST: 'block-node-1.${SOLO_NAMESPACE}.svc.cluster.local'
SPRING_PROFILES_ACTIVE: 'blocknode'
monitor:
env:
HIERO_MIRROR_MONITOR_HEALTH_RELEASE_FAILWHENINACTIVE: "true"
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
enabled: true
rest:
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
restjava:
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
test:
cucumberTags: "@acceptance and not @ethereum and not @ethcall and not @crud"
annotations:
helm.sh/hook-delete-policy: before-hook-creation
env:
HIERO_MIRROR_TEST_ACCEPTANCE_FEATURE_CONTRACTCALLLOCALESTIMATE: "true"
HIERO_MIRROR_TEST_ACCEPTANCE_NETWORK: OTHER
HIERO_MIRROR_TEST_ACCEPTANCE_WEB3_OPCODETRACER_ENABLED: "true"
enabled: true
web3:
env:
HIERO_MIRROR_WEB3_OPCODE_TRACER_ENABLED: "true"
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
EOF
else
cat <<EOF > mirror.yaml
monitor:
env:
HIERO_MIRROR_MONITOR_HEALTH_RELEASE_FAILWHENINACTIVE: "true"
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
enabled: true
rest:
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
restjava:
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
env:
HIERO_MIRROR_TEST_ACCEPTANCE_FEATURE_CONTRACTCALLLOCALESTIMATE: "true"
HIERO_MIRROR_TEST_ACCEPTANCE_NETWORK: OTHER
HIERO_MIRROR_TEST_ACCEPTANCE_WEB3_OPCODETRACER_ENABLED: "true"
HIERO_MIRROR_TEST_ACCEPTANCE_SKIPENTITIESCLEANUP: "true"
enabled: true
web3:
env:
HIERO_MIRROR_WEB3_OPCODE_TRACER_ENABLED: "true"
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
EOF
fi
helm dependency update charts/hedera-mirror
solo mirror node add --cluster-ref kind-"${SOLO_CLUSTER_NAME}" --deployment "${SOLO_DEPLOYMENT}" \
-f mirror.yaml --mirror-node-chart-dir ./charts --pinger --enable-ingress
APP_VERSION=$(helm ls -n "${SOLO_NAMESPACE}" -o json \
| jq -r '.[] | select (.chart | test("hedera-mirror-.*")) | .app_version')
echo "Installed hedera-mirror chart version $APP_VERSION"
echo "Solo cluster setup completed successfully!"
- name: Run acceptance tests
run: |
helm test "${HELM_RELEASE_NAME}" -n "${SOLO_NAMESPACE}" --logs \
--timeout 20m | tee output_log.txt
- name: Run k6 tests
if: ${{ matrix.stream-type != 'BLOCK' }}
env:
BASE_URL: "http://127.0.0.1:8081"
DEFAULT_DURATION: "3s"
DEFAULT_GRACEFUL_STOP: "1s"
DEFAULT_VUS: 2
uses: ./.github/actions/k6
- name: Show Pod Logs on Failure
continue-on-error: true
if: ${{ failure() }}
run: |
echo "--------------------------------------------------"
echo "Workflow failed. Collecting logs for debugging..."
echo "--------------------------------------------------"
echo "--- Describing all pods in namespace ${SOLO_NAMESPACE} ---"
kubectl describe pods -n "${SOLO_NAMESPACE}" || echo "Could not describe pods"
echo "--- Fetching logs for all pods in namespace ${SOLO_NAMESPACE} ---"
for pod in $(kubectl get pods -n "${SOLO_NAMESPACE}" -o name); do
if [ -n "$pod" ]; then
echo "--- Logs for pod: $pod ---"
kubectl logs "$pod" -n "${SOLO_NAMESPACE}" --all-containers=true --tail=10000 || echo "Could not get logs for pod $pod"
fi
done