2023-05-26 18:04:49 +00:00
|
|
|
#!/bin/sh
|
2023-05-26 21:20:20 +00:00
|
|
|
|
|
|
|
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
|