Fix configmap source path resolution from spec values

Spec configmaps with explicit paths (e.g. "stack-orchestrator/compose/maintenance")
were ignored — only the key name was used to look up under config/.
Now resolves the spec value relative to the stack root when provided.
Values starting with ./ (auto-discovered by deploy init) still use
the existing config/ directory convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pull/741/head
Prathamesh Musale 2026-04-14 05:20:31 +00:00
parent 0bf1ea70d5
commit 0bdba4e822
1 changed files with 13 additions and 3 deletions

View File

@ -1110,10 +1110,20 @@ def _write_deployment_files(
# Copy configmap directories for k8s deployments (outside the pod loop
# so this works for jobs-only stacks too)
if parsed_spec.is_kubernetes_deployment():
for configmap in parsed_spec.get_configmaps():
source_config_dir = resolve_config_dir(stack_name, configmap)
configmaps = parsed_spec.get_configmaps()
for configmap_name, configmap_path in configmaps.items():
# Spec values starting with ./ are deployment-dir destination
# paths (written by deploy init for auto-discovered configmaps).
# Other values are source paths relative to the stack root
# (user-defined in spec.yml). Fall back to the config/ dir
# convention if no value is provided.
if configmap_path and not str(configmap_path).startswith("./"):
stack_root = Path(get_stack_path(stack_name)).parent.parent
source_config_dir = stack_root / configmap_path
else:
source_config_dir = resolve_config_dir(stack_name, configmap_name)
if os.path.exists(source_config_dir):
destination_config_dir = target_dir.joinpath("configmaps", configmap)
destination_config_dir = target_dir.joinpath("configmaps", configmap_name)
copytree(source_config_dir, destination_config_dir, dirs_exist_ok=True)
# Copy the job files into the target dir