A composition is not one file. It is a directory of four kinds of document, each with its own
kind: and its own metadata.name, wired together by reference:
compositions/<name>/
├── composition.yaml # kind: Composition
├── schema.yaml # kind: ComponentSchema
├── jobs/<job>.yaml # kind: JobTemplate
├── profiles/<p>.yaml # kind: ExecutionProfile
└── README.md
The worked example below is compositions/turbo-package, the smallest composition in the catalog.
The entry point. It names the type, points at the schema, lists the job templates and execution profiles, and picks the defaults.
apiVersion: sourceplane.io/v1alpha1
kind: Composition
metadata:
name: turbo-package
spec:
type: turbo-package
description: Turborepo package verification jobs
schemaRef:
name: turbo-package-component
defaultJob: verify
defaultProfile: verify
jobs:
- name: verify
templateRef:
name: turbo-package-verify
profiles:
- name: quick-check
profileRef:
name: turbo-package-quick-check
- name: verify
profileRef:
name: turbo-package-verifymetadata.name and spec.type must both equal the directory name — scripts/verify.sh fails the
build otherwise.
Note the two namespaces. jobs[].name and profiles[].name are the short names a component uses
(profile: quick-check). templateRef.name and profileRef.name are the metadata.name of the
documents under jobs/ and profiles/, which are prefixed with the composition name to stay unique
across the catalog.
A ComponentSchema holding a JSON Schema (draft-07) for the component document. Constrain type
with a const so a mistyped component fails validation, and set
parameters.additionalProperties: false so unknown parameters are caught rather than silently
ignored.
apiVersion: sourceplane.io/v1alpha1
kind: ComponentSchema
metadata:
name: turbo-package-component
spec:
type: turbo-package
schema:
$schema: http://json-schema.org/draft-07/schema#
title: Turbo Package Component
type: object
required: [name, type, parameters]
properties:
name:
type: string
type:
type: string
const: turbo-package
parameters:
type: object
required: [nodeVersion, pnpmVersion]
properties:
nodeVersion: { type: string }
pnpmVersion: { type: string }
preBuildCommand: { type: string }
buildCommand: { type: string }
typecheckCommand: { type: string }
additionalProperties: false
additionalProperties: truemetadata.name here is what composition.yaml's schemaRef.name points at.
A JobTemplate declares the full set of capabilities the job can perform, then defines the
steps that implement them. Every step carries a capability tag. Steps either run a shell
command or use a GitHub Action with with: inputs, and component parameters are interpolated as
{{ .parameters.<name> }}.
apiVersion: sourceplane.io/v1alpha1
kind: JobTemplate
metadata:
name: turbo-package-verify
spec:
description: Install the workspace and validate a shared package
runsOn: ubuntu-22.04
timeout: 25m
retries: 0
labels:
scope: verify
capabilities:
- turbo-package.setup-node
- turbo-package.setup-pnpm
- turbo-package.install
- turbo-package.pre-build
- turbo-package.verify-structure
- turbo-package.build
- turbo-package.typecheck
steps:
- id: setup-pnpm
name: setup-pnpm
capability: turbo-package.setup-pnpm
use: pnpm/action-setup@v4
with:
version: "{{.parameters.pnpmVersion}}"
# ... install, pre-build, verify-structure ...
- id: build-package
name: build-package
capability: turbo-package.build
run: "{{if .buildCommand}}{{.parameters.buildCommand}}{{else}}pnpm exec turbo run build --filter=./{{end}}"
onFailure: stopConventions worth keeping:
- Namespace capabilities as
<composition>.<verb>so they stay unique across the catalog. - One capability per step, and keep steps atomic — a capability that bundles "build and deploy" cannot be split across profiles later.
- Set
onFailure: stopon steps that must not be skipped past. - Order matters: steps run in file order, and profiles filter that order rather than reordering it.
An ExecutionProfile selects which capabilities of which job actually run. This is how one job
template serves several lanes.
apiVersion: sourceplane.io/v1alpha1
kind: ExecutionProfile
metadata:
name: turbo-package-quick-check
spec:
description: Quick check with setup and structure verification only
jobs:
verify:
includeCapabilities:
- turbo-package.setup-node
- turbo-package.setup-pnpm
- turbo-package.install
- turbo-package.verify-structureThe key under jobs: is the short job name from composition.yaml (verify), not the template
name. The sibling turbo-package-verify profile includes the same list plus pre-build, build,
and typecheck — that difference is the entire distinction between the two lanes.
Profiles may also carry policies. compositions/cloudflare-pages/profiles/cloudflare-pages-deploy.yaml
sets requireApproval: true and requireCleanGitTree: true; publish-stack's release profile
sets requireCleanGitTree: true. Attach those to the mutating profiles, not the verification ones.
Consumers bind a profile per environment, which is why the same composition can be non-mutating on a pull request and mutating on production:
spec:
type: cloudflare-pages
subscribe:
environments:
- name: staging
profile: verify
- name: production
profile: deployIf a component names no profile, spec.defaultProfile from composition.yaml applies.
- Create
compositions/<name>/and write the four documents above. Keepmetadata.nameandspec.typeincomposition.yamlequal to the directory name. - Give the composition at least one non-mutating profile and, if it mutates anything, one mutating profile guarded by policies.
- Add a realistic fixture under
compositions/<name>/tests/smoke/component.yaml, preferably excerpted or adapted from a consumer-style repo. - Write
compositions/<name>/README.mddocumenting the parameters and the profiles. - Run
./scripts/verify.sh.
- Prefer atomic compositions over variant explosions; prefer a new profile over a new composition when the only difference is which steps run.
- Keep capabilities fine-grained enough that a future profile can pick a subset of them.
- Keep fixtures close enough to real repositories that they can guide consumers and feed CI.
- Keep the OCI consumption story pinned to released versions, not floating refs.