Well-known Annotations on Catalog Entities
This section lists a number of well known annotations, that have defined semantics. They can be attached to catalog entities and consumed by plugins as needed.
Annotations
This is a (non-exhaustive) list of annotations that are known to be in active use.
backstage.io/managed-by-location
# Example:
metadata:
annotations:
backstage.io/managed-by-location: url:http://github.com/backstage/backstage/blob/master/catalog-info.yaml
The value of this annotation is a so called location reference string, that
points to the source from which the entity was originally fetched. This
annotation is added automatically by the catalog as it fetches the data from a
registered location, and is not meant to normally be written by humans. The
annotation may point to any type of generic location that the catalog supports,
so it cannot be relied on to always be specifically of type url
, nor that it
even represents a single file. Note also that a single location can be the
source of many entities, so it represents a many-to-one relationship.
The format of the value is <type>:<target>
. Note that the target may also
contain colons, so it is not advisable to naively split the value on :
and
expecting a two-item array out of it. The format of the target part is
type-dependent and could conceivably even be an empty string, but the separator
colon is always present.
backstage.io/managed-by-origin-location
# Example:
metadata:
annotations:
backstage.io/managed-by-origin-location: url:http://github.com/backstage/backstage/blob/master/catalog-info.yaml
The value of this annotation is a location reference string (see above). It
points to the location, whose registration lead to the creation of the entity.
In most cases, the backstage.io/managed-by-location
and
backstage.io/managed-by-origin-location
will be equal. They will be different
if the original location delegates to another location. A common case is, that a
location is registered as bootstrap:bootstrap
which means that it is part of
the app-config.yaml
of a Backstage installation.
backstage.io/orphan
This annotation is either absent, or present with the exact string value
"true"
. It should never be added manually. Instead, the catalog itself injects
the annotation as part of its processing loops, on entities that are found to
have no registered locations or config locations that keep them "active" /
"alive".
For example, suppose that the user first registers a location URL pointing to a
Location
kind entity, which in turn refers to two Component
kind entities in
two other files nearby. The end result is that the catalog contains those three
entities. Now suppose that the user edits the original Location
entity to only
refer to the first of the Component
kind entities. This will intentionally
not lead to the other Component
entity to be removed from the catalog (for
safety reasons). Instead, it gains this orphan marker annotation, to make it
clear that user action is required to completely remove it, if desired.
# Example:
metadata:
annotations:
backstage.io/orphan: 'true'
backstage.io/techdocs-ref
# Example:
metadata:
annotations:
backstage.io/techdocs-ref: dir:.
The value of this annotation informs where TechDocs source content is stored
so that it can be read and docs can be generated from it. Most commonly, it's
written as a path, relative to the location of the catalog-info.yaml
itself,
where the associated mkdocs.yml
file can be found.
In unusual situations where the documentation for a catalog entity does not live
alongside the entity's source code, the value of this annotation can point to an
absolute URL, matching the location reference string format outlined above, for
example: url:https://github.com/backstage/backstage/tree/master
backstage.io/techdocs-entity
# Example:
metadata:
annotations:
backstage.io/techdocs-entity: component:default/example
The value of this annotation informs of an external entity that owns the TechDocs. This allows you to reference TechDocs from a single source without either duplicating the TechDocs in the TechDocs page or needing multiple builds of the same docs.
This is for situations where you have complex systems where they share a single repo, and likely a single TechDoc location.
backstage.io/view-url, backstage.io/edit-url
# Example:
metadata:
annotations:
backstage.io/view-url: https://some.website/catalog-info.yaml
backstage.io/edit-url: https://github.com/my-org/catalog/edit/master/my-service.jsonnet
These annotations allow customizing links from the catalog pages. The view URL
should point to the canonical metadata YAML that governs this entity. The edit
URL should point to the source file for the metadata. In the example above,
my-org
generates its catalog data from Jsonnet files in a monorepo, so the
view and edit links need changing.
backstage.io/source-location
# Example:
metadata:
annotations:
backstage.io/source-location: url:https://github.com/my-org/my-service/
A Location
reference that points to the source code of the entity (typically a
Component
). Useful when catalog files do not get ingested from the source code
repository itself. If the URL points to a folder, it is important that it is
suffixed with a '/'
in order for relative path resolution to work
consistently.