fix(scripts): Don't try to upload to the cache if no password is present

This commit is contained in:
Tom Hubrecht 2024-10-11 14:53:00 +02:00
parent e37f56f85b
commit aa3d83ca06
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc

View file

@ -1,16 +1,21 @@
set -eu -o pipefail 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 cat <<EOF >.netrc
default default
login $STORE_USER login $STORE_USER
password $STORE_PASSWORD password $STORE_PASSWORD
EOF 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 \ nix copy \
--extra-experimental-features nix-command \ --extra-experimental-features nix-command \
--to "$STORE_ENDPOINT?compression=none" \ --to "$STORE_ENDPOINT?compression=none" \