Observer
API

Command-line tool

Install and use the observer CLI to apply config-as-code from version control.

The observer CLI applies and exports your configuration through the public API. Your configuration lives in your repository, is reviewed in pull requests, and is applied through a workflow you control.

The CLI is open source at github.com/useobserver/cli.

Install

Binary

The install script downloads the binary for your platform and puts it on PATH:

curl -fsSL https://raw.githubusercontent.com/useobserver/cli/main/install.sh | sh

To install without sudo, point it at a directory you own:

OBSERVER_INSTALL_DIR="$HOME/.local/bin" \
  curl -fsSL https://raw.githubusercontent.com/useobserver/cli/main/install.sh | sh

Binaries for Linux, macOS, and Windows (x64 and arm64) are published on the releases page, each with a SHA-256 checksum.

GitHub Action

Run the CLI in CI without installing a binary:

- uses: useobserver/cli@v1
  with:
    file: observer.yaml
    mode: ${{ github.event_name == 'pull_request' && 'dry-run' || 'apply' }}
  env:
    OBSERVER_API_URL: ${{ vars.OBSERVER_API_URL }}
    OBSERVER_API_KEY: ${{ secrets.OBSERVER_API_KEY }}

This plans on pull requests and applies on merge to your default branch.

Configure

Create the key in the console under API keys. See Authentication for the scope list.

Commands

# Plan only: show the diff, change nothing (run on pull requests)
observer apply -f observer.yaml --dry-run

# Apply: upsert by key (never deletes objects absent from the document)
observer apply -f observer.yaml

# Also delete config-managed objects removed from the document
observer apply -f observer.yaml --prune

# Export current state to seed your repository
observer export --format yaml -o observer.yaml

Exit codes: 0 success, 1 validation failure or error, 2 usage error.

Was this page helpful?