From 5792f7c7055c3707819380b5e3831d2be6e64b6c Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Dec 2024 22:27:18 +0100 Subject: [PATCH] update readme (#17) --- README.md | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 4b04a83..576d567 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,11 @@ spack: mirrors: local-buildcache: url: oci://ghcr.io//spack-buildcache + binary: true signed: false + access_pair: + id_variable: GITHUB_USER + secret_variable: GITHUB_TOKEN ``` Then configure an action like this: @@ -83,7 +87,7 @@ jobs: uses: spack/setup-spack@v2 - name: Install - run: spack -e . install --no-check-signature + run: spack -e . install - name: Run shell: spack-bash @@ -92,39 +96,39 @@ jobs: python3 -c 'print("hello world")' - name: Push packages and update index - run: | - spack -e . mirror set --push --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache - spack -e . buildcache push --base-image ubuntu:22.04 --update-index local-buildcache + env: + GITHUB_USER: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: spack -e . buildcache push --base-image ubuntu:22.04 --update-index local-buildcache if: ${{ !cancelled() }} ``` ## Example: caching your own binaries for private repositories -When your local build cache is stored in a private GitHub package, +When your local buildcache is stored in a private GitHub package, you need to specify the OCI credentials already *before* `spack concretize`. -This is because Spack needs to fetch the index of the build cache. Also, remember to -remove the `--push` flag from `spack mirror set`, since fetching needs -credentials too: +This is because Spack needs to fetch the buildcache index. ```yaml - steps: - - name: Login - run: spack -e . mirror set --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache +env: + GITHUB_USER: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +jobs: + example-private: + steps: - name: Concretize run: spack -e . concretize - name: Install - run: spack -e . install --no-check-signature + run: spack -e . install - name: Push packages and update index run: spack -e . buildcache push --base-image ubuntu:22.04 --update-index local-buildcache - if: ${{ !cancelled() }} ``` -From a security perspective, notice that the `GITHUB_TOKEN` is exposed to every -subsequent job step. (This is no different from `docker login`, which also likes -to store credentials in the home directory.) +From a security perspective, do note that the `GITHUB_TOKEN` is exposed to every +job step. ## License