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

[WIP] k8s workflow tests #1168

Draft
wants to merge 144 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
e40d102
add files
rebelArtists Jan 30, 2024
1239a46
test workflow
rebelArtists Jan 30, 2024
c6bdc0c
test
rebelArtists Jan 30, 2024
52f7a45
testing
rebelArtists Jan 30, 2024
bcbc450
still testing
rebelArtists Jan 30, 2024
d95fc90
keep testing
rebelArtists Jan 30, 2024
458fa9e
try again
rebelArtists Jan 30, 2024
90137d6
test again
rebelArtists Jan 30, 2024
4d0d015
test again
rebelArtists Jan 30, 2024
0721024
moar tests
rebelArtists Jan 30, 2024
d112e87
keep testing
rebelArtists Jan 30, 2024
f4d1f0d
keep iterating
rebelArtists Jan 30, 2024
5380723
clone private repo
rebelArtists Jan 30, 2024
15d007a
clone private devnets
rebelArtists Jan 30, 2024
4ecd4ab
git clone ssh
rebelArtists Jan 30, 2024
5270854
install tomlq
rebelArtists Jan 30, 2024
b44e079
free disk
rebelArtists Jan 31, 2024
17bec59
rm large pkgs
rebelArtists Jan 31, 2024
62f826e
rm pkgs
rebelArtists Jan 31, 2024
756fe37
free disk'
rebelArtists Jan 31, 2024
b6b1522
free more disk
rebelArtists Jan 31, 2024
bfc1f4c
cursor to correct dir
rebelArtists Jan 31, 2024
ca6366b
test
rebelArtists Jan 31, 2024
c6ac0bc
testing
rebelArtists Jan 31, 2024
eac3a67
tests
rebelArtists Jan 31, 2024
ecf5ee9
testingg
rebelArtists Jan 31, 2024
1fb1d2c
testinggg
rebelArtists Jan 31, 2024
a6e6a1a
keep testing
rebelArtists Jan 31, 2024
822766e
loop checking pod status
rebelArtists Jan 31, 2024
218393b
test gcloud auth
rebelArtists Feb 2, 2024
4aac181
testing
rebelArtists Feb 5, 2024
51c0d11
testing
rebelArtists Feb 5, 2024
5e27fe4
test
rebelArtists Feb 5, 2024
a2c0afc
test
rebelArtists Feb 5, 2024
74318d1
test
rebelArtists Feb 5, 2024
a2f76e8
test
rebelArtists Feb 5, 2024
5e3c6b1
testing
rebelArtists Feb 6, 2024
4a65dcd
keep testing
rebelArtists Feb 6, 2024
7f8056c
keep testin
rebelArtists Feb 6, 2024
8baaf4d
tests
rebelArtists Feb 6, 2024
0f757c5
tester
rebelArtists Feb 6, 2024
05a2544
pls
rebelArtists Feb 6, 2024
98e3e7c
more tests
rebelArtists Feb 6, 2024
313c347
cmon
rebelArtists Feb 6, 2024
5264d34
testing
rebelArtists Feb 6, 2024
e634a24
moar tests
rebelArtists Feb 6, 2024
4e8c9e1
cmonn
rebelArtists Feb 6, 2024
13ce926
pls
rebelArtists Feb 6, 2024
34b2518
plss
rebelArtists Feb 6, 2024
c8d94c7
wow
rebelArtists Feb 6, 2024
f682f39
testing
rebelArtists Feb 6, 2024
5b0e277
pls
rebelArtists Feb 6, 2024
0bfe38b
cmon
rebelArtists Feb 6, 2024
e0b272c
pls work
rebelArtists Feb 6, 2024
fe0841b
merge to main
rebelArtists Feb 6, 2024
2245406
prebuild all images
rebelArtists Feb 7, 2024
a806256
e2e k8s pos ci devnet tests
rebelArtists Feb 27, 2024
3197635
fix: get kubeconfig before devnet deploy
rebelArtists Feb 27, 2024
4fc743c
fix: gcloud auth
rebelArtists Feb 27, 2024
5a232ad
fix: gcloud auth cont
rebelArtists Feb 27, 2024
354aabc
fix: gcloud auth still
rebelArtists Feb 27, 2024
711ab7f
fix: gcloud auth ongoing
rebelArtists Feb 27, 2024
e3c8799
fix: google auth
rebelArtists Feb 27, 2024
a1e9cf1
fix: gcloud auth
rebelArtists Feb 27, 2024
fe60818
fix: gauth
rebelArtists Feb 27, 2024
91518a9
fix: gauth
rebelArtists Feb 27, 2024
c1abfe7
cmon
rebelArtists Feb 27, 2024
76c883f
fix gauth
rebelArtists Feb 27, 2024
6dd2fb1
pls
rebelArtists Feb 27, 2024
41842e1
fix gauthhh
rebelArtists Feb 27, 2024
b25bcb6
cmon
rebelArtists Feb 27, 2024
3bec327
e2e flowww
rebelArtists Mar 7, 2024
64e6f58
fix monitor status check loop freq
rebelArtists Mar 7, 2024
ee29435
ship it
rebelArtists Mar 8, 2024
4be953e
delete stack before demo
rebelArtists Mar 8, 2024
34a6892
delete resources
rebelArtists Mar 8, 2024
f727e25
typo
rebelArtists Mar 8, 2024
478619a
cleanup
rebelArtists Mar 8, 2024
a41996a
tf auto approve
rebelArtists Mar 8, 2024
ce029e1
again
rebelArtists Mar 8, 2024
ea09ad4
fmt
rebelArtists Mar 8, 2024
8ccbb46
cmon
rebelArtists Mar 8, 2024
76f163f
tests
rebelArtists Mar 8, 2024
c94ed5e
cmon
rebelArtists Mar 8, 2024
dc45ed4
pls
rebelArtists Mar 8, 2024
8092c41
cmon
rebelArtists Mar 8, 2024
6002df9
full e2e k8s devnet tests
rebelArtists Mar 8, 2024
167566e
e2e k8s pos devnet
rebelArtists Mar 8, 2024
0cdd388
full e2e demo w/ john
rebelArtists Mar 8, 2024
bb0c86b
feat: github ui dispatch
rebelArtists Mar 9, 2024
74101a6
fix: final cleanup
rebelArtists Mar 9, 2024
de25b5d
fix: workflow title
rebelArtists Mar 9, 2024
15ef265
feature: kurtosis ci devnet deploys
rebelArtists Mar 20, 2024
d2769df
test
rebelArtists Mar 21, 2024
ad13f96
fix repo path
rebelArtists Mar 21, 2024
5d19a51
finetune repo path
rebelArtists Mar 21, 2024
f940ba0
fix: filename
rebelArtists Mar 21, 2024
4cc2abb
fix: kurtosis engine restart
rebelArtists Mar 21, 2024
4d9e2c1
debug: reduce size of enclave
rebelArtists Mar 21, 2024
f7dd70e
debug: pvcs
rebelArtists Mar 21, 2024
2e79f19
refactor kurtosis run cmd per latest cdk-devnets main branch
rebelArtists Mar 21, 2024
f1b55e0
debug: contracts container state error
rebelArtists Mar 26, 2024
ba8035a
debug: container fail
rebelArtists Mar 26, 2024
31c6056
debug
rebelArtists Mar 26, 2024
d34db13
debug: cdk starlark
rebelArtists Mar 26, 2024
c9ead2c
debug
rebelArtists Mar 26, 2024
913960d
debug JIT agglayer images
rebelArtists Apr 5, 2024
131557d
work
rebelArtists Apr 5, 2024
e6d8dad
run local
rebelArtists Apr 5, 2024
361dddd
again
rebelArtists Apr 5, 2024
9a4f046
debug
rebelArtists Apr 8, 2024
9083ecb
debu
rebelArtists Apr 8, 2024
bea256b
debug
rebelArtists Apr 8, 2024
70d5eb4
degug
rebelArtists Apr 8, 2024
4a24837
superuser cdk devnet tool
rebelArtists Apr 8, 2024
8ba439a
cleanup unused code
rebelArtists Apr 8, 2024
717641f
consolidate workflow logic
rebelArtists Apr 8, 2024
928cc31
more clarity in ci input descriptions
rebelArtists Apr 8, 2024
610f0e3
cleanup wokflow
rebelArtists Apr 8, 2024
43e56b1
debug
rebelArtists Apr 8, 2024
01e7944
prover build debug
rebelArtists Apr 8, 2024
54d1f1f
debug
rebelArtists Apr 8, 2024
35ee74f
debuggin
rebelArtists Apr 8, 2024
8f213f5
debug
rebelArtists Apr 9, 2024
cf89dea
test
rebelArtists Apr 9, 2024
f5289ee
tester
rebelArtists Apr 9, 2024
2a9d03b
debug
rebelArtists Apr 9, 2024
4c658d0
debug
rebelArtists Apr 9, 2024
1c97ef7
debugin
rebelArtists Apr 9, 2024
953bab4
debug
rebelArtists Apr 10, 2024
8e2f814
fix
rebelArtists Apr 10, 2024
49f350d
cleanup
rebelArtists Apr 10, 2024
f7ddd52
debug
rebelArtists Apr 10, 2024
191349d
cmon
rebelArtists Apr 10, 2024
4bbf0ec
refine verifiedBatch check
rebelArtists Apr 10, 2024
420b3f0
debug
rebelArtists Apr 10, 2024
959e8b1
pr cleanup
rebelArtists Apr 10, 2024
dad7a0d
debug bake time logic
rebelArtists Apr 10, 2024
8eb1f65
fix: kurtosis install
rebelArtists Apr 10, 2024
0231676
fix: typo
rebelArtists Apr 10, 2024
578c784
run on merge to main
rebelArtists Apr 10, 2024
93db540
test auto main tests
rebelArtists Apr 10, 2024
7120961
final test
rebelArtists Apr 16, 2024
3572116
debug
rebelArtists Apr 16, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform
95 changes: 95 additions & 0 deletions .github/workflows/agglayer-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Regression Tests - Agglayer
'on':
workflow_dispatch:
inputs:
zkevm_agglayer_commit_id:
description: 0xPolygon/agglayer (commit id)
required: true
bake_time:
description: bake time (minutes)
required: false
default: 30
push:
branches:
- main
inputs:
zkevm_agglayer_commit_id:
description: 0xPolygon/agglayer commit id
required: false
default: '${{ github.event.before }}' # Set default value to commit ID being merged to main
bake_time:
description: bake time (minutes)
required: false
default: 20
jobs:
deploy_devnet:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: '${{ github.event.before }}'
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Clone and build agglayer image locally
run: |
git clone https://github.com/0xPolygon/agglayer.git
cd agglayer
git checkout "${{ github.event.inputs.zkevm_agglayer_commit_id }}"
docker compose -f docker/docker-compose.yaml build --no-cache agglayer
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Clone internal kurtosis-cdk repo
run: |
git clone https://github.com/0xPolygon/kurtosis-cdk.git
cd kurtosis-cdk
git checkout dan/jit_containers
- name: Install kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
- name: Run kurtosis agent in background
run: |
kurtosis gateway & # Run cmd in background
- name: Deploy CDK devnet on local github runner
run: |
cd kurtosis-cdk
kurtosis engine restart
kurtosis run --enclave cdk-v1 --args-file params.yml .
- name: Monitor and report any potential regressions to CI logs
run: |
bake_time="${{ github.event.inputs.bake_time }}"
end_minute=$(( $(date +'%M') + bake_time))

export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
INITIAL_STATUS=$(cast rpc zkevm_verifiedBatchNumber 2>/dev/null)
incremented=false

while [ $(date +'%M') -lt $end_minute ]; do
# Attempt to connect to the service
if STATUS=$(cast rpc zkevm_verifiedBatchNumber 2>/dev/null); then
echo "ZKEVM_VERIFIED_BATCH_NUMBER: $STATUS"

# Check if STATUS has incremented
if [ "$STATUS" != "$INITIAL_STATUS" ]; then
incremented=true
echo "ZKEVM_VERIFIED_BATCH_NUMBER successfully incremented to $STATUS. Exiting..."
exit 0
fi
else
echo "Failed to connect, waiting and retrying..."
sleep 60
continue
fi
sleep 60
done

if ! $incremented; then
echo "ZKEVM_VERIFIED_BATCH_NUMBER did not increment. This may indicate chain experienced a regression. Please investigate."
exit 1
fi
- name: Finally, remove all devnet resources locally
run: |
cd kurtosis-cdk
kurtosis clean -a
79 changes: 79 additions & 0 deletions .github/workflows/cdk-kurtosis-gke-devnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Regression Detector - Ephemeral CDK Devnet

jobs:
deploy_devnet:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.before }}

- name: Set up Docker
uses: docker/setup-buildx-action@v1

- name: Setup Google Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'

- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
project_id: 'prj-polygonlabs-devtools-dev'

- name: Install kubectl and gcloud kubectl auth plugin
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && gcloud components install gke-gcloud-auth-plugin

- name: Install tomlq for config file preparation
run: |
pip3 install tomlq

- name: Clone private kurtosis-cdk repo
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.SSH_PRIVATE_KEY }}'
git clone -b dan/contracts_running_state [email protected]:0xPolygon/kurtosis-cdk.git

## add necessary manipulation steps here...
- name: Install kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli

- name: Setup necessary gke custom kurtosis netorking configs
run: |
export KURTOSIS_CONFIG_PATH="$(kurtosis config path)"
cp /home/runner/work/bor/bor/kurtosis-config.yml $KURTOSIS_CONFIG_PATH

- name: Set kurtosis cloud env
run: |
mkdir -p ~/.kube
echo "${{ secrets.GKE_CLUSTER_CREDENTIALS }}" > ~/.kube/config
export KUBECONFIG=~/.kube/config && kurtosis cluster set cloud

- name: Run kurtosis agent in background
run: |
kurtosis gateway & # Run cmd in background
sleep 10

- name: REMOVE, temp for CI testing remove all devnet resources
run: |
cd kurtosis-cdk
kurtosis clean -a
sleep 180

- name: Deploy CDK devnet to isolated GKE namespace
run: |
cd kurtosis-cdk
kurtosis engine restart
kurtosis run --enclave cdk-v1 --args-file params.yml .
sleep 600

- name: Finally, remove all devnet resources
run: |
cd kurtosis-cdk
kurtosis clean -a
110 changes: 110 additions & 0 deletions .github/workflows/cdk-superuser-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Regression Tests - Superuser
'on':
workflow_dispatch:
inputs:
zkevm_agglayer_commit_id:
description: 0xPolygon/agglayer (commit id)
required: true
zkevm_bridge_service_commit_id:
description: 0xPolygonHermez/zkevm-bridge-service (commit id)
required: true
zkevm_bridge_ui_commit_id:
description: 0xPolygonHermez/zkevm-bridge-ui (commit id)
required: true
zkevm_dac_commit_id:
description: 0xPolygon/cdk-data-availability (commit id)
required: true
zkevm_node_commit_id:
description: 0xPolygon/cdk-validium-node (commit id)
required: true
bake_time:
description: bake time (minutes)
required: false
default: 30
jobs:
deploy_devnet:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Clone and build agglayer
run: |
git clone https://github.com/0xPolygon/agglayer.git
cd agglayer
git checkout "${{ github.event.inputs.zkevm_agglayer_commit_id }}"
docker compose -f docker/docker-compose.yaml build --no-cache agglayer
- name: Clone and build zkevm-bridge-service
run: |
git clone https://github.com/0xPolygonHermez/zkevm-bridge-service.git
cd zkevm-bridge-service
git checkout "${{ github.event.inputs.zkevm_bridge_service_commit_id }}"
docker build -t zkevm-bridge-service:local -f ./Dockerfile .
- name: Clone and build zkevm-bridge-ui
run: |
git clone https://github.com/0xPolygonHermez/zkevm-bridge-ui.git
cd zkevm-bridge-ui
git checkout "${{ github.event.inputs.zkevm_bridge_ui_commit_id }}"
docker build -t zkevm-bridge-ui:local -f ./Dockerfile .
- name: Clone and build cdk-data-availability
run: |
git clone https://github.com/0xPolygon/cdk-data-availability.git
cd cdk-data-availability
git checkout "${{ github.event.inputs.zkevm_dac_commit_id }}"
docker build -t cdk-data-availability:local -f ./Dockerfile .
- name: Clone and build cdk-validium-node
run: |
git clone https://github.com/0xPolygon/cdk-validium-node.git
cd cdk-validium-node
git checkout "${{ github.event.inputs.zkevm_node_commit_id }}"
docker build -t cdk-validium-node:local -f ./Dockerfile .
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Clone internal kurtosis-cdk repo
run: |
git clone https://github.com/0xPolygon/kurtosis-cdk.git
cd kurtosis-cdk
git checkout dan/jit_containers_superusers
- name: Install kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
kurtosis analytics disable
- name: Deploy CDK devnet on local github runner
run: |
cd kurtosis-cdk
kurtosis run --enclave cdk-v1 --args-file params.yml .
- name: Monitor and report any potential regressions to CI logs
run: |
bake_time="${{ github.event.inputs.bake_time }}"
end_minute=$(( $(date +'%M') + bake_time))

export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
INITIAL_STATUS=$(cast rpc zkevm_verifiedBatchNumber 2>/dev/null)
incremented=false

while [ $(date +'%M') -lt $end_minute ]; do
# Attempt to connect to the service
if STATUS=$(cast rpc zkevm_verifiedBatchNumber 2>/dev/null); then
echo "ZKEVM_VERIFIED_BATCH_NUMBER: $STATUS"

# Check if STATUS has incremented
if [ "$STATUS" != "$INITIAL_STATUS" ]; then
incremented=true
echo "ZKEVM_VERIFIED_BATCH_NUMBER successfully incremented to $STATUS. Exiting..."
exit 0
fi
else
echo "Failed to connect, waiting and retrying..."
sleep 60
continue
fi
sleep 60
done

if ! $incremented; then
echo "ZKEVM_VERIFIED_BATCH_NUMBER did not increment. This may indicate chain experienced a regression. Please investigate."
exit 1
fi
18 changes: 18 additions & 0 deletions .github/workflows/kind-config.yaml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
networking:
apiServerAddress: "0.0.0.0"

kubeadmConfigPatchesJSON6902:
- group: kubeadm.k8s.io
version: v1beta2
kind: ClusterConfiguration
patch: |
- op: add
path: /apiServer/certSANs/-
value: docker
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 11111
hostPort: 11111
39 changes: 39 additions & 0 deletions .github/workflows/make-k8s-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Image Sync

on:
schedule:
- cron: '*/30 * * * *'

jobs:
sync-images:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Fetch repos, rebuild for k8s, push to internal artifact registry
run: |
gcloud auth configure-docker europe-west2-docker.pkg.dev -q
while IFS= read -r image_path; do
latest_tag=$(curl -s "https://registry.hub.docker.com/v2/repositories/${image_path}/tags/" | jq -r '.results[].name | select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$"))' | sort -V | tail -n 1)
if [ -n "$latest_tag" ]; then
# Check if the image version already exists in GCP Container Registry
if ! gcloud container images list-tags europe-west2-docker.pkg.dev/prj-polygonlabs-devtools-dev/container/${image_path} --filter="tags=${latest_tag}" --format="value(tags)" | grep -q "${latest_tag}"; then
docker pull "${image_path}:${latest_tag}"
docker tag "${image_path}:${latest_tag}" "europe-west2-docker.pkg.dev/prj-polygonlabs-devtools-dev/container/${image_path}:${latest_tag}"
sudo -u $USER docker push "europe-west2-docker.pkg.dev/prj-polygonlabs-devtools-dev/container/${image_path}:${latest_tag}"
# also tag image as 'latest' for internal tracking
sudo -u $USER docker push "europe-west2-docker.pkg.dev/prj-polygonlabs-devtools-dev/container/${image_path}:latest"
else
echo "Image version already exists for ${image_path}:${latest_tag} in GCR. Skipping upload."
fi
fi
done < .github/workflows/repo-list.txt.sample
3 changes: 3 additions & 0 deletions .github/workflows/repo-list.txt.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0xpolygon/bor
0xpolygon/heimdall
thorax/erigon
17 changes: 17 additions & 0 deletions kurtosis-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
config-version: 2
should-send-metrics: true
kurtosis-clusters:
docker:
type: "docker"
minikube:
type: "kubernetes"
config:
kubernetes-cluster-name: "minikube"
storage-class: "standard"
enclave-size-in-megabytes: 400
cloud:
type: "kubernetes"
config:
kubernetes-cluster-name: "gke_prj-polygonlabs-devtools-dev_europe-west2_ci-cluster-1"
storage-class: "standard"
enclave-size-in-megabytes: 400
Loading