Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter yaml elements #174

Closed
wants to merge 7 commits into from
Closed

filter yaml elements #174

wants to merge 7 commits into from

Conversation

pbadevops
Copy link

added function to filter app specific yaml files entries.

__commit_and_push(team_config_git_repo, root_config_git_repo, git_user, git_email, apps_config_file_name)


def __clean_yaml(values: Dict[str, Any]) -> Any:
# storing yaml to allow deletion while iterating
Copy link
Member

Choose a reason for hiding this comment

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

can you get rid of the comments? If you think you need them, I would extract them to subfunctions and name these accordingly

from gitopscli.git_api import GitApiConfig, GitRepo, GitRepoApiFactory
from gitopscli.io_api.yaml_util import merge_yaml_element, yaml_file_load
from gitopscli.gitops_exception import GitOpsException
from .command import Command

# array of allowed values for __clean_yaml function
Copy link
Member

Choose a reason for hiding this comment

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

get rid of comment, you change variable name if the name itself is not descriptive enough

Copy link
Member

@christiansiegel christiansiegel left a comment

Choose a reason for hiding this comment

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

Thanks for the PR :) But could you please elaborate on what you are trying to achieve? Maybe describe your new feature in the documentation (docs folder)

for key in values.keys():
logging.info("processing %s ", key)
# checking if key is in blacklist and remove it if necessary
if key in YAML_BLACKLIST:
Copy link
Member

Choose a reason for hiding this comment

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

This list is always empty

Copy link
Author

Choose a reason for hiding this comment

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

The list is set in case of keywords that would need to be removed. by default it's empty and allow all keywords.

@@ -78,6 +79,9 @@ def setUp(self):
"repository": "https://other-team.config.repo.git",
"applications": {"some-other-app-2": None},
},
"/tmp/team-config-repo/my-app/values.yaml": {
"config": {"repository": "https://team.config.repo.git", "applications": {"some-other-app-1": None}}
Copy link
Member

Choose a reason for hiding this comment

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

Why is there a app/team config yaml in a app/team config repo? We are using app/team config yamls in the root config repo to find app/team config repos: https://baloise.github.io/gitopscli/commands/sync-apps/#root-config-repository

Copy link
Author

Choose a reason for hiding this comment

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

this implementation answer COP-1705 to have app specific configuration.

@pbadevops
Copy link
Author

As asked , trivial comments had been removed to improve code comprehension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants