Skip to content

Commit b51e531

Browse files
authored
Sdk automated testing (#241)
* add kubeconform check add k8s-running-test * 1. reduce cpu charts/rollup-explorer-backend/values.yaml 2. reduce cpu charts/blockscout/values.yaml
1 parent 30df052 commit b51e531

File tree

11 files changed

+175
-15
lines changed

11 files changed

+175
-15
lines changed

.github/workflows/publish-dev-chart.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,157 @@ jobs:
198198
export CHART_VERSION=$(grep 'version:' charts/$chart/Chart.yaml | head -n1 | awk '{ print $2 }')
199199
helm push $chart-${CHART_VERSION}.tgz oci://${HELM_REGISTRY}
200200
done
201+
202+
kubeconform:
203+
name: kubeconform-check
204+
runs-on: ubuntu-latest
205+
needs:
206+
- publish-ghcr-scroll-sdk
207+
steps:
208+
- name: Checkout
209+
uses: actions/checkout@v3
210+
with:
211+
fetch-depth: 0
212+
- uses: dorny/paths-filter@v2
213+
id: filter
214+
with:
215+
base: ${{ github.event.repository.default_branch }}
216+
list-files: shell
217+
filters: |
218+
addedOrModified:
219+
- added|modified: 'charts/scroll-sdk/**'
220+
221+
- name: Helm registry login
222+
run: |
223+
helm registry login ghcr.io/scroll-tech/helm/scroll-sdk --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
224+
225+
- name: Replace helm registry by helm/dev
226+
run: |
227+
find charts/ -type f -exec sed -i 's|oci://ghcr.io/scroll-tech/scroll-sdk/helm|oci://ghcr.io/scroll-tech/scroll-sdk/helm/dev|g' {} +
228+
229+
- name: Install Kubeconform
230+
run: |
231+
set -e
232+
wget https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz
233+
tar xf kubeconform-linux-amd64.tar.gz
234+
sudo mv kubeconform /usr/local/bin/
235+
236+
- name: Add Helm repositories
237+
run: |
238+
helm repo add grafana https://grafana.github.io/helm-charts
239+
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
240+
helm repo add blockscout https://blockscout.github.io/helm-charts
241+
helm repo update
242+
243+
- name: Validate rendered templates
244+
run: |
245+
set -e
246+
failed_charts=()
247+
for chart in charts/*; do
248+
if [ -d "$chart" ]; then
249+
echo "Processing chart $chart"
250+
if [[ $(basename $chart) == "common" ]] || [[ $(basename $chart) == "external-secrets-lib" ]]; then
251+
echo "Skipping library chart: $chart"
252+
continue
253+
fi
254+
255+
if ! helm dependency update $chart; then
256+
failed_charts+=("$chart - dependency update failed")
257+
continue
258+
fi
259+
260+
if ! helm dependency build $chart; then
261+
failed_charts+=("$chart - dependency build failed")
262+
continue
263+
fi
264+
265+
if ! helm template $(basename $chart) $chart | kubeconform \
266+
-summary \
267+
-output json \
268+
-schema-location default \
269+
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/servicemonitors-crd.json \
270+
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/alertmanagers-crd.json \
271+
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/prometheusrules-crd.json \
272+
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/prometheuses-crd.json \
273+
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/podmonitors-crd.json \
274+
-strict \
275+
-; then
276+
failed_charts+=("$chart - validation failed")
277+
fi
278+
fi
279+
done
280+
281+
if [ ${#failed_charts[@]} -ne 0 ]; then
282+
echo "faild charts are:"
283+
printf '%s\n' "${failed_charts[@]}"
284+
exit 1
285+
fi
286+
287+
run-k8s-test:
288+
name: check-services-up-and-running
289+
runs-on: ubuntu-latest
290+
needs:
291+
- publish-ghcr-scroll-sdk
292+
steps:
293+
- name: Checkout
294+
uses: actions/checkout@v3
295+
with:
296+
fetch-depth: 0
297+
298+
- name: Set up Helm
299+
uses: azure/setup-helm@v3
300+
with:
301+
version: v3.12.1
302+
303+
- uses: actions/setup-python@v5
304+
with:
305+
python-version: '3.x'
306+
check-latest: true
307+
308+
- name: Set up chart-testing
309+
uses: helm/[email protected]
310+
311+
- name: Replace helm registry by helm/dev
312+
run: |
313+
find devnet/ -type f -exec sed -i 's|oci://ghcr.io/scroll-tech/scroll-sdk/helm|oci://ghcr.io/scroll-tech/scroll-sdk/helm/dev|g' {} +
314+
315+
- name: Create Kind Cluster
316+
uses: helm/[email protected]
317+
with:
318+
cluster_name: chart-testing
319+
320+
- name: Helm registry login
321+
run: |
322+
helm registry login ghcr.io/scroll-tech/helm/scroll-sdk --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
323+
324+
- name: Run Devnet Bootstrap
325+
run: cd devnet && make bootstrap
326+
327+
- name: Install Charts using Makefile
328+
run: |
329+
cd devnet
330+
make install
331+
332+
- name: Ensure all services are up and running
333+
run: |
334+
START_TIME=$(date +%s)
335+
TIMEOUT=600
336+
337+
while true; do
338+
ELAPSED_TIME=$(( $(date +%s) - START_TIME ))
339+
340+
if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then
341+
echo "Timeout reached: Exiting after $TIMEOUT seconds"
342+
exit 1
343+
fi
344+
kubectl get pods
345+
kubectl describe nodes
346+
347+
if kubectl wait --for=condition=Ready pod --all --field-selector=status.phase!=Succeeded,status.phase!=Failed --timeout=5s; then
348+
echo "All pods are ready."
349+
break
350+
else
351+
echo "Waiting for pods to be ready..."
352+
sleep 10
353+
fi
354+
done

charts/blockscout/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v2
33
description: blockscout scroll helm charts
44
name: blockscout
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: v0.1.0
77
kubeVersion: ">=1.22.0-0"
88
maintainers:

charts/blockscout/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# blockscout
22

3-
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
3+
![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
44

55
blockscout scroll helm charts
66

@@ -48,6 +48,8 @@ Kubernetes: `>=1.22.0-0`
4848
| blockscout-stack.blockscout.ingress.className | string | `"nginx"` | |
4949
| blockscout-stack.blockscout.ingress.enabled | bool | `true` | |
5050
| blockscout-stack.blockscout.ingress.hostname | string | `"blockscout-backend.scrollsdk"` | |
51+
| blockscout-stack.blockscout.resources.requests.cpu | string | `"250m"` | |
52+
| blockscout-stack.blockscout.resources.requests.memory | string | `"512Mi"` | |
5153
| blockscout-stack.frontend.env.FAVICON_MASTER_URL | string | `"https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/favicons/scroll_180x180.png"` | |
5254
| blockscout-stack.frontend.env.NEXT_PUBLIC_AD_BANNER_PROVIDER | string | `"none"` | |
5355
| blockscout-stack.frontend.env.NEXT_PUBLIC_AD_TEXT_PROVIDER | string | `"none"` | |

charts/blockscout/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ blockscout-stack:
1010
repository: blockscout/blockscout-scroll
1111
pullPolicy: IfNotPresent
1212
tag: 6.9.0-alpha.1
13+
resources:
14+
requests:
15+
cpu: "250m"
16+
memory: "512Mi"
1317

1418
env:
1519
ETHEREUM_JSONRPC_HTTP_URL: http://l2-rpc:8545

charts/rollup-explorer-backend/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v2
33
description: rollup-explorer-backend helm charts
44
name: rollup-explorer-backend
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: v0.1.0
77
kubeVersion: ">=1.22.0-0"
88
maintainers:

charts/rollup-explorer-backend/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# rollup-explorer-backend
22

3-
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
3+
![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
44

55
rollup-explorer-backend helm charts
66

@@ -72,7 +72,7 @@ Kubernetes: `>=1.22.0-0`
7272
| probes.startup.<<.spec.httpGet.port | int | `8090` | |
7373
| resources.limits.cpu | string | `"3"` | |
7474
| resources.limits.memory | string | `"6Gi"` | |
75-
| resources.requests.cpu | string | `"2"` | |
75+
| resources.requests.cpu | string | `"1"` | |
7676
| resources.requests.memory | string | `"4Gi"` | |
7777
| scrollConfig | string | `"{}\n"` | |
7878
| service.main.enabled | bool | `true` | |

charts/rollup-explorer-backend/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ image:
1515
resources:
1616
requests:
1717
memory: "4Gi"
18-
cpu: "2"
18+
cpu: "100m"
1919
limits:
2020
memory: "6Gi"
2121
cpu: "3"

charts/scroll-sdk/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v2
33
description: scroll helm charts to deploy scroll sdk
44
name: scroll-sdk
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: v0.1.0
77
kubeVersion: ">=1.22.0-0"
88
maintainers:
@@ -22,7 +22,7 @@ dependencies:
2222
repository: "oci://ghcr.io/scroll-tech/scroll-sdk/helm"
2323
condition: balance-checker.enabled
2424
- name: blockscout
25-
version: 0.1.0
25+
version: 0.1.1
2626
repository: "oci://ghcr.io/scroll-tech/scroll-sdk/helm"
2727
condition: blockscout.enabled
2828
- name: bridge-history-api
@@ -82,7 +82,7 @@ dependencies:
8282
version: 15.5.0
8383
condition: postgresql.enabled
8484
- name: rollup-explorer-backend
85-
version: 0.1.0
85+
version: 0.1.1
8686
repository: "oci://ghcr.io/scroll-tech/scroll-sdk/helm"
8787
condition: rollup-explorer-backend.enabled
8888
- name: rollup-node

charts/scroll-sdk/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# scroll-sdk
22

3-
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
3+
![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
44

55
scroll helm charts to deploy scroll sdk
66

@@ -22,7 +22,7 @@ Kubernetes: `>=1.22.0-0`
2222
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | admin-system-cron | 0.1.0 |
2323
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | admin-system-dashboard | 0.1.0 |
2424
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | balance-checker | 0.1.0 |
25-
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | blockscout | 0.1.0 |
25+
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | blockscout | 0.1.1 |
2626
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | blockscout-sc-verifier | 0.0.2 |
2727
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | bridge-history-api | 0.1.0 |
2828
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | bridge-history-fetcher | 0.1.0 |
@@ -37,7 +37,7 @@ Kubernetes: `>=1.22.0-0`
3737
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | l2-bootnode | 0.1.0 |
3838
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | l2-rpc | 0.1.0 |
3939
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | l2-sequencer | 0.1.0 |
40-
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rollup-explorer-backend | 0.1.0 |
40+
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rollup-explorer-backend | 0.1.1 |
4141
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rollup-node | 0.1.0 |
4242
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rpc-gateway | 0.1.0 |
4343
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | scroll-common | 0.1.0 |

devnet/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ L1_RPC_HOST := l1-devnet.scrollsdk
77

88
bootstrap:
99
echo "Pulling helm chart..."
10-
helm pull oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-sdk --version 0.1.0
10+
helm pull oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-sdk --version 0.1.1
1111
echo "Extracting helm chart..."
1212
tar -xvf *.tgz
1313
$(MAKE) config
1414

1515
config:
1616
echo "Creating configuration files..."
17-
cd scroll-sdk && time docker run --rm -it -v .:/contracts/volume scrolltech/scroll-stack-contracts:gen-configs-2eba3d2c418b16f4a66d9baadeb1c1bafdca81b1
17+
cd scroll-sdk && time docker run --rm -v .:/contracts/volume scrolltech/scroll-stack-contracts:gen-configs-2eba3d2c418b16f4a66d9baadeb1c1bafdca81b1
1818
echo "Creating env files..."
1919
./create-env-files.sh scroll-sdk
2020
./prepare-config-files.sh

0 commit comments

Comments
 (0)