Hook scripts - abrt/retrace-server GitHub Wiki

Hooks allow you to run custom executables in between stages of retracing process.

Types of hooks

  • pre_retrace — Before starting of the retracing itself.
  • post_retrace — After retracing is done.
  • success — After retracing success.
  • fail — After retracing fails.
  • pre_start — When self.start() is called.
  • start — When task type is determined and the main task starts.
  • pre_prepare_environment — Before the preparation of retrace environment.
  • post_prepare_environment — After the preparation of retrace environment.
  • pre_prepare_debuginfo — Before the preparation of debuginfo packages.
  • post_prepare_debuginfo — After the preparation of debuginfo packages.
  • pre_clean_task — Before cleaning task.
  • post_clean_task — After cleaning task.
  • pre_remove_task — Before removing task.
  • post_remove_task — After removing task.

Location for executables

You can place any executable into one of the sub-directories of /usr/libexec/retrace-server/hooks/.

Found executables are executed in alphabetical order when hooks are triggered during retracing.

Order of configuration parsing

  1. Default values
  2. Values from /etc/retrace-server/retrace-server-hooks.conf
  3. Values from /etc/retrace-server/hooks/**.conf
  4. Values from [section.EXECUTABLE] from /etc/retrace-server/hooks/**.conf
  5. Values from $HOME/.config/retrace-server/retrace-server-hooks.conf
  6. Values from $HOME/.config/retrace-server/hooks/**.conf
  7. Values from [section.EXECUTABLE] from $HOME/.config/retrace-server/hooks/**.conf

Configuration options

For the hooks you can configure:

  • timeout — Allowed time (in seconds) before the hook execution fails.
  • cmdline — Command line options with optional variables {hook_name}, {taskid}, {task_results_dir}.

Examples

Set timeout for all start hooks

In /etc/retrace-server/hooks/start.conf add:

[start]
timeout=30

Set timeout for a specific executable (Hello_World.sh)

[start.Hello_World]
timeout=123

Set cmdline for echo command for start hooks:

In /etc/retrace-server/hooks/start.conf

[start.echo]
cmdline="Hello World {taskid}"

Which will print Hello World 20200101 during a start retracing stage.