concourse-apprise-notifier/check

20 lines
341 B
Bash
Executable file

#!/bin/sh
set -e
exec 3>&1 # make stdout available as fd 3 for the result
exec 1>&2 # redirect all output to stderr for logging
PAYLOAD=$(mktemp /tmp/resource-check.XXXXXX)
cat > "$PAYLOAD" <&0
TS=$(jq '.version.timestamp // empty' < "$PAYLOAD")
if [ -z "$TS" ]; then
echo '[]' >&3
else
jq -n "[
{ timestamp: $TS }
]" >&3
fi