concourse-apprise-notifier/in

19 lines
329 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-in.XXXXXX)
cat > "$PAYLOAD" <&0
TS=$(jq '.version.timestamp // empty' < "$PAYLOAD")
[ -z "$TS" ] && TS='"none"'
jq -n "{
version: {
timestamp: $TS
}
}" >&3