| title | description | icon | weight | toc |
|---|---|---|---|---|
Resolvers |
Learn how OCM resolvers map component name patterns to repositories for recursive resolution. |
π |
7 |
true |
In OCM, a component can reference other components. For example, an app component might reference a backend and
a frontend component. These referenced components don't have to live in the same repository as the app β and in
practice, they often don't. Teams publish components independently, to different registries or repository paths.
This creates a problem: when you ask the CLI to recursively resolve a component graph, it needs to know where to find each referenced component. The repository you pass on the command line only tells the CLI where to find the root component. For everything else, the CLI needs a mapping from component names to repositories.
That's what resolvers provide.
A resolver maps a component name pattern (glob) to an OCM repository. When the CLI encounters a component reference during recursive operations, it walks the list of configured resolvers, finds the first pattern that matches the referenced component name, and queries the associated repository.
flowchart TD
Start["CLI encounters a component reference"] --> Resolvers["Walk resolver list (in order)"]
Resolvers --> Match{"Component name matched the next resolver's pattern?"}
Match -- Yes --> Query["Query the resolver's configured repository"]
Match -- No --> More{"More resolvers in the list?"}
More -- Yes --> Resolvers
More -- No --> Fail["Resolution fails: no matching resolver"]
Query --> Found{"Component version found?"}
Found -- Yes --> Done["Use this component version"]
Found -- No --> Fail
Resolvers are configured in the OCM configuration file (by default $HOME/.ocmconfig). Each resolver entry maps a
component name pattern to a repository. Resolvers are evaluated in order β the first matching entry wins.
The repository field supports different repository types, including OCI registries and file-based CTF archives.
Component name patterns use common glob syntax (e.g., * for single-level, ** for multi-level matching).
{{}} For the full configuration schema, supported repository types, and pattern syntax details, see the [Resolver Configuration Reference]({{< relref "docs/reference/resolver-configuration.md" >}}). {{}}
When a component version has references to other component versions (via componentReferences), the CLI can follow
these references recursively using the --recursive flag. The CLI uses resolvers to locate each referenced component
in its respective repository β without them, recursive resolution across multiple repositories is not possible.
Resolvers play an important role in transferring component versions across registries. When transferring a component
graph with --recursive, the CLI uses resolvers to locate each referenced component so it can copy the entire graph
to the target repository. Combined with --copy-resources, this enables full transfers of component graphs β
including all referenced resources β across registry boundaries or even air-gapped environments.
For more information about OCM transfer, see the [Transfer and Transport]({{< relref "docs/concepts/transfer-concept.md" >}}) concept.
- [Resolver Configuration Reference]({{< relref "docs/reference/resolver-configuration.md" >}}) β Full schema, repository types, and pattern syntax
- [Components]({{< relref "components.md" >}}) β Core concepts behind component versions, identities, and references
- [Working with Resolvers Tutorial]({{< relref "docs/tutorials/configure-resolvers.md" >}}) β Hands-on walkthrough for setting up resolvers
- [How to Resolve Components Across Multiple Registries]({{< relref "docs/how-to/resolve-components-from-multiple-repositories.md" >}}) β Recipe for multi-registry resolution
- [Understand Credential Resolution]({{< relref "docs/tutorials/credential-resolution.md" >}}) β Configure credentials for OCI registries
- [How to Transfer Components Across an Air Gap]({{< relref "docs/how-to/air-gap-transfer.md" >}}) β Use OCM Transfer to move components between air-gapped environments
- [Migrate from Deprecated Resolvers]({{< relref "docs/how-to/migrate-from-deprecated-resolvers.md" >}}) β Replace deprecated fallback resolvers with glob-based resolvers