From 0850e0bf085fcdf02b1d77f4daefa26e8f0a18f1 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Dec 2024 10:15:01 +0100 Subject: [PATCH] docs: advertise --oci-username-variable and --oci-password-variable (#48189) --- lib/spack/docs/binary_caches.rst | 13 +++++++++---- lib/spack/docs/containers.rst | 6 ++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/spack/docs/binary_caches.rst b/lib/spack/docs/binary_caches.rst index 6d98bc8186f..b7eaeb13ec9 100644 --- a/lib/spack/docs/binary_caches.rst +++ b/lib/spack/docs/binary_caches.rst @@ -265,25 +265,30 @@ infrastructure, or to cache Spack built binaries in Github Actions and GitLab CI. To get started, configure an OCI mirror using ``oci://`` as the scheme, -and optionally specify a username and password (or personal access token): +and optionally specify variables that hold the username and password (or +personal access token) for the registry: .. code-block:: console - $ spack mirror add --oci-username username --oci-password password my_registry oci://example.com/my_image + $ spack mirror add --oci-username-variable REGISTRY_USER \ + --oci-password-variable REGISTRY_TOKEN \ + my_registry oci://example.com/my_image Spack follows the naming conventions of Docker, with Dockerhub as the default registry. To use Dockerhub, you can omit the registry domain: .. code-block:: console - $ spack mirror add --oci-username username --oci-password password my_registry oci://username/my_image + $ spack mirror add ... my_registry oci://username/my_image From here, you can use the mirror as any other build cache: .. code-block:: console + $ export REGISTRY_USER=... + $ export REGISTRY_TOKEN=... $ spack buildcache push my_registry # push to the registry - $ spack install # install from the registry + $ spack install # or install from the registry A unique feature of buildcaches on top of OCI registries is that it's incredibly easy to generate get a runnable container image with the binaries installed. This diff --git a/lib/spack/docs/containers.rst b/lib/spack/docs/containers.rst index 38a38475490..19254f74489 100644 --- a/lib/spack/docs/containers.rst +++ b/lib/spack/docs/containers.rst @@ -38,9 +38,11 @@ just have to configure and OCI registry and run ``spack buildcache push``. spack -e . install # Configure the registry - spack -e . mirror add --oci-username ... --oci-password ... container-registry oci://example.com/name/image + spack -e . mirror add --oci-username-variable REGISTRY_USER \ + --oci-password-variable REGISTRY_TOKEN \ + container-registry oci://example.com/name/image - # Push the image + # Push the image (do set REGISTRY_USER and REGISTRY_TOKEN) spack -e . buildcache push --update-index --base-image ubuntu:22.04 --tag my_env container-registry The resulting container image can then be run as follows: