From d2889f0af64da18dfde7f9ac29aa96dffc95643f Mon Sep 17 00:00:00 2001 From: hduoc2003 Date: Wed, 4 Dec 2024 07:34:08 +0000 Subject: [PATCH] feat: add script run.sh --- README.md | 4 ++-- lib/jayce.star | 10 +++++----- params.yml | 1 - run.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 run.sh diff --git a/README.md b/README.md index 921b738..5faa4ed 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ Once that is good and installed on your system, you can run the following comman deployment includes ..., ... as the sequencer, and ... This process typically takes around eight to ten minutes. ```bash -kurtosis clean --all -kurtosis run --enclave apstark-v1 --args-file params.yml . +# Specify if you set "deploy_contracts = True" in the config file "params.yml", default is "." +./run.sh ``` Changing the configs: diff --git a/lib/jayce.star b/lib/jayce.star index 71a9882..9f59f4e 100644 --- a/lib/jayce.star +++ b/lib/jayce.star @@ -4,10 +4,9 @@ def apply_default(args): def start(plan, args, suffix): args = apply_default(args) - name = args["name"] + suffix - - output_file_path = "/app/" + args["output_file_name"] + output_file_name = "deploy-report.json" + output_file_path = "/app/" + output_file_name # mount config files config_file_artifact = plan.upload_files( @@ -67,7 +66,7 @@ def start(plan, args, suffix): output_file_artifact = plan.store_service_files( service_name=name, src=output_file_path, - name=args["output_file_name"], + name=output_file_name, ) plan.add_service( name="jayce-output", @@ -76,7 +75,8 @@ def start(plan, args, suffix): # stop jayce plan.stop_service(name=name) + plan.stop_service(name="jayce-output") def last_file_or_dir(path): - return path.split("/")[-1] + return path.split("/")[-1] \ No newline at end of file diff --git a/params.yml b/params.yml index 0eb2069..7e7b751 100644 --- a/params.yml +++ b/params.yml @@ -38,7 +38,6 @@ args: jayce: image: sotazklabs/jayce:latest config_file: ../static_files/jayce/deploy-contracts.toml - output_file_name: deploy-output.json contracts: - ../contracts/navori/libs - ../contracts/navori/cpu-2 diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..9fdfeba --- /dev/null +++ b/run.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Usage: ./run.sh [DEPLOY_REPORT_DIR] +# DEPLOY_REPORT_DIR: Optional. The directory where the deploy-report.json file will be saved. Defaults to the current directory. + +# Run Apstark +kurtosis run --enclave apstark-v1 --args-file params.yml . + +# Check if the command was successful +if [ $? -eq 0 ]; then + echo "Running Apstark successfully." + + # Get jayce deploy output + if yq .deploy_contracts params.yml | grep -q 'true'; then + DEPLOY_REPORT_DIR="${1:-.}" + + kurtosis files download apstark-v1 deploy-report.json "$DEPLOY_REPORT_DIR" + + if [ $? -eq 0 ]; then + echo "Jayce deploy output downloaded successfully." + else + echo "Failed to download jayce deploy output." + fi + fi +else + echo "Failed to run Apstark" +fi