Skip to content

tests/validate_yaml: Implement walker to emulate checkout and forecast builds #1225

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 7 commits into
base: main
Choose a base branch
from

Conversation

nuclearcat
Copy link
Member

No description provided.

@aliceinwire
Copy link
Member

thanks you

@nuclearcat nuclearcat force-pushed the add-walker branch 2 times, most recently from 59d59ef to 8b74fe7 Compare July 2, 2025 10:22
@nuclearcat nuclearcat requested review from Copilot and pawiecz July 2, 2025 10:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a simulation pass (“walker”) to the YAML validator that emulates checkout events, applies rules, and reports builds with identical parameters.

  • Introduces validate_rules, compare_builds, and walker functions for simulating and evaluating build pipelines
  • Adds --walker and --verbose CLI flags and refactors entrypoint into a main() function
  • Updates help output and global VERBOSE flag for optional debugging
Comments suppressed due to low confidence (1)

tests/validate_yaml.py:246

  • The new walker function and its supporting logic (validate_rules, compare_builds) lack unit tests. Consider adding tests to cover this path.
def walker(merged_data):

@nuclearcat nuclearcat force-pushed the add-walker branch 2 times, most recently from 49c16ef to c66631d Compare July 2, 2025 11:13
@aliceinwire aliceinwire self-requested a review July 2, 2025 12:34
print(f"Skipping job: {job_name} due to scheduler rules")
continue
checkout["kbuilds"].append(job_name)
checkout["kbuilds_identical"] = compare_builds(merged_data, checkout["kbuilds"])
Copy link
Member

Choose a reason for hiding this comment

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

compare_builds() takes 1 positional argument but 2 were given

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

"""
Validate rules for a given node
"""
import kernelci.api.helper
Copy link
Member

Choose a reason for hiding this comment

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

https://peps.python.org/pep-0008/

Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.”

Copy link
Member Author

Choose a reason for hiding this comment

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

It is intentional, avoiding the cost of loading a heavy dependency that is used in just one rare code path.
Because kernelci.api.helper have a lot of dependencies, and this particular function of forecasting for now not planned to be used in CI, it is more manual tool to "forecast" builds.
If i put in top, it will require to rework current workflow and include kernelci-core as dependency (and slow down whole process, making it also more fragile).

@aliceinwire
Copy link
Member

would be nice to have kernelci-core as sub-module instead of searching from which repository are you getting kernelci.api.helpers

…t builds

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat
Copy link
Member Author

would be nice to have kernelci-core as sub-module instead of searching from which repository are you getting kernelci.api.helpers

I will try to implement lazy loader function that will give more info on failure.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
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.

2 participants