Add an option to keep existing enclave when starting local testnet (#6065)

* Add an option to keep existing enclave when starting local testnet.

* Add missing help text.

* Do not add `--image-download always` flag if `-k` is present.
This commit is contained in:
Jimmy Chen
2024-07-19 12:42:59 +10:00
committed by GitHub
parent 3859c9bca5
commit adfa512893
2 changed files with 15 additions and 7 deletions

View File

@@ -11,15 +11,17 @@ NETWORK_PARAMS_FILE=$SCRIPT_DIR/network_params.yaml
BUILD_IMAGE=true
BUILDER_PROPOSALS=false
CI=false
KEEP_ENCLAVE=false
# Get options
while getopts "e:b:n:phc" flag; do
while getopts "e:b:n:phck" flag; do
case "${flag}" in
e) ENCLAVE_NAME=${OPTARG};;
b) BUILD_IMAGE=${OPTARG};;
n) NETWORK_PARAMS_FILE=${OPTARG};;
p) BUILDER_PROPOSALS=true;;
c) CI=true;;
k) KEEP_ENCLAVE=true;;
h)
echo "Start a local testnet with kurtosis."
echo
@@ -31,6 +33,7 @@ while getopts "e:b:n:phc" flag; do
echo " -n: kurtosis network params file path default: $NETWORK_PARAMS_FILE"
echo " -p: enable builder proposals"
echo " -c: CI mode, run without other additional services like Grafana and Dora explorer"
echo " -k: keeping enclave to allow starting the testnet without destroying the existing one"
echo " -h: this help"
exit
;;
@@ -62,9 +65,6 @@ if [ "$CI" = true ]; then
# TODO: run assertoor tests
yq eval '.additional_services = []' -i $NETWORK_PARAMS_FILE
echo "Running without additional services (CI mode)."
else
yq eval '.additional_services = ["dora", "prometheus_grafana"]' -i $NETWORK_PARAMS_FILE
echo "Additional services dora and prometheus_grafana added to network_params.yaml"
fi
if [ "$BUILD_IMAGE" = true ]; then
@@ -75,9 +75,14 @@ else
echo "Not rebuilding Lighthouse Docker image."
fi
# Stop local testnet
kurtosis enclave rm -f $ENCLAVE_NAME 2>/dev/null || true
IMAGE_DOWNLOAD_FLAG=""
kurtosis run --enclave $ENCLAVE_NAME github.com/ethpandaops/ethereum-package --args-file $NETWORK_PARAMS_FILE
if [ "$KEEP_ENCLAVE" = false ]; then
# Stop local testnet
kurtosis enclave rm -f $ENCLAVE_NAME 2>/dev/null || true
IMAGE_DOWNLOAD_FLAG="--image-download always"
fi
kurtosis run --enclave $ENCLAVE_NAME github.com/ethpandaops/ethereum-package $IMAGE_DOWNLOAD_FLAG --args-file $NETWORK_PARAMS_FILE
echo "Started!"