Backstage Guardrails
Validates Backstage catalog-info.yaml entries for completeness and compliance. Checks that the catalog file exists and is valid, owner is set, lifecycle stage is defined, and system grouping is assigned.
backstage to your lunar-config.yml:uses: github://earthly/lunar-lib/policies/backstage@v1.0.5
Included Guardrails
This policy includes 5 guardrails that enforce standards for your repository and ownership.
catalog-info-exists
Verifies that a catalog-info.yaml file exists in the repository.
Every Backstage-managed service must have a catalog definition file.
Fails if the backstage collector reports no catalog file found.
catalog-info-valid
Verifies that the catalog-info.yaml file is syntactically valid and passes Backstage descriptor schema checks (no lint errors reported by the collector). Fails if the file is missing or has lint errors.
owner-set
Validates that the owner field (spec.owner) is populated in the catalog-info.yaml. Ownership is required for incident routing and accountability. Fails if no catalog file is present.
lifecycle-set
Validates that the lifecycle stage (spec.lifecycle) is defined in the catalog-info.yaml. Lifecycle stages (production, experimental, deprecated) inform operational expectations and SLO requirements. Fails if no catalog file is present.
system-set
Validates that the system grouping (spec.system) is defined in the catalog-info.yaml. System assignment enables dependency mapping and architectural visibility. Fails if no catalog file is present.
How Guardrails Fit into Lunar
Lunar guardrails define your engineering standards as code. They evaluate data collected by integrations and produce pass/fail checks with actionable feedback.
Policies support gradual enforcement—from silent scoring to blocking PRs or deployments—letting you roll out standards at your own pace without disrupting existing workflows.
Learn How Lunar Works →Required Integrations
This policy evaluates data gathered by one or more of the following integration(s).
Make sure to enable them in your lunar-config.yml.
Documentation
View on GitHubBackstage Guardrails
Enforce Backstage service catalog standards for catalog-info.yaml completeness.
Overview
Validates that Backstage catalog entries include required metadata for service ownership, lifecycle management, and system architecture. These checks apply to repositories that use Backstage as their service catalog and must be paired with the backstage collector.
Behavior when no catalog file is present: All checks fail. A repository enabled for this policy is expected to be registered in Backstage, so a missing catalog-info.yaml is treated as a policy violation (not a skip).
Policies
This plugin provides the following policies (use include to select a subset):
| Policy | Description |
|---|---|
catalog-info-exists |
Verifies catalog-info.yaml exists in the repository |
catalog-info-valid |
Verifies catalog-info.yaml passes lint/schema checks |
owner-set |
Validates that spec.owner is populated |
lifecycle-set |
Validates that spec.lifecycle is defined |
system-set |
Validates that spec.system is defined |
Required Data
This policy reads from the following Component JSON paths. The presence of .catalog.native.backstage indicates that a catalog-info file was found; its absence means no file exists.
| Path | Type | Provided By |
|---|---|---|
.catalog.native.backstage |
object | backstage collector (namespace present ⇔ file found) |
.catalog.native.backstage.valid |
boolean | backstage collector |
.catalog.native.backstage.errors[] |
array | backstage collector |
.catalog.native.backstage.spec.owner |
string | backstage collector |
.catalog.native.backstage.spec.lifecycle |
string | backstage collector |
.catalog.native.backstage.spec.system |
string | backstage collector |
Note: Ensure the backstage collector is configured before enabling this policy.
Installation
Add to your lunar-config.yml:
policies:
- uses: github://earthly/lunar-lib/policies/backstage@v1.0.0
on: ["domain:your-domain"]
enforcement: report-pr
# include: [catalog-info-exists, owner-set] # Only run specific checks
Examples
Passing Example
{
"catalog": {
"native": {
"backstage": {
"valid": true,
"errors": [],
"path": "catalog-info.yaml",
"apiVersion": "backstage.io/v1alpha1",
"kind": "Component",
"metadata": { "name": "payment-api" },
"spec": {
"type": "service",
"owner": "team-payments",
"lifecycle": "production",
"system": "payment-platform"
}
}
}
}
}
Failing Example (spec fields missing)
{
"catalog": {
"native": {
"backstage": {
"valid": true,
"errors": [],
"path": "catalog-info.yaml",
"apiVersion": "backstage.io/v1alpha1",
"kind": "Component",
"metadata": { "name": "payment-api" },
"spec": {
"type": "service"
}
}
}
}
}
Failing Example (no catalog-info.yaml)
{}
The .catalog.native.backstage namespace is simply absent. All five checks fail.
Failure messages:
"No catalog-info.yaml found""catalog-info.yaml has lint errors: <details>""Owner (spec.owner) is not set in catalog-info.yaml""Lifecycle stage (spec.lifecycle) is not set in catalog-info.yaml""System (spec.system) is not set in catalog-info.yaml"
Remediation
When this policy fails, resolve it by updating your catalog-info.yaml:
- Missing file - Create a
catalog-info.yamlin the repository root following the Backstage descriptor format - Lint errors - Review
.catalog.native.backstage.errors[]in the component payload and fix the reported issues - Missing owner - Add
spec.ownerwith a valid team or user reference (e.g.,team-payments) - Missing lifecycle - Add
spec.lifecyclewith a stage:production,experimental, ordeprecated - Missing system - Add
spec.systemreferencing the parent system that groups related components
Open Source
This policy is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.
Common Use Cases
Explore how individual guardrails work with specific integrations.
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.