Make pushing optional

This commit is contained in:
Greg Hellings
2024-06-28 09:55:11 -05:00
parent c34dd1995e
commit 7b77d12a8b
+7 -2
View File
@@ -20,7 +20,10 @@ in writeShellApplication {
packer
];
text = ''
mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET"
push="''${1:-yes}"
if [ "$push" == "yes" ]; then
mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET"
fi
mkdir -p cache
'' + (concatStringsSep "\n" (
map (d: ''
@@ -29,7 +32,9 @@ in writeShellApplication {
# shellcheck disable=SC2143
if [ -z "$(mc ls storage/isos/cache/ | grep "$sha")" ]; then
curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url"
mc put "cache/$sha.iso" "storage/isos/cache/$sha.iso"
if [ "$push" == "yes" ]; then
mc put "cache/$sha.iso" "storage/isos/cache/$sha.iso"
fi
else
echo "Skipping ${d.distro} - cache/$sha.iso"
fi