From afa9306cdaef9d08f279288c888c97f574f96fa7 Mon Sep 17 00:00:00 2001 From: Muhamad Azmy Date: Thu, 9 Jun 2022 16:52:56 +0200 Subject: [PATCH] add support to qa network (#1736) * add support to qa network * fix modes strings * Restore key for prod network --- bootstrap/bootstrap/Cargo.toml | 20 ++++++++++---------- bootstrap/bootstrap/src/bootstrap.rs | 5 +++++ bootstrap/bootstrap/src/config.rs | 2 ++ pkg/environment/environment.go | 22 +++++++++++++++++++--- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/bootstrap/bootstrap/Cargo.toml b/bootstrap/bootstrap/Cargo.toml index f961169d5..fe9abf3da 100644 --- a/bootstrap/bootstrap/Cargo.toml +++ b/bootstrap/bootstrap/Cargo.toml @@ -8,19 +8,19 @@ build = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -retry = "0.5.1" -shlex = "0.1.1" -anyhow = "1.0.38" -reqwest = "0.9.22" -serde = "1.0.102" -serde_json = "1.0.41" +retry = "0.5" +shlex = "0.1" +anyhow = "1.0" +reqwest = "0.9" +serde = "1.0" +serde_json = "1.0" log = "0.4" -simple_logger = "1.3.0" -nix = "0.15.0" +simple_logger = "1.3" +nix = "0.15" openssl-sys = "*" walkdir = "2" -clap = "2.33.0" -exec = "0.3.1" +clap = "2.33" +exec = "0.3" [features] # Force openssl-sys to staticly link in the openssl library. Necessary when diff --git a/bootstrap/bootstrap/src/bootstrap.rs b/bootstrap/bootstrap/src/bootstrap.rs index 9065723dc..fcae16b85 100644 --- a/bootstrap/bootstrap/src/bootstrap.rs +++ b/bootstrap/bootstrap/src/bootstrap.rs @@ -29,6 +29,10 @@ fn boostrap_zos(cfg: &config::Config) -> Result<()> { Version::V2 => "zos:testing:latest.flist", Version::V3 => "zos:testing-3:latest.flist", }, + RunMode::QA => match &cfg.version { + Version::V2 => bail!("qa not supported on v2"), + Version::V3 => "zos:qa-3:latest.flist", + }, }; debug!("using flist: {}/{}", FLIST_REPO, flist); @@ -139,6 +143,7 @@ fn install_packages(cfg: &config::Config) -> Result<()> { config::RunMode::Prod => name.into(), config::RunMode::Dev => format!("{}.dev", name), config::RunMode::Test => format!("{}.test", name), + config::RunMode::QA => format!("{}.qanet", name), }; let client = hub::Repo::new(&repo); diff --git a/bootstrap/bootstrap/src/config.rs b/bootstrap/bootstrap/src/config.rs index cfd6cb254..c3688ea9a 100644 --- a/bootstrap/bootstrap/src/config.rs +++ b/bootstrap/bootstrap/src/config.rs @@ -7,6 +7,7 @@ pub enum RunMode { Prod, Test, Dev, + QA, } #[derive(Debug)] @@ -23,6 +24,7 @@ fn runmode() -> Result { "prod" => RunMode::Prod, "dev" => RunMode::Dev, "test" => RunMode::Test, + "qa" => RunMode::QA, m => { bail!("unknown runmode: {}", m); } diff --git a/pkg/environment/environment.go b/pkg/environment/environment.go index 542b5062d..75f180a36 100644 --- a/pkg/environment/environment.go +++ b/pkg/environment/environment.go @@ -41,6 +41,8 @@ func (r RunningMode) String() string { switch r { case RunningDev: return "development" + case RunningQA: + return "qa" case RunningMain: return "production" case RunningTest: @@ -52,10 +54,13 @@ func (r RunningMode) String() string { // Possible running mode of a node const ( - //RunningDev RunningMode = "dev" + // RunningDev mode RunningDev RunningMode = "dev" - //RunningTest RunningMode = "test" + // RunningQA mode + RunningQA RunningMode = "qa" + // RunningTest mode RunningTest RunningMode = "test" + // RunningMain mode RunningMain RunningMode = "prod" // Orphanage is the default farmid where nodes are registered @@ -81,7 +86,6 @@ var ( envTest = Environment{ RunningMode: RunningTest, - // TODO: this should become a different substrate ? SubstrateURL: []string{ "wss://tfchain.test.grid.tf/", }, @@ -90,6 +94,16 @@ var ( BinRepo: "tf-zos-v3-bins.test", } + envQA = Environment{ + RunningMode: RunningQA, + SubstrateURL: []string{ + "wss://tfchain.qa.grid.tf/", + }, + ActivationURL: "https://activation.qa.grid.tf/activation/activate", + FlistURL: "redis://hub.grid.tf:9900", + BinRepo: "tf-zos-v3-bins.qanet", + } + // same as testnet for now. will be updated the day of the launch of production network envProd = Environment{ RunningMode: RunningMain, @@ -154,6 +168,8 @@ func getEnvironmentFromParams(params kernel.Params) (Environment, error) { switch RunningMode(runmode) { case RunningDev: env = envDev + case RunningQA: + env = envQA case RunningTest: env = envTest case RunningMain: