Skip to content

Commit 325b69d

Browse files
feat(deployment): add dummy recorder deployment to the system test workflow (#6774)
1 parent f8b65ee commit 325b69d

2 files changed

Lines changed: 63 additions & 6 deletions

File tree

.github/workflows/consolidated_system_test.yaml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
pull_request:
1313
paths:
1414
- ".github/workflows/consolidated_system_test.yaml"
15+
- "deployments/**"
1516
- "crates/**"
1617
- "scripts/system_tests/**"
1718

@@ -75,7 +76,7 @@ jobs:
7576
- name: Set up Docker Buildx
7677
uses: docker/setup-buildx-action@v2
7778

78-
- name: Build Docker image
79+
- name: Build sequencer docker image
7980
uses: docker/build-push-action@v6
8081
with:
8182
context: .
@@ -86,6 +87,37 @@ jobs:
8687
build-args: |
8788
BUILD_MODE=debug
8889
90+
- name: Build dummy recorder docker image
91+
uses: docker/build-push-action@v6
92+
with:
93+
context: .
94+
file: deployments/images/sequencer/dummy_recorder.Dockerfile
95+
tags: recorder:local
96+
load: true
97+
push: false
98+
99+
- name: Import dummy recorder image into k3d
100+
run: k3d image import recorder:local -c consolidated-system-test
101+
102+
- name: Deploy Dummy Recorder
103+
env:
104+
dummy_recorder_namespace: dummy-recorder
105+
working-directory: deployments/dummy_recorder
106+
run: |
107+
echo "Deploying Dummy Recorder..."
108+
pipenv install
109+
cdk8s import
110+
cdk8s synth --app "pipenv run python main.py --namespace ${{ env.dummy_recorder_namespace }} --image recorder:local"
111+
kubectl create namespace ${{ env.dummy_recorder_namespace }}
112+
kubectl apply -R -f ./dist
113+
echo "⏳ Waiting for Dummy Recorder to become ready..."
114+
115+
# Wait for pod to be ready
116+
kubectl wait --namespace ${{ env.dummy_recorder_namespace }} --for=condition=Ready -l app=dummy-recorder pod --timeout=300s
117+
118+
echo "🚀 Dummy Recorder deployed successfully."
119+
120+
89121
- name: Build binaries
90122
run: cargo build --bin sequencer_node_setup --bin sequencer_simulator
91123

deployments/dummy_recorder/main.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
#!/usr/bin/env python
2+
3+
import argparse
24
from cdk8s import App, Chart, Names, YamlOutputType
35
from constructs import Construct
46
from imports import k8s
57

68

9+
def get_args():
10+
parser = argparse.ArgumentParser()
11+
parser.add_argument(
12+
"--namespace",
13+
required=True,
14+
help="Kubernetes namespace to deploy to."
15+
)
16+
parser.add_argument(
17+
"--image",
18+
required=False,
19+
default="us-central1-docker.pkg.dev/starkware-dev/sequencer/dummy_recorder:latest",
20+
help="Docker image to deploy. Defaults to the latest dummy recorder image."
21+
)
22+
return parser.parse_args()
23+
24+
725
class DummyRecorder(Chart):
8-
def __init__(self, scope: Construct, id: str, namespace: str):
26+
def __init__(self, scope: Construct, id: str, namespace: str, image: str):
927
super().__init__(scope, id, disable_resource_name_hashes=True, namespace=namespace)
1028

1129
self.label = {"app": Names.to_label_value(self, include_hash=False)}
@@ -37,7 +55,7 @@ def __init__(self, scope: Construct, id: str, namespace: str):
3755
containers=[
3856
k8s.Container(
3957
name=self.node.id,
40-
image="us-central1-docker.pkg.dev/starkware-dev/sequencer/dummy_recorder:latest",
58+
image=image,
4159
env=[k8s.EnvVar(name="RUST_LOG", value="DEBUG")],
4260
ports=[k8s.ContainerPort(container_port=8080)],
4361
)
@@ -80,7 +98,14 @@ def __init__(self, scope: Construct, id: str, namespace: str):
8098
)
8199

82100

83-
app = App(yaml_output_type=YamlOutputType.FOLDER_PER_CHART_FILE_PER_RESOURCE)
84-
DummyRecorder(scope=app, id="dummy-recorder", namespace="dummy-recorder")
101+
if __name__ == "__main__":
102+
args = get_args()
85103

86-
app.synth()
104+
app = App(yaml_output_type=YamlOutputType.FOLDER_PER_CHART_FILE_PER_RESOURCE)
105+
DummyRecorder(
106+
scope=app,
107+
id="dummy-recorder",
108+
namespace=args.namespace,
109+
image=args.image
110+
)
111+
app.synth()

0 commit comments

Comments
 (0)