collectors
Collectors
lunar-config.yml -> collectorsType:
arrayForm:
collectors: - <collector-object> - <collector-object> - ...
Collectors are used to collect live information from various sources to associate with individual components.
Example collectors definition:
collectors:
- uses: github://third-party/some-collector@v1
on: [auth, frontend]
hook:
type: ci-before-command
pattern: ^go build.*
- uses: ./my-collector
on: ["domain:my-domain"]
hook:
type: ci-before-job
pattern: .*
- uses: ./my-collector
on: ["domain:foo-product"]
hook:
type: code
- uses: ./another-collector
on: [go]
hook:
type: cron
schedule: "0 2 * * *"
- name: Hello world collector
runBash: lunar collect '.hello' world
on: [java]
hook:
type: ci-after-command
pattern: ^mvn install.*
- name: Example script collector
mainBash: ./my-script.sh
on: [python]
hook:
type: cron
schedule: "0 2 * * *"Collector
lunar-config.yml -> collectors.<collector-index>Type:
objectForms
Uses form (use an external collector plugin):
name: <collector-name> uses: <collector-string> with: <input-name>: <input-value> ... on: <domain-array>Run form (define a collector inline):
name: <collector-name> run<language>: <command-string> on: <domain-array> hook: <hook-configuration> hooks: - <hook-configuration> - <hook-configuration> - ...Main form (define a collector inline with a main file):
name: <collector-name> main<language>: <main-file-path> on: <domain-array> hook: <hook-configuration> hooks: - <hook-configuration> - <hook-configuration> - ...
Collectors are used to collect live information from various sources to associate with individual components. Collectors can be used to instrument CI/CD pipelines, run cron jobs, or execute arbitrary logic when code changes.
Collectors can either be imported (Uses form), defined as an inline command (Run form), or defined as a script to run (Main form). When a collector is defined inline (Run and Main forms), a hook must be specified to determine when the collector should run.
name
namelunar-config.yml -> collectors.<collector-index>.nameType:
stringRequired for Run and Main collector forms, Optional for Uses collector form
The name field is used to specify the name of the collector. If a name is not provided in the case of a collector plugin, the name from the collector plugin is used. The name must be unique within the configuration.
uses
useslunar-config.yml -> collectors.<collector-index>.usesType:
stringForms
GitHub form:
github://<org>/<repo>@<version>Local form:
./<path-to-collector>
Required in Uses collector form
The uses field specifies an external (plugin) collector to use. The collector can be a third-party collector, or a local collector defined in a subdirectory.
with
withlunar-config.yml -> collectors.<collector-index>.withType:
objectOptional
The with field specifies the inputs to pass to the collector plugin. The inputs are defined in the collector's configuration file.
run<language>
run<language>lunar-config.yml -> collectors.<collector-index>.run<language>Type:
stringRequired in Run collector form
Defines the command to execute when the collector is invoked. Only Bash and Python are supported. So runBash and runPython are the only valid fields.
Running Bash supports installing dependencies.
runBash
lunar-config.yml -> collectors.<collector-index>.runBashType:
string
The runBash field specifies the bash collector script to run.
runPython
lunar-config.yml -> collectors.<collector-index>.runPythonType:
string
The runPython field specifies the python collector script to run. Running Python supports installing dependencies.
main<language>
main<language>lunar-config.yml -> collectors.<collector-index>.main<language>Type:
stringRequired in Main collector form
Defines the main file path used to execute when the collector is invoked. Only Bash and Python are supported. So mainBash and mainPython are the only valid field.
The file path is relative to the root of the Lunar configuration repository. In the case of an external plugin definition, the path is relative to the plugin directory.
Running Bash supports installing dependencies.
mainBash
lunar-config.yml -> collectors.<collector-index>.mainBashType:
string
The mainBash field specifies the path to the bash main file to run.
mainPython
lunar-config.yml -> collectors.<collector-index>.mainPythonType:
string
The mainPython field specifies the path to the python main file to run. Running Python supports installing dependencies.
on
onlunar-config.yml -> collectors.<collector-index>.onType:
arrayRequired
The on field specifies the tags that the collector should be associated with. The collector will only run when the component has one or more of the specified tags.
To associate the collector with a domain, use the tag domain:<domain-name>. For example, to associate a collector with the domain bar, which is under the domain foo, use the tag domain:foo.bar.
hook
hooklunar-config.yml -> collectors.<collector-index>.hookType:
objectOne of
hookorhooksis required in Run collector form
Using hook is equivalent to using a single hook in the hooks field. The hook field specifies when the collector should run.
For more information about hook definitions see the hooks configuration page.
hooks
hookslunar-config.yml -> collectors.<collector-index>.hooksType:
arrayOne of
hookorhooksis required in Run collector form
The hooks field specifies when the collector should run.
For more information about hook definitions see the hooks configuration page.
Last updated