diff --git a/.github/workflows/ci-zk-toolbox-reusable.yml b/.github/workflows/ci-zk-toolbox-reusable.yml index 19bb2cab81d6..b2fc10c28aae 100644 --- a/.github/workflows/ci-zk-toolbox-reusable.yml +++ b/.github/workflows/ci-zk-toolbox-reusable.yml @@ -90,7 +90,8 @@ jobs: --server-db-name=zksync_server_localhost_era \ --prover-db-url=postgres://postgres:notsecurepassword@postgres:5432 \ --prover-db-name=zksync_prover_localhost_era \ - --ignore-prerequisites --verbose + --ignore-prerequisites --verbose \ + --observability=false - name: Create and initialize chain run: | diff --git a/zk_toolbox/crates/zk_inception/src/commands/args/containers.rs b/zk_toolbox/crates/zk_inception/src/commands/args/containers.rs index 80a77c20b1f3..c996d65598ff 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/args/containers.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/args/containers.rs @@ -1,9 +1,26 @@ use clap::Parser; -use crate::messages::MSG_OBSERVABILITY_HELP; +use crate::messages::{MSG_OBSERVABILITY_HELP, MSG_OBSERVABILITY_RUN_PROMPT}; #[derive(Debug, Parser)] pub struct ContainersArgs { - #[clap(long, short = 'o', help = MSG_OBSERVABILITY_HELP)] + #[clap(long, short = 'o', help = MSG_OBSERVABILITY_HELP, default_missing_value = "true", num_args = 0..=1)] + pub observability: Option, +} + +#[derive(Debug)] +pub struct ContainersArgsFinal { pub observability: bool, } + +impl ContainersArgs { + pub fn fill_values_with_prompt(self) -> ContainersArgsFinal { + let observability = self.observability.unwrap_or_else(|| { + common::PromptConfirm::new(MSG_OBSERVABILITY_RUN_PROMPT) + .default(true) + .ask() + }); + + ContainersArgsFinal { observability } + } +} diff --git a/zk_toolbox/crates/zk_inception/src/commands/containers.rs b/zk_toolbox/crates/zk_inception/src/commands/containers.rs index 50be90106ea0..17c32c04bc2f 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/containers.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/containers.rs @@ -12,6 +12,7 @@ use crate::messages::{ }; pub fn run(shell: &Shell, args: ContainersArgs) -> anyhow::Result<()> { + let args = args.fill_values_with_prompt(); let ecosystem = EcosystemConfig::from_file(shell).context(MSG_FAILED_TO_FIND_ECOSYSTEM_ERR)?; initialize_docker(shell, &ecosystem)?; diff --git a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs index dddd408aa77c..2411e4b95588 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs @@ -12,7 +12,7 @@ use crate::{ messages::{ MSG_DEPLOY_ECOSYSTEM_PROMPT, MSG_DEPLOY_ERC20_PROMPT, MSG_DEPLOY_PAYMASTER_PROMPT, MSG_DEV_ARG_HELP, MSG_GENESIS_ARGS_HELP, MSG_L1_RPC_URL_HELP, MSG_L1_RPC_URL_INVALID_ERR, - MSG_L1_RPC_URL_PROMPT, MSG_OBSERVABILITY_HELP, + MSG_L1_RPC_URL_PROMPT, MSG_OBSERVABILITY_HELP, MSG_OBSERVABILITY_PROMPT, }, }; @@ -90,8 +90,8 @@ pub struct EcosystemInitArgs { pub genesis_args: GenesisArgs, #[clap(long, help = MSG_DEV_ARG_HELP)] pub dev: bool, - #[clap(long, short = 'o', help = MSG_OBSERVABILITY_HELP)] - pub observability: bool, + #[clap(long, short = 'o', help = MSG_OBSERVABILITY_HELP, default_missing_value = "true", num_args = 0..=1)] + pub observability: Option, } impl EcosystemInitArgs { @@ -112,6 +112,15 @@ impl EcosystemInitArgs { (deploy_paymaster, deploy_erc20) }; let ecosystem = self.ecosystem.fill_values_with_prompt(l1_network, self.dev); + let observability = if self.dev { + true + } else { + self.observability.unwrap_or_else(|| { + PromptConfirm::new(MSG_OBSERVABILITY_PROMPT) + .default(true) + .ask() + }) + }; EcosystemInitArgsFinal { deploy_paymaster, @@ -119,7 +128,7 @@ impl EcosystemInitArgs { ecosystem, forge_args: self.forge_args.clone(), dev: self.dev, - observability: self.observability, + observability, } } } diff --git a/zk_toolbox/crates/zk_inception/src/messages.rs b/zk_toolbox/crates/zk_inception/src/messages.rs index b52d7aec2167..9816b4ceace5 100644 --- a/zk_toolbox/crates/zk_inception/src/messages.rs +++ b/zk_toolbox/crates/zk_inception/src/messages.rs @@ -51,6 +51,7 @@ pub(super) const MSG_GENESIS_ARGS_HELP: &str = "Genesis options"; pub(super) const MSG_DEV_ARG_HELP: &str = "Deploy ecosystem using all defaults. Suitable for local development"; pub(super) const MSG_OBSERVABILITY_HELP: &str = "Enable Grafana"; +pub(super) const MSG_OBSERVABILITY_PROMPT: &str = "Do you want to setup observability? (Grafana)"; pub(super) const MSG_DEPLOY_ECOSYSTEM_PROMPT: &str = "Do you want to deploy ecosystem contracts? (Not needed if you already have an existing one)"; pub(super) const MSG_L1_RPC_URL_PROMPT: &str = "What is the RPC URL of the L1 network?"; @@ -205,6 +206,7 @@ pub(super) const MSG_CONTAINERS_STARTED: &str = "Containers started successfully pub(super) const MSG_RETRY_START_CONTAINERS_PROMPT: &str = "Failed to start containers. Make sure there is nothing running on default ports for Ethereum node l1 and postgres. Want to try again?"; pub(super) const MSG_FAILED_TO_FIND_ECOSYSTEM_ERR: &str = "Failed to find ecosystem folder."; +pub(super) const MSG_OBSERVABILITY_RUN_PROMPT: &str = "Do you want to run observability?"; /// Server related messages pub(super) const MSG_STARTING_SERVER: &str = "Starting server";