Output error logs from nitro failures.

This commit is contained in:
Graeme Connell 2024-05-16 08:58:08 -06:00
parent 8ca674cc13
commit 750b4bc57d

View File

@ -1,8 +1,18 @@
#!/bin/bash
set -x -e -o pipefail
ENCLAVE_INFO="$(mktemp)"
nitro-cli run-enclave --eif-path "$ENCLAVE_PATH" --cpu-count ${CPUS:-2} --memory ${RAM:-1024} | tee $ENCLAVE_INFO
ENCLAVE_CID="$(cat $ENCLAVE_INFO | jq .EnclaveCID)"
echo "Available releases:"
ls -la /releases/
ENCLAVE_INFO="$(mktemp)"
if ! nitro-cli run-enclave --eif-path "$ENCLAVE_PATH" --cpu-count ${CPUS:-2} --memory ${RAM:-1024} | tee $ENCLAVE_INFO; then
echo "ERROR RUNNING ENCLAVE"
for file in /var/log/nitro_enclaves/err*.log; do
echo "=== Error file: $file ==="
cat $file
done
exit 1
fi
ENCLAVE_CID="$(cat $ENCLAVE_INFO | jq .EnclaveCID)"
exec /bin/svr2 --enclave_type nitro --nitro_cid "$ENCLAVE_CID" --nitro_port 27427 "$@"