S3 cache: Check other caches before uploading
This commit is contained in:
parent
a1e67817d0
commit
811fec2756
1 changed files with 16 additions and 5 deletions
|
@ -38,9 +38,19 @@ in
|
||||||
echo "$storePath"
|
echo "$storePath"
|
||||||
else
|
else
|
||||||
curl -I --fail --silent "https://cache.nixos.org/$uncachedHash.narinfo" > /dev/null
|
curl -I --fail --silent "https://cache.nixos.org/$uncachedHash.narinfo" > /dev/null
|
||||||
|
cached_nixos="$?"
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $cached_nixos -eq 0 ]; then
|
||||||
echo "Already cached: $storePath ..."
|
echo "Already cached on NixOS: $storePath ..."
|
||||||
|
else
|
||||||
|
curl -I --fail --silent "https://nix-community.cachix.org/$uncachedHash.narinfo" > /dev/null
|
||||||
|
cached_cachix_nixcommunity="$?"
|
||||||
|
|
||||||
|
curl -I --fail --silent "https://nifoc.cachix.org/$uncachedHash.narinfo" > /dev/null
|
||||||
|
cached_cachix_nifoc="$?"
|
||||||
|
|
||||||
|
if [ $cached_cachix_nixcommunity -eq 0 ] || [ $cached_cachix_nifoc -eq 0 ]; then
|
||||||
|
echo "Already cached on Cachix: $storePath ..."
|
||||||
else
|
else
|
||||||
sudo -H nix store sign --key-file $signingKey $storePath
|
sudo -H nix store sign --key-file $signingKey $storePath
|
||||||
|
|
||||||
|
@ -48,6 +58,7 @@ in
|
||||||
sudo -H nix copy --to '${cache.s3Url}' $storePath
|
sudo -H nix copy --to '${cache.s3Url}' $storePath
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue