infrastructure/scripts/cache-node.sh
Tom Hubrecht aa3d83ca06
All checks were successful
Check meta / check_meta (push) Successful in 18s
Check meta / check_dns (push) Successful in 19s
build configuration / build_and_cache_storage01 (push) Successful in 1m14s
build configuration / build_and_cache_geo02 (push) Successful in 1m2s
build configuration / build_and_cache_rescue01 (push) Successful in 1m11s
build configuration / build_and_cache_geo01 (push) Successful in 1m10s
build configuration / build_and_cache_compute01 (push) Successful in 1m38s
lint / check (push) Successful in 23s
build configuration / build_and_cache_krz01 (push) Successful in 2m7s
build configuration / build_and_cache_vault01 (push) Successful in 1m19s
build configuration / build_and_cache_bridge01 (push) Successful in 1m11s
build configuration / build_and_cache_web02 (push) Successful in 1m17s
build configuration / build_and_cache_web01 (push) Successful in 1m45s
fix(scripts): Don't try to upload to the cache if no password is present
2024-10-11 14:53:00 +02:00

25 lines
673 B
Bash

set -eu -o pipefail
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
if [ "$STORE_PASSWORD" == "" ]; then
echo "No password given for the remote cache, uploading cannot take place."
exit 0
fi
cat <<EOF >.netrc
default
login $STORE_USER
password $STORE_PASSWORD
EOF
nix copy \
--extra-experimental-features nix-command \
--to "$STORE_ENDPOINT?compression=none" \
--netrc-file .netrc \
"$(nix-store --realise "$drv")"
rm .netrc