qrgen: add script to check if qrgen deployment works

This commit is contained in:
2021-04-12 17:27:28 +02:00
parent e6a8d314ec
commit 813aa9ddb7
2 changed files with 32 additions and 0 deletions

4
verifier/README.md Normal file
View File

@@ -0,0 +1,4 @@
Script and Containerfile for deployment verification

28
verifier/qrverify.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
#
# EP should contain the hostname?
# If passing it is impossible, maybe we should interrogate Ingress resource?
#
# uuidgen comes from util-linux, zbarimg from zbar
set -e
DATA=$(uuidgen)
TMPFILE=$(mktemp --suffix .png)
echo "➡️ Checking ${EP} with data: ${DATA}"
curl --verbose "http://${EP}/render/?data=${DATA}" --output ${TMPFILE}
DECODED=$(zbarimg --quiet ${TMPFILE})
if [ "QR-Code:${DATA}" != "${DECODED}" ]; then
echo "❌ Error, got ${DECODED}"
exit 1
else
echo "✅ OK!"
fi
exit 0