Skip to content

config: Find YAML files recursively #2860

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pawiecz
Copy link
Contributor

@pawiecz pawiecz commented Apr 25, 2025

Previously only top-level files were found in a given directory.

Fixes: #2859

Previously only top-level files were found in a given directory.

Fixes: kernelci#2859

Signed-off-by: Paweł Wieczorek <[email protected]>
@@ -24,7 +24,7 @@ def iterate_yaml_files(config_path: str):
if config_path.endswith('.yaml'):
yaml_files = [config_path]
else:
yaml_files = glob.glob(os.path.join(config_path, "*.yaml"))
yaml_files = glob.glob(os.path.join(config_path, "**", "*.yaml"), recursive=True)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
yaml_files = glob.glob(os.path.join(config_path, "**", "*.yaml"), recursive=True)
yaml_files = glob.iglob(os.path.join(config_path, "**", "*.yaml"), recursive=True)

Copy link
Member

Choose a reason for hiding this comment

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

While we do not expect a large number of files there, as such memory usage is not a concern, we walk the list of the files we find almost immediately, so we might as well use the variant that returns an iterator.

Copy link
Member

@kwilczynski kwilczynski left a comment

Choose a reason for hiding this comment

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

Looks good! A small nit, but it's non-blocking, for sure.

@kwilczynski
Copy link
Member

The following change should, once this branch is rebased, help resolve the CI linker failure:

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.

Loading YAML configs works only for files found in top-level config_path
2 participants