1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
# Publish a version for a simple CUE module via "cue mod publish"
# to an off-the-shelf OCI registry which requires authentication.
# Then fetch that module as a dependency via cmd/cue.
gcloud-auth-docker # sets: MODULE, CUE_REGISTRY, CUE_REGISTRY_HOST, CLOUDSDK_CONFIG
env DOCKER_CONFIG=$WORK/docker-config
env-fill docker-config/config.json
env VERSION=v0.0.1
env MODVER=${MODULE}@v0
cd publish
exec cue mod init --source self ${MODVER}
exec cue mod publish ${VERSION}
cd ../depend
env-fill out_foo.cue
exec cue mod init --source self depend.localhost
exec cue mod tidy
exec cue export
cmp stdout export.golden
-- docker-config/config.json --
{"credHelpers": {"${CUE_REGISTRY_HOST}": "gcloud"}}
-- publish/foo.cue --
package publish
foo: "foo value"
-- depend/out_foo.cue --
package depend
import mt "${MODVER}:publish"
out: mt.foo
-- depend/export.golden --
{
"out": "foo value"
}
|