Hooks
Hooks are ways to change default behaviors in scripts, or just do something at a certain time.
All hooks should be in your project root located at bin/hooks (This also can be overwritten or added to.) Hooks can be
any type of executable but the file should be marked executable (chomd +x)
If build has a default behavior for your hook, it's located at bin/build/hooks.
IMPORTANT: Environment
BUILD_HOOK_EXTENSIONSmust containshto if you wantbin/build/hooksdefault hooks to run in your project. The default value issh.
Most hooks are optional unless specified.
Version Hooks
version-already- Run code whenreleaseNewis run but a new release already exists.version-created- This hook is run whenreleaseNewcreates a new release.version-current- Outputs a string which displays the current application version. Default hook uses thedocs/releasedirectory.version-live- The current published live version of the software. (Optional but highly recommended.)version-notes- When a new release notes file needs to be generated, this generates the new file if you want something custom.version-notes-copyright- And, if you want to have a custom copyright line, just add this hook.
Application Hooks
application-environment- Create the environment file. Default callsenvironmentFileApplicationMakewith yourapplication-files- List all files which are related tocodeor behavior of the application. Should not includeapplication-fingerprint- Generate a unique ID which represents the code in an application and changes when the code changesapplication-tag- The current tagged version of the software (e.gv1.0.0rc71)application-id- Returns a string checksum of the current application source code (unique checksum for code state)maintenance- Turn on or off maintenancenotify- Notify administrator of something important
Development Hooks
project-activate- Sourced. When a project is activated - e.g. switching to starting development in this project. (e.g. your project, the current project)project-deactivate- Sourced. When a project is deactivated - e.g. switching away from this project to someone else's project for development - note the other project may NOT have the current version ofZesk Build.
Deployment Hooks
deploy-start- Run on deployed system. Begin deployment, after maintenance has been enabled (delete caches, etc.)deploy-finish.shAfter new code is deployed (update local files or register server etc.)deploy-confirm.shAfter new code is deployed make sure it is running correctlydeploy-activate- Run on deployed system. During deployment install passed directory as new version of the app in current directorydeploy-finish- Run on deployed system. Deployment is finished (before maintenance is turned off)deploy-confirm- Run on pipeline systems. Before finish, check that deployment succeeded remotely via an alternate mechanism (smoke tests)deploy-cleanup- Run on deployed system. After deployment, delete stray files from deployment if needed.deploy-link- Links a version of the application to a symbolic link to enable fast application version switching.deploy-revert- Run on deployed system. After failed deployment, revert to previous version.
Documentation Hooks
documentation-complete- ThedocumentationBuildcompleted successfully.documentation-error- ThedocumentationBuildcompleted with errors.
Vendor Hooks
git-pre-commit- A git pre-commit hook. Install it withgitInstallHooks.git-post-commit- A git post-commit hook. Install it withgitInstallHooks.github-release-before- Run beforegithub-releaserelease the release to GitHub.github-release-after- Run aftergithub-releaserelease the release to GitHub.
Language Pre-Commit Hooks
pre-commit-php- Run on PHP files before commit. Fixes all file modes and runsphp-cs-fixer.pre-commit-sh- Run on Bash files before commit.bashSanitizeon all files.
Testing Hooks
test-setup- Move or copy files prior to docker-compose build to build test containertest-runner- Run unit and any other tests inside the container (Required for test scripts)test-cleanup- Reverse oftest-setuphook actions