validate compose_cmd_wrapper for required placeholder and add interpolation support (#977)

This commit is contained in:
ChanningHe
2025-11-13 03:09:15 +09:00
committed by GitHub
parent f0697e812a
commit d268009a6a
2 changed files with 8 additions and 0 deletions

View File

@@ -670,6 +670,13 @@ impl Resolve<super::Args> for ComposeUp {
let compose_cmd_wrapper =
parse_multiline_command(&stack.config.compose_cmd_wrapper);
if !compose_cmd_wrapper.is_empty() {
if !compose_cmd_wrapper.contains("[[COMPOSE_COMMAND]]") {
res.logs.push(Log::error(
"Compose Command Wrapper",
"compose_cmd_wrapper is configured but does not contain [[COMPOSE_COMMAND]] placeholder. The placeholder is required to inject the compose command.".to_string(),
));
return Ok(res);
}
command =
compose_cmd_wrapper.replace("[[COMPOSE_COMMAND]]", &command);
}

View File

@@ -38,6 +38,7 @@ impl<'a> Interpolator<'a> {
.interpolate_string(&mut stack.config.environment)?
.interpolate_string(&mut stack.config.pre_deploy.command)?
.interpolate_string(&mut stack.config.post_deploy.command)?
.interpolate_string(&mut stack.config.compose_cmd_wrapper)?
.interpolate_extra_args(&mut stack.config.extra_args)?
.interpolate_extra_args(&mut stack.config.build_extra_args)
}