collectors/hooks
Collector Hooks
lunar-config.yml -> collectors.<collector-index>.hooks
lunar-collector.yml -> collectors.<collector-index>.hooks
Type:
array
Form:
Hooks defines when a collector should run.
Example hooks definition:
Collector Hook
lunar-config.yml -> collectors.<collector-index>.hooks.<hook-index>
lunar-collector.yml -> collectors.<collector-index>.hooks.<hook-index>
Type:
object
Form:
A collector hook defines a trigger point for when a collector should run. Collectors can be triggered by various events such as code changes, CI pipeline events, or cron schedules.
Different hooks will cause the collector to execute in different contexts. For example, ci-*
hooks will execute the collector in the context of the CI pipeline, while code
and cron
hooks will execute on a Lunar runner.
A hook has different configuration options depending on the type of event it is triggered by.
Hook types
ci-before-job
Form:
The ci-before-job
type triggers the collector before a CI job is run. The collector will run if the job name matches the specified regex pattern.
If no pattern is specified, the collector will run before every job.
ci-after-job
Form:
The ci-after-job
type triggers the collector after a CI job is run. The collector will run if the job name matches the specified regex pattern.
If no pattern is specified, the collector will run after every job.
ci-before-step
Form:
The ci-before-step
type triggers the collector before a CI step is run. The collector will run if the step name matches the specified regex pattern.
If no pattern is specified, the collector will run before every step.
ci-after-step
Form:
The ci-after-step
type triggers the collector after a CI step is run. The collector will run if the step name matches the specified regex pattern.
If no pattern is specified, the collector will run after every step.
ci-before-command
Form:
The ci-before-command
type triggers the collector before a command is run in the CI pipeline. The collector will run if the command line matches the specified regex pattern.
The command can be any process within the CI pipeline even if it is wrapped in scripts or called from other commands.
ci-after-command
Form:
The ci-after-command
type triggers the collector after a command is run in the CI pipeline. The collector will run if the command line matches the specified regex pattern.
The command can be any process within the CI pipeline even if it is wrapped in scripts or called from other commands.
code
Form:
The code
type triggers the collector when the code of the component changes (i.e. there are new commits).
cron
Form:
The cron
type triggers the collector on a cron schedule. The collector will run according to the specified cron schedule.
If the clone-code
option is set to true
, the collector will execute in the context of the code repository. This means that the collector will have access to a git clone of the code repository and to interact with.
Last updated