Fix configmap source path resolution for user-defined spec paths (#741)
Lint Checks / Run linter (push) Failing after 0s Details
Webapp Test / Run webapp test suite (push) Failing after 0s Details
Smoke Test / Run basic test suite (push) Failing after 0s Details
Publish / Gate: k8s deploy e2e (push) Failing after 2s Details
Deploy Test / Run deploy test suite (push) Failing after 0s Details
Publish / Build and publish (push) Has been skipped Details

pull/744/head v1.1.0-17b614c-202604140604
prathamesh0 2026-04-14 11:30:27 +05:30 committed by GitHub
parent 0bf1ea70d5
commit 17b614cb4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 6 deletions

View File

@ -1110,10 +1110,24 @@ def _write_deployment_files(
# Copy configmap directories for k8s deployments (outside the pod loop # Copy configmap directories for k8s deployments (outside the pod loop
# so this works for jobs-only stacks too) # so this works for jobs-only stacks too)
if parsed_spec.is_kubernetes_deployment(): if parsed_spec.is_kubernetes_deployment():
for configmap in parsed_spec.get_configmaps(): configmaps = parsed_spec.get_configmaps()
source_config_dir = resolve_config_dir(stack_name, configmap) 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("./"):
# configmap_path is relative to the repo root (cwd during
# restart). get_stack_path gives us a path like
# "stack-orchestrator/stacks/dumpster" — also relative to
# repo root. The configmap_path is already repo-relative,
# so use it directly (cwd is repo root during restart).
source_config_dir = Path(configmap_path)
else:
source_config_dir = resolve_config_dir(stack_name, configmap_name)
if os.path.exists(source_config_dir): 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) copytree(source_config_dir, destination_config_dir, dirs_exist_ok=True)
# Copy the job files into the target dir # Copy the job files into the target dir

View File

@ -392,11 +392,17 @@ class ClusterInfo:
print(f"{cfg_map_name} not in pod files") print(f"{cfg_map_name} not in pod files")
continue continue
cfg_map_path = os.path.expanduser(cfg_map_path) # ConfigMap files live in {deployment_dir}/configmaps/{name}/,
if not cfg_map_path.startswith("/") and self.spec.file_path is not None: # copied there by deploy create / restart from the source path
# specified in the spec.
if self.spec.file_path is not None:
cfg_map_path = os.path.join( cfg_map_path = os.path.join(
os.path.dirname(str(self.spec.file_path)), cfg_map_path os.path.dirname(str(self.spec.file_path)),
"configmaps",
cfg_map_name,
) )
else:
cfg_map_path = os.path.expanduser(cfg_map_path)
# Read in all the files at a single-level of the directory. # Read in all the files at a single-level of the directory.
# This mimics the behavior of # This mimics the behavior of