Make pushing optional
This commit is contained in:
+7
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user