ocm transfer component-version
ocm transfer component-version
Transfer a component version between OCM repositories
Synopsis
Transfer a single component version from a source repository to a target repository using an internally generated transformation graph.
OCI, CTF, and Helm repositories are supported as transfer sources. OCI and CTF repositories are supported as transfer targets, while Helm repositories are not supported.
By default, only the component version itself is transferred. Use –copy-resources to also copy (and, when needed, transform) the resources it references. –upload-as controls whether those resources land as OCI artifacts or as local blobs in the target. –recursive walks the component’s references and transfers them too.
Driving defaults from the OCM configuration: A transfer.config.ocm.software/v1alpha1 entry inside the central OCM configuration (passed via –config) sets defaults for –recursive, –copy-resources, and –upload-as. Explicit command-line flags always override the values from the configuration.
Two-step workflow (generate, review, replay): –dry-run builds and validates the graph without executing it, and with -o yaml|json prints the resulting TransformationGraphDefinition. –transfer-spec then replays a saved definition from a file (or stdin with “-”): 1. Generate the spec: transfer cv –dry-run -o yaml –copy-resources -r {reference} {target} > spec.yaml 2. Review/edit spec.yaml, then execute: transfer cv –transfer-spec spec.yaml All graph-shaping flags (–recursive, –copy-resources, –upload-as) and any transfer configuration entry are baked into the spec during step 1 and are therefore ignored in step 2 - the spec is the full graph definition. Only –dry-run and –output remain meaningful when replaying a spec.
How the graph is built: Internally the command assembles a TransformationGraphDefinition from these node types, selected based on the source/target references: 1. CTFGetComponentVersion -> OCIGetComponentVersion 2. CTFAddComponentVersion -> OCIAddComponentVersion 3. GetOCIArtifact -> OCIAddLocalResource / AddOCIArtifact 4. GetHelmChart -> ConvertHelmToOCI -> OCIAddLocalResource / AddOCIArtifact
ocm transfer component-version {reference} {target} [flags]Examples
# Transfer a component version from a CTF archive to an OCI registry
transfer component-version ctf::./my-archive//ocm.software/mycomponent:1.0.0 ghcr.io/my-org/ocm
# Transfer from one OCI registry to another
transfer component-version ghcr.io/source-org/ocm//ocm.software/mycomponent:1.0.0 ghcr.io/target-org/ocm
# Transfer from one OCI to another using localBlobs
transfer component-version ghcr.io/source-org/ocm//ocm.software/mycomponent:1.0.0 ghcr.io/target-org/ocm --copy-resources --upload-as localBlob
# Transfer from one OCI to another using OCI artifacts (default)
transfer component-version ghcr.io/source-org/ocm//ocm.software/mycomponent:1.0.0 ghcr.io/target-org/ocm --copy-resources --upload-as ociArtifact
# Transfer a component version containing Helm charts (access-type: helm/v1) as an OCI artifact
transfer component-version ghcr.io/source-org/ocm//ocm.software/mycomponent:1.0.0 ghcr.io/target-org/ocm --copy-resources --upload-as ociArtifact
# Transfer including all resources (e.g. OCI artifacts)
transfer component-version ctf::./my-archive//ocm.software/mycomponent:1.0.0 ghcr.io/my-org/ocm --copy-resources
# Recursively transfer a component version and all its references
transfer component-version ghcr.io/source-org/ocm//ocm.software/mycomponent:1.0.0 ghcr.io/target-org/ocm -r --copy-resources
# Drive defaults from the OCM configuration. With --config ./ocmconfig.yaml containing:
# type: generic.config.ocm.software/v1
# configurations:
# - type: transfer.config.ocm.software/v1alpha1
# recursive: -1
# copyMode: allResources
# uploadType: ociArtifact
# the following invocation transfers recursively with all resources copied as OCI artifacts.
# Any explicit flag still overrides the corresponding configuration value.
transfer component-version --config ./ocmconfig.yaml ghcr.io/source-org/ocm//ocm.software/mycomponent:1.0.0 ghcr.io/target-org/ocm
# Two-step transfer: generate a spec with all desired flags, then review and execute
transfer component-version --dry-run -o yaml --copy-resources -r ghcr.io/source-org/ocm//ocm.software/mycomponent:1.0.0 ghcr.io/target-org/ocm > spec.yaml
# (review/edit spec.yaml as needed, e.g. change the target registry)
transfer component-version --transfer-spec spec.yamlOptions
--copy-resources copy all resources in the component version
--dry-run build and validate the graph but do not execute
-h, --help help for component-version
-o, --output enum output format of the component descriptors
(must be one of [json ndjson yaml]) (default yaml)
-r, --recursive recursively discover and transfer component versions
--transfer-spec string path to a transfer specification file (use "-" for stdin)
-u, --upload-as enum Define whether copied resources should be uploaded as OCI artifacts (instead of local blob resources). This option is only relevant if --copy-resources is set.
(must be one of [default localBlob ociArtifact]) (default default)Options inherited from parent commands
--config stringArray supply configuration by a given configuration file.
By default (without specifying custom locations with this flag), the file will be read from one of the well known locations:
1. The path specified in the OCM_CONFIG environment variable
2. The XDG_CONFIG_HOME directory (if set), or the default XDG home ($HOME/.config), or the user's home directory
- $XDG_CONFIG_HOME/ocm/config
- $XDG_CONFIG_HOME/.ocmconfig
- $HOME/.config/ocm/config
- $HOME/.config/.ocmconfig
- $HOME/.ocm/config
- $HOME/.ocmconfig
3. The current working directory:
- $PWD/ocm/config
- $PWD/.ocmconfig
4. The directory of the current executable:
- $EXE_DIR/ocm/config
- $EXE_DIR/.ocmconfig
If multiple configuration files are found, they will be merged in the order they are discovered.
Using the option, the specified configuration file(s) will be used instead of the lookup above.
--logformat enum set the log output format that is used to print individual logs
json: Output logs in JSON format, suitable for machine processing
text: Output logs in human-readable text format, suitable for console output
(must be one of [json text]) (default text)
--loglevel enum sets the logging level
debug: Show all logs including detailed debugging information
info: Show informational messages and above
warn: Show warnings and errors only (default)
error: Show errors only
(must be one of [debug error info warn]) (default info)
--logoutput enum set the log output destination
stdout: Write logs to standard output
stderr: Write logs to standard error, useful for separating logs from normal output
(must be one of [stderr stdout]) (default stderr)
--plugin-directory string default directory path for ocm plugins. (default "$HOME/.config/ocm/plugins")
--plugin-shutdown-timeout duration Timeout for plugin shutdown. If a plugin does not shut down within this time, it is forcefully killed (default 10s)
--temp-folder string Specify a custom temporary folder path for filesystem operations.
--working-directory string Specify a custom working directory path to load resources from.SEE ALSO
- ocm transfer - Transfer anything in OCM