Component Constructor

The component constructor is the input format used by the OCM CLI to build component versions (YAML or JSON). It describes one or more component versions and their artifacts.

Top-Level Structure

# yaml-language-server: $schema=https://ocm.software/schemas/configuration-schema.yaml
components:
- name: ocm.software/example/myapp
  version: 1.0.0
  provider:
    name: ocm.software
  labels: []
  labels: []
  resources: []
  sources: []
  componentReferences: []
FieldTypeRequiredDescription
componentsarrayyesList of component specifications to build.

Each entry in components defines one component version.

Alternatively, a single component can be specified directly as the top-level object (without the components wrapper).

Component

FieldTypeRequiredDescription
namestringyesName of the component. Must match ^[a-z][-a-z0-9]*([.][a-z][-a-z0-9]*)*[.][a-z]{2,}(/[a-z][-a-z0-9_]*([.][a-z][-a-z0-9_]*)*)+$. Max 255 characters.
versionstringyesVersion of the component. Relaxed semver — optional v prefix.
providerobjectyesProvider type of the component in the origin’s context.
provider.namestringyesName of the provider (e.g. ocm.software).
provider.labelsarraynoLabels on the provider. See Labels.
labelsarraynoLabels associated with the component. See Labels.
resourcesarraynoResources created by the component or third parties. See Resources.
sourcesarraynoSources that produced the component. See Sources.
componentReferencesarraynoReferences to other component versions. See Component References.
creationTimestringnoCreation time of the component version. RFC 3339 formatted date-time.

Environment Variable Substitution

Any string value supports ${VARIABLE} substitution from the shell environment. Undefined variables expand to empty strings.

version: ${VERSION}

Resources

Each resource describes a delivery artifact. A resource must have exactly one of input (embed by value) or access (reference by location).

Resource with input

resources:
- name: manifests
  type: blob
  version: 1.0.0
  relation: local
  extraIdentity:
    arch: amd64
  labels: []
  sourceRefs: []
  input:
    type: dir
    path: ./deploy
    compress: true
FieldTypeRequiredDescription
namestringyesName of the resource. Pattern: ^[a-z0-9]([-_+a-z0-9]*[a-z0-9])?$, min 2 characters.
typestringyesType of the resource. See Artifact Types.
inputobjectyesInput specification for the resource. See Input Types.
extraIdentityobjectnoAdditional identity attributes for the resource.
labelsarraynoLabels associated with the resource.
sourceRefsarraynoReferences to sources that produced this resource.
versionstringnoVersion of the resource (relaxed semver). Defaults to the component version.
relationstringnoMust be local if specified. Defaults to local.

Resource with access

resources:
- name: image
  type: ociImage
  version: 1.0.0
  relation: external
  extraIdentity:
    arch: amd64
  labels: []
  sourceRefs: []
  access:
    type: OCIImage/v1
    imageReference: ghcr.io/acme/myapp:1.0.0
FieldTypeRequiredDescription
namestringyesName of the resource.
typestringyesType of the resource. See Artifact Types.
accessobjectyesAccess specification for the resource. See Access Types.
versionstringnoVersion of the resource (relaxed semver). Defaults to the component version.
relationstringnoRelation of the resource to the component (local or external). Default: external.
extraIdentityobjectnoAdditional identity attributes for the resource.
labelsarraynoLabels associated with the resource.
sourceRefsarraynoReferences to sources that produced this resource.

Sources

Source code references for provenance tracking. Like resources, each source has either input or access.

sources:
- name: source
  type: filesystem
  version: 1.0.0
  extraIdentity:
    arch: amd64
  labels: []
  input:
    type: dir
    path: ./src
FieldTypeRequiredDescription
namestringyesName of the source. Pattern: ^[a-z0-9]([-_+a-z0-9]*[a-z0-9])?$, min 2 characters.
typestringyesType of the source (e.g. git, filesystem).
access or inputobjectyesExactly one of the two. Same types as for resources.
versionstringyesVersion of the source (relaxed semver).
extraIdentityobjectnoAdditional identity attributes for the source.
labelsarraynoLabels associated with the source.

Component References

References to other component versions, creating a component hierarchy.

componentReferences:
- name: frontend
  componentName: ocm.software/tutorials/frontend
  version: 1.5.0
  extraIdentity:
    arch: amd64
  labels: []
FieldTypeRequiredDescription
namestringyesLocal name of the reference.
componentNamestringyesName of the referenced component. Same naming rules as the component name.
versionstringyesVersion of the referenced component.
extraIdentityobjectnoAdditional identity attributes for the reference.
labelsarraynoLabels associated with the reference.

Referenced components must be reachable at build time — either defined in the same constructor file or available in a repository accessible through configured resolvers.

Input Types

Input types embed content directly into the component version. The following input types are supported:

TypeDescription
dir/v1Embeds a directory as a tar archive. Short form: dir.
file/v1Embeds a single file. Short form: file.
helm/v1Embeds a Helm chart from a local path or remote repository. Short form: helm.
utf8/v1Embeds inline text or structured data (JSON, YAML). Short form: utf8.

For field-level details and examples, see Input and Access Types.

Access Types

Access types store a reference to external content. The content is not embedded — it must be resolvable at the destination.

TypeDescription
OCIImage/v1References an OCI artifact by image reference. Short form: OCIImage. Legacy aliases: ociArtifact, ociRegistry, ociImage.
localBlob/v1References content stored alongside the component descriptor. Short form: localBlob.
OCIImageLayer/v1References a single blob in an OCI repository by digest. Short form: OCIImageLayer. Legacy alias: ociBlob.
Helm/v1References a Helm chart in a Helm repository or OCI registry. Short form: Helm. Legacy alias: helm.
File/v1alpha1References a file by URI (RFC 8089). Short form: File. Legacy alias: file. Alpha — schema may change.

For field-level details and examples, see Input and Access Types.

Artifact Types

The type field on resources and sources declares the logical meaning of the artifact.

TypeDescription
blobUntyped binary data (e.g. configuration files, scripts).
helmChartA Helm chart (e.g. stored as OCI artifact or chart archive).
ociImageAn OCI container image (e.g. application containers, sidecars).

Labels

Key-value metadata on components, resources, sources, references, or the provider.

labels:
- name: purpose
  value: production
  signing: true
FieldTypeRequiredDescription
namestringyesName of the label.
valueanyyesAny JSON-compatible YAML value.
versionstringnoVersion of the label. Pattern: ^v[0-9]+$.
signingbooleannoIndicates whether the label should be included in the signature.

See Component Descriptor — Labels for the full specification.

Schema Validation

Add the following comment as the first line of the constructor file to enable IDE validation and autocompletion:

# yaml-language-server: $schema=https://ocm.software/schemas/configuration-schema.yaml