-
Notifications
You must be signed in to change notification settings - Fork 32
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
base: main
Are you sure you want to change the base?
Conversation
thanks you |
59d59ef
to
8b74fe7
Compare
There was a problem hiding this 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
, andwalker
functions for simulating and evaluating build pipelines - Adds
--walker
and--verbose
CLI flags and refactors entrypoint into amain()
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):
49c16ef
to
c66631d
Compare
tests/validate_yaml.py
Outdated
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"]) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/validate_yaml.py
Outdated
""" | ||
Validate rules for a given node | ||
""" | ||
import kernelci.api.helper |
There was a problem hiding this comment.
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.”
There was a problem hiding this comment.
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).
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>
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>
No description provided.