From 6b23df6b547f28184450d04302e637487a4b7e20 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Wed, 9 Oct 2024 21:32:38 +0200 Subject: [PATCH] feat(workflows/eval): Try to build and upload in one fell swoop --- .forgejo/workflows/eval.yaml | 14 ++------------ scripts/cache-node.sh | 20 ++++++++++++++++++++ scripts/default.nix | 1 + 3 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 scripts/cache-node.sh diff --git a/.forgejo/workflows/eval.yaml b/.forgejo/workflows/eval.yaml index 0fb3231..0fe36fe 100644 --- a/.forgejo/workflows/eval.yaml +++ b/.forgejo/workflows/eval.yaml @@ -9,16 +9,6 @@ on: - main jobs: - build_krz01: - runs-on: nix - steps: - - uses: actions/checkout@v3 - - - name: Build krz01 - run: | - # Enter the shell - nix-shell --run 'colmena build --on krz01' - build_compute01: runs-on: nix steps: @@ -117,12 +107,12 @@ jobs: - uses: actions/checkout@v3 - name: Push to cache - run: nix-shell --run push-to-nix-cache + run: nix-shell --run cache-node env: STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/" STORE_USER: "admin" STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} - NODES: '[ "krz01" ]' + BUILD_NODE: "krz01" - uses: actions/upload-artifact@v3 if: always() diff --git a/scripts/cache-node.sh b/scripts/cache-node.sh new file mode 100644 index 0000000..38a2e6c --- /dev/null +++ b/scripts/cache-node.sh @@ -0,0 +1,20 @@ +set -eu -o pipefail + +cat <.netrc +default +login $STORE_USER +password $STORE_PASSWORD +EOF + +drv=$("@colmena@/bin/colmena" eval --instantiate -E "{ nodes, ... }: nodes.${BUILD_NODE}.config.system.build.toplevel") + +# Build the derivation and send it to the great beyond +nix-store --query --requisites --force-realise --include-outputs "$drv" | grep -v '.*\.drv' >paths.txt + +nix copy \ + --extra-experimental-features nix-command \ + --to "$STORE_ENDPOINT?compression=none" \ + --netrc-file .netrc \ + "$(nix-store --realise "$drv")" + +rm .netrc diff --git a/scripts/default.nix b/scripts/default.nix index 4846b8c..d5096fd 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -29,6 +29,7 @@ let )); scripts = [ + "cache-node" "check-deployment" "launch-vm" "list-nodes"