Learn the basics
Walk through your first Lunar setup — populating components, defining policies, and running checks against your repositories.
Prerequisites
Basic Concepts
Your First Lunar Setup
1
Populate your Lunar configuration
version: 0
hub:
host: <host>
grpcPort: <grpc-port>
httpPort: <http-port>
# Use the official Lunar image for running scripts in containers
default_image: earthly/lunar-scripts:1.0.0
domains:
team1:
description: Main organization domain
components:
github.com/my-org/my-service:
owner: jane@example.com
domain: team1
collectors:
- name: readme-lines
runBash: |-
if [ -f ./README.md ]; then
lunar collect -j \
"repo.readme_exists" true \
"repo.readme_num_lines" "$(wc -l < ./README.md)"
else
lunar collect -j "repo.readme_exists" false
fi
hook:
type: code
policies: []lunar hub pull github://my-org/lunar@main2
Define your first policy
policies:
- name: readme
description: "README.md standards"
on: ["domain:team1"]
runPython: |-
from lunar_policy import Check
with Check("readme-exists", "Repository should have a README.md file") as c:
c.assert_true(c.get_value(".repo.readme_exists"), "README.md file not found")lunar hub pull github://my-org/lunar@mainSee also
Last updated
