Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdk automated testing #232

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/publish-dev-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,157 @@ jobs:
export CHART_VERSION=$(grep 'version:' charts/$chart/Chart.yaml | head -n1 | awk '{ print $2 }')
helm push $chart-${CHART_VERSION}.tgz oci://${HELM_REGISTRY}
done

kubeconform:
name: kubeconform-check
runs-on: ubuntu-latest
needs:
- publish-ghcr-scroll-sdk
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.event.repository.default_branch }}
list-files: shell
filters: |
addedOrModified:
- added|modified: 'charts/scroll-sdk/**'

- name: Helm registry login
run: |
helm registry login ghcr.io/scroll-tech/helm/scroll-sdk --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}

- name: Replace helm registry by helm/dev
run: |
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' {} +

- name: Install Kubeconform
run: |
set -e
wget https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz
tar xf kubeconform-linux-amd64.tar.gz
sudo mv kubeconform /usr/local/bin/

- name: Add Helm repositories
run: |
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add blockscout https://blockscout.github.io/helm-charts
helm repo update

- name: Validate rendered templates
run: |
set -e
failed_charts=()
for chart in charts/*; do
if [ -d "$chart" ]; then
echo "Processing chart $chart"
if [[ $(basename $chart) == "common" ]] || [[ $(basename $chart) == "external-secrets-lib" ]]; then
echo "Skipping library chart: $chart"
continue
fi

if ! helm dependency update $chart; then
failed_charts+=("$chart - dependency update failed")
continue
fi

if ! helm dependency build $chart; then
failed_charts+=("$chart - dependency build failed")
continue
fi

if ! helm template $(basename $chart) $chart | kubeconform \
-summary \
-output json \
-schema-location default \
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/servicemonitors-crd.json \
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/alertmanagers-crd.json \
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/prometheusrules-crd.json \
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/prometheuses-crd.json \
-schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/podmonitors-crd.json \
-strict \
-; then
failed_charts+=("$chart - validation failed")
fi
fi
done

if [ ${#failed_charts[@]} -ne 0 ]; then
echo "faild charts are:"
printf '%s\n' "${failed_charts[@]}"
exit 1
fi

run-k8s-test:
name: check-services-up-and-running
runs-on: ubuntu-latest
needs:
- publish-ghcr-scroll-sdk
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.12.1

- uses: actions/setup-python@v5
with:
python-version: '3.x'
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.0

- name: Replace helm registry by helm/dev
run: |
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' {} +

- name: Create Kind Cluster
uses: helm/kind-action@v1.8.0
with:
cluster_name: chart-testing

- name: Helm registry login
run: |
helm registry login ghcr.io/scroll-tech/helm/scroll-sdk --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}

- name: Run Devnet Bootstrap
run: cd devnet && make bootstrap

- name: Install Charts using Makefile
run: |
cd devnet
make install

- name: Ensure all services are up and running
run: |
START_TIME=$(date +%s)
TIMEOUT=600

while true; do
ELAPSED_TIME=$(( $(date +%s) - START_TIME ))

if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then
echo "Timeout reached: Exiting after $TIMEOUT seconds"
exit 1
fi
kubectl get pods
kubectl describe nodes

if kubectl wait --for=condition=Ready pod --all --field-selector=status.phase!=Succeeded,status.phase!=Failed --timeout=5s; then
echo "All pods are ready."
break
else
echo "Waiting for pods to be ready..."
sleep 10
fi
done
2 changes: 1 addition & 1 deletion charts/blockscout/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v2
description: blockscout scroll helm charts
name: blockscout
version: 0.1.0
version: 0.1.1
appVersion: v0.1.0
kubeVersion: ">=1.22.0-0"
maintainers:
Expand Down
4 changes: 3 additions & 1 deletion charts/blockscout/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# blockscout

![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)
![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)

blockscout scroll helm charts

Expand Down Expand Up @@ -48,6 +48,8 @@ Kubernetes: `>=1.22.0-0`
| blockscout-stack.blockscout.ingress.className | string | `"nginx"` | |
| blockscout-stack.blockscout.ingress.enabled | bool | `true` | |
| blockscout-stack.blockscout.ingress.hostname | string | `"blockscout-backend.scrollsdk"` | |
| blockscout-stack.blockscout.resources.requests.cpu | string | `"250m"` | |
| blockscout-stack.blockscout.resources.requests.memory | string | `"512Mi"` | |
| blockscout-stack.frontend.env.FAVICON_MASTER_URL | string | `"https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/favicons/scroll_180x180.png"` | |
| blockscout-stack.frontend.env.NEXT_PUBLIC_AD_BANNER_PROVIDER | string | `"none"` | |
| blockscout-stack.frontend.env.NEXT_PUBLIC_AD_TEXT_PROVIDER | string | `"none"` | |
Expand Down
4 changes: 4 additions & 0 deletions charts/blockscout/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ blockscout-stack:
repository: blockscout/blockscout-scroll
pullPolicy: IfNotPresent
tag: 6.9.0-alpha.1
resources:
requests:
cpu: "250m"
memory: "512Mi"

env:
ETHEREUM_JSONRPC_HTTP_URL: http://l2-rpc:8545
Expand Down
2 changes: 1 addition & 1 deletion charts/rollup-explorer-backend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v2
description: rollup-explorer-backend helm charts
name: rollup-explorer-backend
version: 0.1.0
version: 0.1.1
appVersion: v0.1.0
kubeVersion: ">=1.22.0-0"
maintainers:
Expand Down
4 changes: 2 additions & 2 deletions charts/rollup-explorer-backend/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rollup-explorer-backend

![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)
![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)

rollup-explorer-backend helm charts

Expand Down Expand Up @@ -72,7 +72,7 @@ Kubernetes: `>=1.22.0-0`
| probes.startup.<<.spec.httpGet.port | int | `8090` | |
| resources.limits.cpu | string | `"3"` | |
| resources.limits.memory | string | `"6Gi"` | |
| resources.requests.cpu | string | `"2"` | |
| resources.requests.cpu | string | `"1"` | |
| resources.requests.memory | string | `"4Gi"` | |
| scrollConfig | string | `"{}\n"` | |
| service.main.enabled | bool | `true` | |
Expand Down
2 changes: 1 addition & 1 deletion charts/rollup-explorer-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ image:
resources:
requests:
memory: "4Gi"
cpu: "2"
cpu: "100m"
limits:
memory: "6Gi"
cpu: "3"
Expand Down
6 changes: 3 additions & 3 deletions charts/scroll-sdk/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v2
description: scroll helm charts to deploy scroll sdk
name: scroll-sdk
version: 0.1.0
version: 0.1.1
appVersion: v0.1.0
kubeVersion: ">=1.22.0-0"
maintainers:
Expand All @@ -22,7 +22,7 @@ dependencies:
repository: "oci://ghcr.io/scroll-tech/scroll-sdk/helm"
condition: balance-checker.enabled
- name: blockscout
version: 0.1.0
version: 0.1.1
repository: "oci://ghcr.io/scroll-tech/scroll-sdk/helm"
condition: blockscout.enabled
- name: bridge-history-api
Expand Down Expand Up @@ -82,7 +82,7 @@ dependencies:
version: 15.5.0
condition: postgresql.enabled
- name: rollup-explorer-backend
version: 0.1.0
version: 0.1.1
repository: "oci://ghcr.io/scroll-tech/scroll-sdk/helm"
condition: rollup-explorer-backend.enabled
- name: rollup-node
Expand Down
6 changes: 3 additions & 3 deletions charts/scroll-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# scroll-sdk

![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)
![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)

scroll helm charts to deploy scroll sdk

Expand All @@ -22,7 +22,7 @@ Kubernetes: `>=1.22.0-0`
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | admin-system-cron | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | admin-system-dashboard | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | balance-checker | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | blockscout | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | blockscout | 0.1.1 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | blockscout-sc-verifier | 0.0.2 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | bridge-history-api | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | bridge-history-fetcher | 0.1.0 |
Expand All @@ -37,7 +37,7 @@ Kubernetes: `>=1.22.0-0`
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | l2-bootnode | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | l2-rpc | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | l2-sequencer | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rollup-explorer-backend | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rollup-explorer-backend | 0.1.1 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rollup-node | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | rpc-gateway | 0.1.0 |
| oci://ghcr.io/scroll-tech/scroll-sdk/helm | scroll-common | 0.1.0 |
Expand Down
4 changes: 2 additions & 2 deletions devnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ L1_RPC_HOST := l1-devnet.scrollsdk

bootstrap:
echo "Pulling helm chart..."
helm pull oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-sdk --version 0.1.0
helm pull oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-sdk --version 0.1.1
echo "Extracting helm chart..."
tar -xvf *.tgz
$(MAKE) config

config:
echo "Creating configuration files..."
cd scroll-sdk && time docker run --rm -it -v .:/contracts/volume scrolltech/scroll-stack-contracts:gen-configs-2eba3d2c418b16f4a66d9baadeb1c1bafdca81b1
cd scroll-sdk && time docker run --rm -v .:/contracts/volume scrolltech/scroll-stack-contracts:gen-configs-2eba3d2c418b16f4a66d9baadeb1c1bafdca81b1
echo "Creating env files..."
./create-env-files.sh scroll-sdk
./prepare-config-files.sh
Expand Down
2 changes: 1 addition & 1 deletion examples/Makefile.example
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ install:
--values values/l2-rpc-production.yaml

helm upgrade -i rollup-explorer-backend oci://ghcr.io/scroll-tech/scroll-sdk/helm/rollup-explorer-backend -n $(NAMESPACE) \
--version=0.1.0 \
--version=0.1.1 \
--values values/rollup-explorer-backend-production.yaml \
--values values/rollup-explorer-backend-config.yaml

Expand Down