LogoLogo
HomeBlogGet a Demo
  • Introduction
  • Install Lunar
  • Learn the basics
  • 📖Docs
    • Key concepts
    • Component JSON
    • Catalog JSON
    • Lunar CLI Reference
  • 📝Configuration
    • lunar-config.yml
      • catalogers
      • catalogers/hooks
      • domains
      • components
      • collectors
      • collectors/hooks
      • policies
    • lunar.yml
  • 🛠️Plugin SDKs
    • Plugins configuration
      • lunar-cataloger.yml
      • lunar-collector.yml
      • lunar-policy.yml
    • Bash SDK
      • Cataloger
      • Collector
    • Python SDK
      • Collector
      • Policy
        • Check
        • Path
        • ComponentData
        • NoDataError
        • Utility Functions
  • ⚙️SQL API
    • Overview
    • Views
      • domains
      • components
      • component_deltas
      • initiatives
      • policies
      • checks
      • prs
      • catalog
Powered by GitBook

©️ Earthly Technologies

On this page
  • Collector environment
  • lunar collect CLI command
  • --component <component-name>
  • --json
  • <json-path>
  • <value>
  1. Plugin SDKs
  2. Bash SDK

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 in github.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

  • Form:

    lunar collect [--component <component-name>] [--json] <json-path> <value>

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>

  • 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

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>

  • 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>

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.

PreviousCatalogerNextPython SDK

Last updated 18 hours ago

🛠️