Skip to content

Commit

Permalink
docs: document complex artifact transfer (#1113)
Browse files Browse the repository at this point in the history
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it

This documents a more complicated scenario for an artifact transfer that
might be useful if only a single OCI image needs to be copied to a
different repository or registry in OCI.

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
  • Loading branch information
jakobmoellerdev authored Nov 20, 2024
1 parent 57564b6 commit 1d117ff
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
20 changes: 16 additions & 4 deletions cmds/ocm/commands/ocicmds/artifacts/transfer/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,24 @@ Sources may be specified as
- dedicated artifacts with repository and version or tag
- repository (without version), which is resolved to all available tags
- registry, if the specified registry implementation supports a namespace/repository lister,
which is not the case for registries conforming to the OCI distribution specification.`,
which is not the case for registries conforming to the OCI distribution specification.
Note that there is an indirection of "ocm oci artifact" to "ocm transfer artifact" out of convenience.`,
Example: `
$ ocm oci artifact transfer ghcr.io/mandelsoft/kubelink:v1.0.0 gcr.io
$ ocm oci artifact transfer ghcr.io/mandelsoft/kubelink gcr.io
$ ocm oci artifact transfer ghcr.io/mandelsoft/kubelink gcr.io/my-project
# Simple:
$ ocm oci artifact transfer ghcr.io/open-component-model/kubelink:v1.0.0 gcr.io
$ ocm oci artifact transfer ghcr.io/open-component-model/kubelink gcr.io
$ ocm oci artifact transfer ghcr.io/open-component-model/kubelink gcr.io/my-project
$ ocm oci artifact transfer /tmp/ctf gcr.io/my-project
# Complex:
# Transfer an artifact from a CTF into an OCI Repository:
# 1. Get the link to all artifacts in the CTF with "ocm get artifact $PATH_TO_CTF",
$ ocm get artifact $PATH_TO_CTF
REGISTRY REPOSITORY
CommonTransportFormat::$PATH_TO_CTF/ component-descriptors/ocm.software/ocmcli
# 2. Then use any combination to form an artifact reference:
$ ocm transfer artifact CommonTransportFormat::$PATH_TO_CTF//component-descriptors/ocm.software/ocmcli ghcr.io/open-component-model/ocm:latest
`,
Annotations: map[string]string{"ExampleCodeStyle": "bash"},
}
Expand Down
18 changes: 15 additions & 3 deletions docs/reference/ocm_transfer_artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Sources may be specified as
- registry, if the specified registry implementation supports a namespace/repository lister,
which is not the case for registries conforming to the OCI distribution specification.

Note that there is an indirection of "ocm oci artifact" to "ocm transfer artifact" out of convenience.

If the repository/registry option is specified, the given names are interpreted
relative to the specified registry using the syntax

Expand Down Expand Up @@ -76,10 +78,20 @@ linked library can be used:
### Examples

```bash
$ ocm oci artifact transfer ghcr.io/mandelsoft/kubelink:v1.0.0 gcr.io
$ ocm oci artifact transfer ghcr.io/mandelsoft/kubelink gcr.io
$ ocm oci artifact transfer ghcr.io/mandelsoft/kubelink gcr.io/my-project
# Simple:
$ ocm oci artifact transfer ghcr.io/open-component-model/kubelink:v1.0.0 gcr.io
$ ocm oci artifact transfer ghcr.io/open-component-model/kubelink gcr.io
$ ocm oci artifact transfer ghcr.io/open-component-model/kubelink gcr.io/my-project
$ ocm oci artifact transfer /tmp/ctf gcr.io/my-project

# Complex:
# Transfer an artifact from a CTF into an OCI Repository:
# 1. Get the link to all artifacts in the CTF with "ocm get artifact $PATH_TO_CTF",
$ ocm get artifact $PATH_TO_CTF
REGISTRY REPOSITORY
CommonTransportFormat::$PATH_TO_CTF/ component-descriptors/ocm.software/ocmcli
# 2. Then use any combination to form an artifact reference:
$ ocm transfer artifact CommonTransportFormat::$PATH_TO_CTF//component-descriptors/ocm.software/ocmcli ghcr.io/open-component-model/ocm:latest
```

### SEE ALSO
Expand Down

0 comments on commit 1d117ff

Please sign in to comment.