-
Notifications
You must be signed in to change notification settings - Fork 177
hooks
Bryan Drewery edited this page Nov 10, 2025
·
26 revisions
Hooks should be installed to /usr/local/etc/poudriere.d/hooks/$hookname.sh or /usr/local/etc/poudriere.d/hooks/plugins/$pluginname/$hookname.sh.
Hooks will be called with /bin/sh, not the shebang listed in the hook. Each hook has the $event variable passed into the positional parameters before any hook-specific ones listed later.
Each hook is called with the following environment:
| Version | Name | Description |
|---|---|---|
| BUILD_URL | URL for the build. | |
| BUILDNAME | The configured (${BUILDNAME_FORMAT}) build name. |
|
| LOG_URL | URL for the logs. | |
| LOG | Path to log directory for the build. | |
| POUDRIERE_BUILD_TYPE | Currently always bulk | |
| POUDRIERE_DATA | Path to configured /usr/local/poudriere/data. | |
| POUDRIERED | Path to configured /usr/local/etc/poudriere.d. | |
| JAILNAME | The configured jail name. | |
| PTNAME | The configured ports tree name. | |
| SETNAME | The configured set name (from -z) | |
| MASTERNAME | Master Jail name, i.e. JAILNAME-PTNAME-SETNAME | |
| MASTERMNT | Path to the master reference jail. This is cloned for each builder. | |
| PACKAGES | Path to the packages directory for this build. If ATOMIC_PACKAGE_REPOSITORY is enabled then this will be a symlinked subdir of PACKAGES_ROOT. |
|
| PACKAGES_ROOT | Path to the packages top-level directory. | |
| MY_JOBID | The job id of the current builder. In 3.5+ this is deprecated in favor of MY_BUILDER_ID. |
|
| 3.5+ | MY_BUILDER_ID | The builder id of the current builder. |
| 3.5+ | VERBOSE | 0 or greater to note how many -v were used. |
Adding to the environment via poudriere.conf requires using export:
# poudriere.conf
export MY_HOOK_VALUE=someval
The following hooks currently exist:
| Version | Hook name | Event | Description | Arguments |
|---|---|---|---|---|
| 3.1.10 | jail | mount | Called when jail mounts are performed. | mntpath |
| 3.1+ | jail | start | Called when the master jail starts. | |
| 3.1+ | jail | stop | Called when the master jail is stopped. | |
| 3.4+ | jail | pkgbase | Called after the package base are created | repopath |
| 3.1.2 | builder | start | Called when a builder jail is created. | id mntpath |
| 3.1.2 | builder | stop | Called when a builder jail is stopped. | id mntpath |
| 3.1+ | pkgbuild | skipped | Called for skipped port builds. | origin pkgname dependent_origin |
| 3.1+ | pkgbuild | ignored | Called for ignored port builds. | origin pkgname reason |
| 3.1+ | pkgbuild | failed | Called for failed port builds. | port pkgname phase |
| 3.1+ | pkgbuild | success | Called for successful port builds. | port pkgname |
| 3.2+ | pkgclean | done | Called when pkgclean is done. | deleted_packages (0|1) built_repository (0|1) |
| 3.2+ | pkgrepo | sign | Called right before pkg repo is called. |
PACKAGES PKG_REPO_SIGNING_KEY PKG_REPO_FROM_HOST PKG_REPO_META_FILE |
| 3.5+ | pkgrepo | publish | Called after pkg repo is called. It will be skipped if the build failed unless COMMIT_PACKAGES_ON_FAILURE is not set to no. |
PACKAGES |
| 3.1+ | bulk | start | Called when bulk starts. | |
| 3.1+ | bulk | done | Called when bulk stops. | #built #failed #ignored #skipped |
| 3.4+ | ports_update | done | Called when ports -u stops. |
The following hooks are mostly only for debugging Poudriere itself and are less useful in general:
| Version | Hook name | Event | Description | Arguments |
|---|---|---|---|---|
| 3.2+ | gather_port_vars | start | Called when fetching ports metadata starts | |
| 3.2+ | gather_port_vars | stop | Called when fetching ports metadata finishes | |
| 3.2+ | compute_deps | start | Called when dep calculation starts | |
| 3.2+ | compute_deps | stop | Called when dep calculation finishes | |
| 3.2+ | delete_old_pkgs | start | Called when incremental build checks on existing packages starts | |
| 3.2+ | delete_old_pkgs | stop | Called when incremental build checks on existing packages finishes | |
| 3.2+ | start_builders | start | Called when builders begin populating/starting | |
| 3.2+ | start_builders | stop | Called when builders are finished starting | |
| 3.2+ | build_queue | start | Called at the start of building the package queue | |
| 3.2+ | build_queue | stop | Called when the package queue is done building |