| Hooks |
|
Builder can already be configured to execute external code at several points during its operations: it "dots" the configured KSH setup script; and it executes the configured "gating" and "post build" scripts. These are part of the standard configuration process.
However, we recognize that it may be desirable to execute user code at other times during the process. To avoid overwhelming the novice user with questions, these hooks are not part of the normal configuration dialogue. To cause builder to execute them, just place a "hooks" file into your scenario directory.
The syntax of the file is explained in the supplied template file "hooks_template", which you'll find in $(BUILDERDIR)/extras. Simply put, though, builder will execute any script/program name in the hooks file at the indicated time. This is the current set of hook possibilities:
PreBuild: Executed just after the node preparations are completed, and before the build is launched AltBuild: Executed instead of the normal build process. PostBuild: Executed just after the build (or alt-build) is completed. PreGet: Executed just before each call to Sablime's node_update. AltUpdate: Executed instead of the call to Sablime's node_update. PostGet: Executed just after the call to Sablime's node_update. PreCopy: Executed just before attempts to copy nodes. PostCopy: Executed just after node copies. PreFinish: Executed after all the other processing is completed and just before the final email is generated and sent.
For example, you may wish to have builder send an email warning and then wait 5 minutes before copying data onto a node. This could be done in the "PreCopy" hook. Then the "PostCopy" would send email when the copy is complete. You could have this cpio warning happen before and after each node copy, or just before the first and after the last.
As another example, if you were wishing to "chain"
builder calls, you could have the "PreFinish" script
be a call to the next instance of builder.
Any output generated by these hooks will be stored into the builder output file directory and named <hook_name>_out.
These Builder defined and exported variables are available for the hooks to reference:
BUILDERDIR The root of the builder storage area VPATH The Viewpath in use by this build GENERIC The Sablime Generic GLOBAL The path/name of the global makefile SUBDIRS The build sub-directories SCEN The builder scenario name PROJ The builder project name MAILLIST The builder mailing list ERR_CNT The number of errors in the build TERM The terminal type DATE 12 digit Date string when builder started YYYYMMDDHHMM N_NAME The current Viewpath node N_TARGET The target node for a cpio copy NODE_CNT The number of the current Viewpath node N_CMODE The current copy mode (overlay, update, duplicate) RSYNC set to TRUE or FALSE based on builder is using "rsync" or "cpio" MRGROUP The Sablime group of MRs for the current getversion UMRGROUP The Sablime group of UMRs for the current getversion N_GEN The Sablime generic for the current getversion RC The return code from the just completed node_update