Key Differences Between OCM v1 and v2

OCM v2 is a rebuild of the OCM CLI, the Kubernetes controllers and the Go library. Both versions build on the OCM specification, and OCM v2 reads most component versions that OCM v1 created. Commands, flags, configuration, plugins and the library API changed, and some behavior changed without an error message. This page gives you a migration order, shows how your daily OCM v1 tasks look in OCM v2, and lists every difference with the guide that covers it.

This page compares the OCM v1 CLI 0.55 with the current OCM v2 release. The legacy documentation still describes OCM v1. If you are new to OCM v2, start with Getting Started and How OCM Works.

Migrate Step by Step

Component versions that OCM v1 published keep working. You do not have to rebuild or re-sign them before you switch, except for the cases listed under Data Compatibility. Move in this order:

  1. Install OCM v2 next to OCM v1. Both binaries are called ocm, and the Homebrew formula still installs OCM v1, so keep one of them under another name while you migrate. See Install the OCM CLI.
  2. Give OCM v2 its own configuration file. OCM v1 rejects most v2 configuration types, and OCM v2 fails on some v1 entries. Pass the v2 file with --config, which replaces the default search. See Configuration.
  3. Check your existing component versions with OCM v2. Run ocm get cv and ocm verify cv against the repositories you publish to. These commands only read. Compare the results with Data Compatibility.
  4. Move credentials and resolvers. See Migrate Legacy Credentials and Migrate Legacy Resolvers.
  5. Move verification before signing. OCM v1 cannot verify signatures that OCM v2 creates. Switch every verifier to OCM v2 first, then the signers. See Migrate Signing Setup.
  6. Move your builds. Convert component constructors and transfer settings. See Migrate Component Constructors, Migrate –upload-as Flags and Migrate from Sources to Resources.
  7. Update scripts and pipelines. Check output formats and exit codes, see Scripts and CI pipelines. In GitHub Actions, use open-component-model/ocm-setup-action@v2.

Your OCM v1 Tasks in OCM v2

TaskOCM v1OCM v2Guide
Build a component versionocm add componentversions --create --file ./ctf component-constructor.yamlocm add cv --repository ./ctf --constructor component-constructor.yamlCreate Component Versions
Inspect a component versionocm get cv ./ctf//acme.org/app:1.0.0 -o yamlocm get cv ./ctf//acme.org/app:1.0.0 -o yamlReference: ocm get cv
Configure registry credentialsConsumers in ~/.ocmconfigConsumers in the configuration file, mostly unchangedConfigure Registry Credentials
Signocm sign cv --signature acme --private-key rsa.priv <ref>ocm sign cv --signature acme <ref>, with the key in the configurationSign with Plain RSA
Verifyocm verify cv --signature acme --public-key rsa.pub <ref>ocm verify cv --signature acme <ref>, with the key in the configurationVerify Plain RSA
Transfer to a registryocm transfer cv --copy-resources <ref> ghcr.io/acme/targetocm transfer cv <ref> ghcr.io/acme/target, with an uploader configuration to copy resourcesTransfer Component Versions
Transfer across an air gapocm transfer cv --copy-resources <ref> ./ctfocm transfer cv <ref> ./ctf, with an uploader configurationTransfer Components across an Air Gap
Download a resourceocm download resources <ref> my-resource -O outocm download resource <ref> --identity name=my-resource --output outDownload Resources
Reference other componentsReferences plus fallback resolversReferences plus glob resolversAdd Component References
Deploy to Kubernetesocm-controller with FluxOCM controllersDeploy Helm Charts
Look up types and fieldsHelp topics such as ocm ocm-accessmethodsocm describe typesInput and Access Types

Breaking Changes

These changes can break a pipeline or change data without an error. Check them first.

ChangeImpactWhat to do
ocm transfer cv replaces a component version that already exists in the target, and drops the signatures stored thereOCM v1 skipped an identical version and refused a changed one without --overwrite. OCM v2 exits 0.Sign after the transfer, or protect published versions with immutable tags in the registry. See Transfer Component Versions.
Running ocm add cv again replaces the component version and drops its signaturesA constructor that lacks a resource or reference removes it from the versionBuild a new version instead of rebuilding a published one. See Migrate Component Constructors.
Copying Helm resources by value rewrites their digestAfter --copy-resources or a local blob uploader, OCM v1 signatures fail in OCM v1 and OCM v2 (ocm-project#1368)Transfer Helm resources by reference, or sign again after the transfer
Some OCM v1 signatures do not verifySee Data CompatibilityRe-sign with OCM v2. See Migrate Signing Setup.
OCM v1 cannot verify signatures that OCM v2 createsOCM v2 signs with jsonNormalisation/v4alpha3, which OCM v1 does not knowMove all verifiers to OCM v2 before you sign with it
Some OCM v1 configuration entries make commands failHashiCorpVault, GardenerConfig and NPMConfig credential repositories and an inline dockerConfig object. Resolvers with the repository type OCIRegistry fail every command that reads a component version.Remove or convert them, see Configuration
Most other OCM v1 configuration types are ignored without a messageFor example transport with recursive: true: ocm transfer cv is then no longer recursivePass --recursive or use the v2 transfer configuration, see Configuration
Credential matching is stricterA consumer without port no longer matches a request with a port, and one without hostname matches nothingSee Credentials
Script-facing output changedget cv output formats, sort order and exit codes differSee Scripts and CI pipelines

Specification Support

TopicOCM v1OCM v2
Component descriptor schemav2 and ocm.software/v3alpha1v2 only
RepositoriesOCI registries, CTF (directory, tar, tgz), component archivesOCI registries and CTF. Writes directory CTFs only, reads tar and tgz. No component archives.
Normalisation algorithmsjsonNormalisation/v1, v2, v3 (default)Signs with jsonNormalisation/v4alpha3 (default, recommended), v4alpha2 or v4alpha1. Verifies v3 and v1, see Data Compatibility.
SigningRSA (RSASSA-PKCS1-V1_5 default, RSASSA-PSS), certificate chains, SigstoreRSA (RSASSA-PSS default), certificate chains, GPG, Sigstore keyless. PSS, GPG and Sigstore are not defined in the specification.
SourcesSupportedDeprecated in OCM v2, replaced by resources. The specification does not deprecate them.
Label mergeSupportedDropped on read and transfer. Deprecated in the specification (ocm-spec#155).

How OCM v2 stores component versions in OCI registries is described in Component Version Storage, the descriptor format in Component Descriptor.

CLI

The v2 CLI is built around the component version and has far fewer commands. Commands that edited or inspected one part of a component version are gone. For all commands and flags, see the CLI reference.

OCM v1OCM v2
ocm add componentversionsocm add component-version, see Migrate Component Constructors
ocm add resources, add sources, add references, create componentarchive, create transportarchiveNo command. Describe the whole component version in one constructor and run ocm add cv, which creates a missing CTF directory.
ocm get componentversionsocm get component-version
ocm get resources, get sources, get referencesocm get cv -o yaml, or -o widetree for resources
ocm list componentversions, show versionsocm get cv <component> with --constraint or --latest. Versions are listed newest first.
ocm sign componentversions, verify componentversionsocm sign component-version, ocm verify component-version, see Migrate Signing Setup
ocm transfer componentversions, transfer commontransportarchiveocm transfer component-version. A repository as source transfers all its component versions. See Transfer Component Versions.
ocm download resourcesocm download resource, see Download Resources
ocm download componentversionsocm transfer cv <reference> <directory> writes a CTF
ocm install pluginsocm download plugin and ocm plugin registry, see Plugins
ocm create rsakeypairopenssl, see Generate Signing Keys
ocm controller installHelm, see Set up Controller Environments
ocm check componentversionsocm get cv <reference> --recursive fails when a referenced component version is missing
ocm hash componentversions, sign hashNo command yet (open-component-model#1227)
ocm cache, clean cacheNo command. OCM v2 caches OCI metadata for 10 minutes in its temporary folder, see Caching.
ocm bootstrap, TOI packagesNo command (ocm-project#839). Deploy with the OCM controllers.
ocm download cliNo command. See Install the OCM CLI.
ocm get artifacts, transfer artifacts, show tags, oci ...No command. ocm transfer cv copies component versions only. Use an OCI tool such as oras for plain OCI artifacts.
ocm add routingslips, get routingslips, execute action, get pubsub, set pubsub, get credentials, get verifiedNo command

ocm describe types and ocm get types are new. They list the access, input, repository, credential and signing types and their fields. Configuration types are not listed; see Configuration.

Scripts and CI pipelines

  • Command names. componentversions, componentversion and cv still work. component, comp and c work for get, sign, verify and transfer, but not for add. The resource aliases res and r are gone.

  • Short flags changed meaning. In ocm add cv, -c is --constructor (v1: --create) and -r is --repository. In ocm get cv, -r is gone and --recursive takes a depth. -c/--constraints is now --constraint. In sign and verify, -s is gone and --signature takes one name. In transfer, -V (--copy-resources) and -f (--overwrite) are gone. The global -l (--loglevel) and -v (--verbose) are gone as well.

  • One reference per call. get, sign and verify take one reference, and sign and verify need a version. --repo is gone: always pass the full reference, such as ghcr.io/acme//acme.org/app:1.0.0 or ctf::./archive//acme.org/app:1.0.0. A reference can pin a digest, such as ...:1.0.0@sha256:<digest>.

  • Rejected reference forms. The + prefix that created a repository, directory::, tgz::, ctf+tgz::, JSON repository specifications and the type name OCIRegistry:: fail. Use ctf::, oci:: or OCIRepository::. http:// needs plainHTTP, see Migrate from http:// Prefixes.

  • Archives. OCM v2 writes CTF directories only. To ship a tgz, pack the directory with tar.

  • Output. ocm get cv prints a tree by default, newest version first. A script that takes the last line of the v1 table now gets the oldest version. -o json prints a list instead of {"items": [...]}, and -o yaml prints one YAML list instead of one document per component version. -o wide is gone.

  • Exit codes. ocm get cv with a --constraint that matches no version, and ocm verify cv on a component version without signatures, exit 1. OCM v1 exited 0.

  • Logging. INFO messages go to stderr by default. Use --loglevel warn to quiet them. --logfile, --logconfig and --logkeys are gone.

  • Transfer. --overwrite, --enforce, --script, --uploader, --copy-local-resources and --omit-access-types are gone. Local blobs are copied by default, and uploader configurations decide what else is copied. --copy-resources still works but is deprecated in favor of uploader configurations, see Migrate –upload-as Flags. To review a transfer before it runs, write the plan to a file and replay it:

    ocm transfer cv --dry-run -o yaml ghcr.io/acme//acme.org/app:1.0.0 ctf::./archive > spec.yaml
    ocm transfer cv --transfer-spec spec.yaml
  • Download. -O is --output, and the resource identity moves to --identity. Archives are extracted by default; --extraction-policy disable keeps them as they are. The executable bit is not set. Download handlers are replaced by --transformer, which supports helm.

  • Mixed pipelines. OCM v2 writes CTF files read-only, so OCM v1 cannot write to a CTF that OCM v2 has written. Run all steps that write a CTF with the same version.

Component Constructor

The constructor still describes one component or a components: list. The changes, with the steps to migrate, are in Migrate Component Constructors:

  • No templating: OCM v2 expands environment variables ($NAME and ${NAME}) and nothing else. Every $ counts.
  • The file is validated before the build. references: must be componentReferences:, and meta and repositoryContexts are rejected. Only the first YAML document is read.
  • Component references must resolve while the version is built.
  • Input types keep their v1 names as deprecated aliases. ociImage, docker, binary, spiff, maven, npm and ocm inputs are gone. For images, see Add OCI Artifacts. For component versions, use component references.

For all types and fields, see Component Constructor and Input and Access Types.

Configuration

The file format is the same: a generic.config.ocm.software/v1 document with a configurations: list.

Discovery. OCM v1 read the first of ~/.ocmconfig, ~/.ocm/ocmconfig and ~/.ocm/config. OCM v2 merges every file it finds: $OCM_CONFIG, ocm/config and .ocmconfig under $XDG_CONFIG_HOME or ~/.config, ~/.ocm/config, ~/.ocmconfig, then .ocm/config and .ocmconfig in the working directory and next to the binary. Later files take priority. Running ocm inside a checkout therefore picks up the checkout’s .ocmconfig. --config replaces the search. On first start, OCM v2 writes ~/.ocm/config with your Docker credentials if you have none (turn off with OCM_DISABLE_AUTO_CONFIG), and it checks for new releases after each command (OCM_DISABLE_VERSION_CHECK).

Configuration types:

OCM v1 typeOCM v2
credentials.config.ocm.softwareWorks, with changes, see Credentials
ocm.config.ocm.software resolversDeprecated, still read. Use resolvers.config.ocm.software/v1alpha1, see Migrate Legacy Resolvers. A resolver with type: OCIRegistry makes every command fail that reads a component version, such as get, verify and transfer; use OCIRepository.
http.config.ocm.softwareWorks. The v2 type adds retries, TLS roots and per-host plainHTTP, see HTTP Client.
transport.ocm.config.ocm.software, uploader.ocm.config.ocm.software, scripts.ocm.config.ocm.software, oci.uploader.config.ocm.softwareIgnored. Use transfer.config.ocm.software/v1alpha1 and the uploader configurations, see Transfer Configuration.
keys.config.ocm.softwareIgnored. Keys are credentials, see Configure Signing Credentials.
rootcerts.config.ocm.softwareIgnored. Use rootCAsPEM or rootCAsPEMFile in the HTTP client configuration.
downloader.ocm.config.ocm.softwareIgnored. Use ocm download resource --transformer.
logging.config.ocm.softwareIgnored. Use --loglevel, --logformat and --logoutput.
plugin.config.ocm.softwareThe type name now configures the v2 plugin manager. v1 settings are dropped.
attributes, memory.credentials, oci, cli.ocm, ocm.cmd, hasher, blobLimits.ocireg.ocm, merge (all .config.ocm.software), config setsIgnored

Ignored types produce no message, even with --loglevel debug. Spiff expressions in the configuration file are not evaluated, and the --cred, -X and --config-set flags are gone. New types configure signing, transfer, uploaders, caching, versioning and the file system; see Configuration.

OCM v1 rejects most v2 configuration types, so one file cannot serve both CLIs unless it uses only credentials and http.config.ocm.software.

Credentials

The credential configuration keeps its format. The details are in Migrate Legacy Credentials:

  • pathprefix is converted to path, which is a glob: * matches one path segment and ** any depth.
  • A consumer without port no longer matches a request that has a port, such as localhost:5000. A consumer without hostname matches nothing.
  • When several consumers match a request, OCM v2 does not prefer the most specific one, and the one it uses can change between runs. Do not configure overlapping consumers for the same host and path.
  • Only DockerConfig/v1 is built in as a credential repository. HashiCorpVault, GardenerConfig and NPMConfig make every command fail (ocm-project#838 tracks Vault). An inline dockerConfig must be a JSON string. aliases and memory credentials are dropped.
  • Typed credentials such as OCICredentials/v1 are new and optional. Credentials/v1 keeps working.

For the model behind it, see Credential System, Credential Consumer Identities and Credential Types.

Transfer and Download

  • Existing versions. ocm transfer cv replaces a component version that the target already has, without a warning, and drops the signatures stored in the target. This is intended: protect published versions with immutable tags in the registry.
  • What is copied. Local blobs are copied, everything else stays by reference unless an uploader configuration selects it. Uploaders exist for OCI registries, local blobs, HTTP, Git, JFrog Artifactory and Sonatype Nexus. See Transfer and Transport, Transfer Configuration and Vendor Repository Uploaders.
  • Resources that are not copied. npm, maven, ocm, none and s3/v1 resources stay by reference, with a warning when you pass --copy-resources. s3/v1 resources can be downloaded, the others cannot. Support for npm (ocm-project#835) and Maven (ocm-project#836) is planned. To publish Maven and npm packages during a transfer, see Upload to JFrog Artifactory and Upload to Sonatype Nexus.
  • Sources. External sources stay by reference. A component version with a source stored as a local blob cannot be transferred. See Migrate from Sources to Resources.
  • Air gaps work as before with CTF directories, see Transfer Components across an Air Gap.

Signing and Verification

  • Keys come from the configuration. The v1 flags --private-key, --public-key, --issuer, --ca-cert, --keyless and --algorithm are gone, and keys.config.ocm.software is ignored. See Migrate Signing Setup and Configure Signing Credentials.
  • New defaults. New signatures use RSASSA-PSS and jsonNormalisation/v4alpha3. OCM v1 used RSASSA-PKCS1-V1_5 and jsonNormalisation/v3. Keep the default jsonNormalisation/v4alpha3, see Migrate Normalisation Algorithms.
  • What ocm verify cv checks. It verifies each signature against the descriptor digest. It does not download resources or referenced component versions to recompute their digests, as ocm verify -V did in OCM v1 (#1437). Resource digests are checked on download and when a transfer copies the resource. A component version without signatures fails.
  • Signers. RSA with plain keys or PEM certificate chains, GPG, and Sigstore keyless. See the guides under Sign.
  • Timestamps. RFC 3161 timestamps from OCM v1 are checked without extra flags. Without TSA root certificates (TSA/v1alpha1 credentials) only their structure is checked, see Verifying signatures with an RFC 3161 timestamp. Their time cannot prove when the signature was made, because OCM v1 timestamps the descriptor digest. With TSA roots configured, ocm verify cv --insecure-trust-legacy-timestamps lets that time validate an expired signing certificate, so a signature created after the certificate expired can pass. Use the flag only for component versions you know OCM v1 signed in time.

Data Compatibility

OCM v2 reads component versions that OCM v1 created in OCI registries and CTF archives. A plain ocm transfer cv keeps their descriptors and signatures intact, and OCM v1 signatures still verify in OCM v1 and OCM v2 afterwards. OCM v2 stores embedded OCI artifacts differently, see OCM v1 and OCM v2 storage.

This v1 data works in OCM v2 for get, verify, download and transfer:

  • CTF directories and CTF tar and tgz archives, including transfer of a whole archive
  • RSA signatures with jsonNormalisation/v3, the v1 default, with RSASSA-PKCS1-V1_5 or RSASSA-PSS and SHA-256 or SHA-512, apart from the exceptions below
  • Certificate chain signatures without the root certificate, and RFC 3161 timestamps
  • Resources with the access types ociArtifact, localBlob, localOciBlob, helm, github, wget and Git/v1, under their v1 names. s3 resources are read and transferred by reference. For the field changes of Git and S3, see Input and Access Types.
  • Component references with digests, extraIdentity, versions with + build metadata, and external sources

The following v1 data does not work in OCM v2:

v1 dataBehavior in OCM v2Tracking
Component archives (ocm create componentarchive)Rejected with component archive ... is not supported. Transfer them into a CTF with the v1 CLI first.#1406
Descriptors in the ocm.software/v3alpha1 schemaCannot be read. The error does not name the schema yet, for example parsing identity "name=,version=".#1407
OCI repositories with componentNameMapping: sha256-digestComponents are not found#1405
Signatures with jsonNormalisation/v2Cannot be verified#1403
Signatures with jsonNormalisation/v3 over reference labels with mergeDigest mismatch. The specification excludes this case.ocm-spec
Signatures with jsonNormalisation/v1OCM v2 computes this algorithm as cc-utils did. Signatures from the OCM v1 CLI fail with a digest mismatch, for example for resource types blob, helmChart, filesystem and ociArtifact, or with provider labels. See Migrate Signing Setup.#1434
Several v1 signatures with different hash or normalisation algorithms on a component version with referencesOnly the signature created last verifies#1436
Certificate chains with an embedded self-signed root (v1 create rsakeypair --ca-cert)Rejected#1376
Certificate chain signatures whose issuer names only part of the certificate subjectRejected with issuer mismatch. Signatures written by the v1 CLI record the full subject and are not affected.#1418
Sigstore signatures from the v1 CLICannot be verified. ocm verify cv without --signature fails as well. Re-sign with the v2 Sigstore signer.#1376
Private keys encrypted with v1 create rsakeypair --encryptCannot be read
Helm resources copied with --copy-resources or a local blob uploaderDigest is rewritten and v1 signatures fail. The new digest changes with every transfer.#1368, #1435
Resources with the access type git or git/v1alpha1Download and copy fail with a digest mismatch. Verify and transfer by reference work.#1433
Resources with the access types npm, maven, ocm or noneCannot be downloaded or copied#1376
Resources with the access type s3/v1--copy-resources keeps them by reference#1404 (closed, not planned)
Sources stored as local blobsThe component version cannot be transferredMigrate from Sources to Resources
Label merge specificationsDropped on read and transfer. Signatures over resource and component labels still verify. For reference labels, see the merge row above.#1371
Routing slipsKept as a label and transferred, but OCM v2 has no commands for them

All tracking issues are in open-component-model/ocm-project and collected in the OCM v1 to v2 compatibility epic.

Plugins

OCM v2 has a new plugin protocol, and v1 plugins do not run in it. v2 plugins add repository types, access and input types, credential repositories, signing handlers and blob transformers. Actions, value sets, label merge handlers and CLI commands have no plugin counterpart. The v1 JFrog plugin is replaced by the built-in Artifactory uploader. The ECR plugin has no counterpart. The plugin directory moved from ~/.ocm/plugins to ~/.config/ocm/plugins. See Plugin System.

Installation

Both CLIs are called ocm. The Homebrew formula open-component-model/tap/ocm still installs OCM v1. To install OCM v2, see Install the OCM CLI. In GitHub Actions, open-component-model/ocm-setup-action@v2 installs OCM v2. The v2 container image is ghcr.io/open-component-model/cli.

Go Library

The v2 library is a new API in the module ocm.software/open-component-model/bindings/go. Code written against ocm.software/ocm has to be rewritten. The library is still evolving and its API is not yet stable. Start with the package list in the bindings README.