-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[feature] Add hooks for validate and validate_build methods #17856
base: develop2
Are you sure you want to change the base?
Conversation
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
#17879 has been merged to develop2, please merge from develop2 to get rid of HookManager instantiation issue. |
compatibility_file = os.path.join(compatibility_plugin_folder, "compatibility.py") | ||
if not os.path.exists(compatibility_file): | ||
raise ConanException("The 'compatibility.py' plugin file doesn't exist. If you want " | ||
"to disable it, edit its contents instead of removing it") | ||
mod, _ = load_python_file(compatibility_file) | ||
self._compatibility = mod.compatibility | ||
self._hook_manager = HookManager(HomePaths(cache_folder).hooks_path) |
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.
You shouldn't instantiate HookManager
here anymore.
unknown_mode = global_conf.get("core.package_id:default_unknown_mode", default="semver_mode") | ||
non_embed = global_conf.get("core.package_id:default_non_embed_mode", default="minor_mode") | ||
# recipe_revision_mode already takes into account the package_id | ||
embed_mode = global_conf.get("core.package_id:default_embed_mode", default="full_mode") | ||
python_mode = global_conf.get("core.package_id:default_python_mode", default="minor_mode") | ||
build_mode = global_conf.get("core.package_id:default_build_mode", default=None) | ||
self._modes = unknown_mode, non_embed, embed_mode, python_mode, build_mode | ||
self._hook_manager = HookManager(HomePaths(self._home_folder).hooks_path) |
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.
Do not instantiate here a new HookManager
Motivation
Hello!
This PR brings a new hooks for validate() and validate_build() methods.
The intention is to help CI services validate a build without touching the recipe, by adding an extra layer of validations. For instance, the CI environment could not build a determined package due to custom settings, or some system library is not available because the O.S. is too old.
Details
Both
validate
andvalidate_build
don't have a specific command, like export or build, so I usedconan create
to get a ride and check if is working.Also, both methods are not defined by default, which means, the hook will only run when one of these methods is defined in the recipe.
Automation
Changelog: Feature: Add hooks pre_validate, post_validate, pre_validate_build and post_validate_build
Docs: TODO
/cc @jcar87
develop
branch, documenting this one.