mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-05-18 15:49:54 +00:00
fix(compose): pass deployment config explicitly from cfgsync
This commit is contained in:
parent
a099392fdd
commit
10a68419f9
@ -59,6 +59,7 @@ check_binary_arch "$bin_path" "logos-blockchain-${role}"
|
|||||||
host_identifier_default="${role}-$(hostname -i)"
|
host_identifier_default="${role}-$(hostname -i)"
|
||||||
|
|
||||||
export CFG_FILE_PATH="/config.yaml" \
|
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_SERVER_ADDR="${CFG_SERVER_ADDR:-http://cfgsync:${LOGOS_BLOCKCHAIN_CFGSYNC_PORT:-4400}}" \
|
||||||
CFG_HOST_IP=$(hostname -i) \
|
CFG_HOST_IP=$(hostname -i) \
|
||||||
CFG_HOST_KIND="${CFG_HOST_KIND:-$role}" \
|
CFG_HOST_KIND="${CFG_HOST_KIND:-$role}" \
|
||||||
@ -86,4 +87,4 @@ until "${cfgsync_bin}"; do
|
|||||||
sleep "$sleep_seconds"
|
sleep "$sleep_seconds"
|
||||||
done
|
done
|
||||||
|
|
||||||
exec "${bin_path}" /config.yaml
|
exec "${bin_path}" /config.yaml --deployment /deployment.yaml
|
||||||
|
|||||||
@ -96,14 +96,6 @@ build_test_image::parse_args() {
|
|||||||
TAR_PATH="${BUNDLE_TAR_PATH:-${DEFAULT_LINUX_TAR}}"
|
TAR_PATH="${BUNDLE_TAR_PATH:-${DEFAULT_LINUX_TAR}}"
|
||||||
|
|
||||||
LOGOS_BLOCKCHAIN_NODE_PATH="${LOGOS_BLOCKCHAIN_NODE_PATH:-}"
|
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
|
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}"
|
build_test_image::fail "LOGOS_BLOCKCHAIN_NODE_PATH does not exist: ${LOGOS_BLOCKCHAIN_NODE_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -55,10 +55,31 @@ async fn pull_to_file(payload: ClientIp, server_addr: &str, config_file: &str) -
|
|||||||
fs::write(config_file, &config.config_yaml)
|
fs::write(config_file, &config.config_yaml)
|
||||||
.with_context(|| format!("writing config to {}", config_file))?;
|
.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}");
|
println!("Config saved to {config_file}");
|
||||||
Ok(())
|
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<()> {
|
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 config_file_path = env::var("CFG_FILE_PATH").unwrap_or_else(|_| "config.yaml".to_owned());
|
||||||
let server_addr =
|
let server_addr =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user