From 10a68419f9e1bc52fc084c6b8801fb71d2ff93ad Mon Sep 17 00:00:00 2001 From: andrussal Date: Tue, 3 Mar 2026 08:02:30 +0100 Subject: [PATCH] fix(compose): pass deployment config explicitly from cfgsync --- logos/infra/assets/stack/scripts/run_logos.sh | 3 ++- scripts/build/build_test_image.sh | 8 ------- .../tools/cfgsync-runtime/src/client.rs | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/logos/infra/assets/stack/scripts/run_logos.sh b/logos/infra/assets/stack/scripts/run_logos.sh index 06edebb..aa2fb15 100755 --- a/logos/infra/assets/stack/scripts/run_logos.sh +++ b/logos/infra/assets/stack/scripts/run_logos.sh @@ -59,6 +59,7 @@ check_binary_arch "$bin_path" "logos-blockchain-${role}" host_identifier_default="${role}-$(hostname -i)" export CFG_FILE_PATH="/config.yaml" \ + CFG_DEPLOYMENT_FILE_PATH="/deployment.yaml" \ CFG_SERVER_ADDR="${CFG_SERVER_ADDR:-http://cfgsync:${LOGOS_BLOCKCHAIN_CFGSYNC_PORT:-4400}}" \ CFG_HOST_IP=$(hostname -i) \ CFG_HOST_KIND="${CFG_HOST_KIND:-$role}" \ @@ -86,4 +87,4 @@ until "${cfgsync_bin}"; do sleep "$sleep_seconds" done -exec "${bin_path}" /config.yaml +exec "${bin_path}" /config.yaml --deployment /deployment.yaml diff --git a/scripts/build/build_test_image.sh b/scripts/build/build_test_image.sh index 2763df5..e43c7be 100755 --- a/scripts/build/build_test_image.sh +++ b/scripts/build/build_test_image.sh @@ -96,14 +96,6 @@ build_test_image::parse_args() { TAR_PATH="${BUNDLE_TAR_PATH:-${DEFAULT_LINUX_TAR}}" LOGOS_BLOCKCHAIN_NODE_PATH="${LOGOS_BLOCKCHAIN_NODE_PATH:-}" - if [ -z "${LOGOS_BLOCKCHAIN_NODE_PATH}" ]; then - # Prefer local checkout when available: this repo currently depends on - # lb-framework from nomos-node/tests/testing_framework. - local sibling_node_path="${ROOT_DIR}/../nomos-node" - if [ -d "${sibling_node_path}/tests/testing_framework" ]; then - LOGOS_BLOCKCHAIN_NODE_PATH="${sibling_node_path}" - fi - fi if [ -n "${LOGOS_BLOCKCHAIN_NODE_PATH}" ] && [ ! -d "${LOGOS_BLOCKCHAIN_NODE_PATH}" ]; then build_test_image::fail "LOGOS_BLOCKCHAIN_NODE_PATH does not exist: ${LOGOS_BLOCKCHAIN_NODE_PATH}" fi diff --git a/testing-framework/tools/cfgsync-runtime/src/client.rs b/testing-framework/tools/cfgsync-runtime/src/client.rs index 75f0836..3294091 100644 --- a/testing-framework/tools/cfgsync-runtime/src/client.rs +++ b/testing-framework/tools/cfgsync-runtime/src/client.rs @@ -55,10 +55,31 @@ async fn pull_to_file(payload: ClientIp, server_addr: &str, config_file: &str) - fs::write(config_file, &config.config_yaml) .with_context(|| format!("writing config to {}", config_file))?; + if let Ok(deployment_file_path) = env::var("CFG_DEPLOYMENT_FILE_PATH") { + write_deployment_config(&config.config_yaml, &deployment_file_path)?; + } + println!("Config saved to {config_file}"); Ok(()) } +fn write_deployment_config(config_yaml: &str, deployment_file_path: &str) -> Result<()> { + let document: serde_yaml::Value = + serde_yaml::from_str(config_yaml).context("parsing fetched config yaml")?; + let deployment = document + .get("deployment") + .cloned() + .context("fetched config yaml does not contain `deployment` key")?; + let deployment_yaml = + serde_yaml::to_string(&deployment).context("serializing deployment yaml")?; + + fs::write(deployment_file_path, deployment_yaml) + .with_context(|| format!("writing deployment config to {deployment_file_path}"))?; + + println!("Deployment config saved to {deployment_file_path}"); + Ok(()) +} + pub async fn run_cfgsync_client_from_env(default_port: u16) -> Result<()> { let config_file_path = env::var("CFG_FILE_PATH").unwrap_or_else(|_| "config.yaml".to_owned()); let server_addr =