From 8b7f4648ca552f984a5174cccbcd3f76ccda95a3 Mon Sep 17 00:00:00 2001 From: Jakub Olejnik Date: Tue, 14 May 2024 11:50:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Check=20for=20space=20when=20bui?= =?UTF-8?q?lding=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ackee-xcode.pkr.hcl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ackee-xcode.pkr.hcl b/ackee-xcode.pkr.hcl index e38669a..b9ccfd2 100644 --- a/ackee-xcode.pkr.hcl +++ b/ackee-xcode.pkr.hcl @@ -110,4 +110,14 @@ build { "echo 'export JAVA_HOME=\"/opt/homebrew/opt/openjdk@17\"' >> ~/.zprofile", ] } + + // check there is at least 15GB of free space and fail if not + provisioner "shell" { + inline = [ + "source ~/.zprofile", + "df -h", + "export FREE_MB=$(df -m | awk '{print $4}' | head -n 2 | tail -n 1)", + "[[ $FREE_MB -gt 15000 ]] && echo OK || exit 1" + ] + } } \ No newline at end of file