Collector
The Collector Bash SDK is a set of Lunar CLI subcommands that allow you to collect SDLC metadata from within a collector, or from external systems, such as your CI system directly.
Collector environment
Earthly Lunar executes collectors in an environment set up with the following variables:
LUNAR_HUB_HOST
: The host of the Lunar Hub.LUNAR_HUB_INSECURE
: Whether to skip SSL verification of the Lunar Hub.LUNAR_COLLECTOR_NAME
: The name of the collector.LUNAR_COLLECTOR_CI_PIPELINE
: The CI pipeline of the component that the collector is running for (if this is a CI collector).LUNAR_COMPONENT_ID
: The ID of the component that the collector is running for ingithub.com/.../...
format.LUNAR_COMPONENT_DOMAIN
: The domain of the component.LUNAR_COMPONENT_OWNER
: The owner of the component.LUNAR_COMPONENT_PR
: The PR number of the component, if applicable.LUNAR_COMPONENT_TAGS
: The tags of the component.LUNAR_COMPONENT_GIT_SHA
: The Git SHA of the component that the collector is running for.LUNAR_COMPONENT_META
: The metadata of the component as a JSON object.Any secrets set in the Lunar Hub for the collector, via
LUNAR_COLLECTOR_SECRETS=<env-var-name>=<value>;...
.
lunar collect
CLI command
lunar collect
CLI commandForm:
The lunar collect
command is used to collect SDLC metadata from within a collector. The command takes a JSON path and a value as arguments. The JSON path is used to specify the location in the JSON object where the value should be stored.
--component <component-name>
--component <component-name>
Type:
string
Optional
The --component
flag is used to specify the name of the component that the value should be associated with. If the flag is not provided, the component is inferred from the context in which the command is executed (environment variables set by the collector).
If the collect command is executed outside of a collector, the component name must be provided.
--json
--json
The --json
flag is used to specify that the value should be interpreted as a JSON object, JSON array, or JSON scalar (string, number, etc). If the flag is not provided, the value is interpreted as a raw string.
<json-path>
<json-path>
Type:
string
The JSON path is used to specify the location in the JSON object where the value should be stored. The path is specified using dot notation, where each level of the object is separated by a dot. For example, foo.bar.baz
would specify the baz
property of the bar
object, which is a property of the foo
object.
<value>
<value>
By default, the value is interpreted as a raw string. If the --json
flag is provided, the value is interpreted as a JSON object, JSON array, or JSON scalar (string, number, etc).
If the value is -
, the value is read from standard input. This is useful for piping the output of a command into the lunar collect
command.
Last updated