feat: add support of multiple templates for BGD cases#987
Open
GlimmerCape wants to merge 26 commits intomainfrom
Open
feat: add support of multiple templates for BGD cases#987GlimmerCape wants to merge 26 commits intomainfrom
GlimmerCape wants to merge 26 commits intomainfrom
Conversation
…nto feature/multiple-templates-2
3 tasks
miyamuraga
requested changes
Feb 24, 2026
| # 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(): |
Collaborator
There was a problem hiding this comment.
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" |
Collaborator
There was a problem hiding this comment.
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 |
Collaborator
There was a problem hiding this comment.
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', '') |
Collaborator
There was a problem hiding this comment.
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 | |||
|
|
||
| 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]) |
| cred_config = render_creds() | ||
|
|
||
| check_dir_exist_and_create(template_dest) | ||
| for key, appver in appvers.items(): |
| else: | ||
| logger.info("Use template resolving old logic") | ||
| return resolve_artifact_old_logic(env_definition, template_dest) | ||
| if not is_valid_appver(appver): |
Collaborator
There was a problem hiding this comment.
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": |
| 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) |
Collaborator
There was a problem hiding this comment.
there are no tests related to this condition
77b422d to
63afb15
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
Provide a concise description of what this pull request does and why it is needed.
Issue
Closes #851
Breaking Change?
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:
Additional Notes
Include any extra information, such as:
Leave blank if not applicable.