Skip to content

feat: add support of multiple templates for BGD cases#987

Open
GlimmerCape wants to merge 26 commits intomainfrom
feature/multiple-templates-2
Open

feat: add support of multiple templates for BGD cases#987
GlimmerCape wants to merge 26 commits intomainfrom
feature/multiple-templates-2

Conversation

@GlimmerCape
Copy link
Collaborator

@GlimmerCape GlimmerCape commented Feb 3, 2026

Pull Request

Summary

Provide a concise description of what this pull request does and why it is needed.

Issue

Closes #851

Breaking Change?

  • Yes
  • No

If yes, describe the breaking change and its impact (e.g., API changes, behavior changes, or required updates for users).

Scope / Project

Specify the component, module, or project area affected by this change (e.g., docs, actions, workflows).

Implementation Notes

Provide details on how the change was implemented, including any technical considerations, trade-offs, or notable design decisions. Leave blank if not applicable.

Tests / Evidence

Describe how the changes were verified, including:

  • Tests added or updated (e.g., unit, integration, end-to-end)
  • Manual testing steps or results
  • Screenshots, logs, or other evidence (if applicable)

Additional Notes

Include any extra information, such as:

  • Dependencies introduced
  • Future work or follow-up tasks
  • Reviewer instructions or context
  • References to related PRs or discussions

Leave blank if not applicable.

@github-actions github-actions bot added the bug label Feb 6, 2026
@GlimmerCape GlimmerCape marked this pull request as ready for review February 6, 2026 13:40
@GlimmerCape GlimmerCape changed the title Feature/multiple templates 2 feat: add support of multiple templates for BGD cases Feb 6, 2026
@GlimmerCape GlimmerCape linked an issue Feb 6, 2026 that may be closed by this pull request
3 tasks
# copying parameters from templates and instances
check_dir_exist_and_create(f'{render_parameters_dir}/from_template')
copy_path(f'{templates_dir}/parameters', f'{render_parameters_dir}/from_template')
for k, v in templates_dirs.items():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not good readable. it is not necessary to name letters that are not immediately obvious from code

g_template_dirs = {
'common': f"{base_dir}/tmp/templates",
}
origin_template_path = f"{base_dir}/tmp/origin/templates"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to make constant in helper for repetitive static path

}
origin_template_path = f"{base_dir}/tmp/origin/templates"
if check_dir_exists(origin_template_path):
g_template_dirs['origin'] = origin_template_path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use enum for types like peer, origin, controller?

envvars["cluster_name"] = cluster_name
envvars["templates_dir"] = templates_dir
envvars["templates_dirs"] = templates_dirs
envvars["templates_dir"] = templates_dirs.get('common', '')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we pass templates_dir if it is part of templates_dirs?

@@ -23,12 +23,15 @@ class Context(BaseModel):
render_dir: Optional[str] = ''
cloud_passport: OrderedDict = Field(default_factory=OrderedDict)
templates_dir: Optional[Path] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to delete


def process_env_template() -> str:
def is_valid_appver(appver: list[str]) -> bool:
return len(appver) >= 2 and bool(appver[0]) and bool(appver[1])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to helper

cred_config = render_creds()

check_dir_exist_and_create(template_dest)
for key, appver in appvers.items():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key is bad name

else:
logger.info("Use template resolving old logic")
return resolve_artifact_old_logic(env_definition, template_dest)
if not is_valid_appver(appver):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why complicate and add choosing method by is_valid_appver ?

logger.info("Use template resolving old logic")
return resolve_artifact_old_logic(env_definition, template_dest)
if not is_valid_appver(appver):
if not key == "common":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more readable just !=

effective_template_path = ns_template_path

if role != NamespaceRole.COMMON and role_env_template is not self.ctx.current_env_template:
role_ns_config = self._find_ns_config_by_name(role_env_template, ns_name, role_templates_dir)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no tests related to this condition

@GlimmerCape GlimmerCape force-pushed the feature/multiple-templates-2 branch from 77b422d to 63afb15 Compare February 25, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Separate template artifacts for origin and peer namespaces

2 participants