Requires CUE v0.13.0 or later

This guide demonstrates how to use the cue mod mirror command to copy CUE modules between registries.

The cue mod mirror command is available in CUE v0.13.0 and later. It can be used to mirror modules between any pair of registries for which you have appropriate access permissions. The example shown here mirrors modules from the CUE Central Registry to a local, in-memory registry. The contents of this local registry are ephemeral: they disappear when it shuts down – so don’t use this registry to store your important modules!

1

Start the in-memory registry running in the background, listening on localhost port 55443:

TERMINAL
$ cue mod registry 127.0.0.1:55443

Every module mirrored to this ephemeral registry will disappear when you stop it.

2

Copy the k8s.io curated module from the Central Registry to the local registry:

TERMINAL
$ cue mod mirror --to 127.0.0.1:55443 github.com/cue-tmp/jsonschema-pub/exp3/k8s.io
mirroring github.com/cue-tmp/jsonschema-pub/exp3/k8s.io@v0.1.0

The cue mod mirror command copies each module from and to the appropriate registry for its module path – which is usually the Central Registry, but can be configured differently (see cue help registryconfig for more information). In this example we overrode the configured destination registry using the --to flag. The --from flag can also be used to override the configured source registry.

By default, cue mod mirror copies the latest version of each module specified, along with that version’s dependencies and all their transitive dependencies. This behaviour can be varied, as described by cue help mod mirror.