Hooks enable you to execute custom code at certain points during a BundleWrap run. This is useful for integrating with other systems e.g. for team notifications, logging or statistics.
To use hooks, you need to create a subdirectory in your repo called hooks
. In that directory you can place an arbitrary number of Python source files. If those source files define certain functions, these functions will be called at the appropriate time.
hooks/my_awesome_notification.py
:
from my_awesome_notification_system import post_message
def node_apply_start(repo, node, interactive=False, **kwargs):
post_message("Starting apply on {}, everything is gonna be OK!".format(node.name))
Note
Always define your hooks with **kwargs
so we can pass in more information in future updates without breaking your hook.
This is a list of all functions a hook file may implement.