-
Notifications
You must be signed in to change notification settings - Fork 0
/
in
executable file
·40 lines (30 loc) · 706 Bytes
/
in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
echo "1: ${1}"
echo "2: ${3}"
echo "3: ${2}"
#cd "${1}"
exec 3>&1 # make stdout available as fd 3 for the result
exec 1>&2 # redirect all output to stderr for logging
echo "testing"
set +x
# for jq
PATH=/usr/local/bin:$PATH
payload=$(mktemp /tmp/resource-test.XXXXXX)
cat > "${payload}" <&0
echo "payload : ${payload}"
timestamp="$(jq -n "{version:{timestamp:\"$(date +%s)\"}}")"
echo "timestamp"
build_name="$(jq '(.params.build_name // null)' < "${payload}")"
echo "build_name"
metadata=""
echo "build metadata"
metadata="$(cat <<EOF
{
"metadata": [
{"name": "build_name", "value": ${build_name} },
]
}
EOF
)"
echo "$timestamp $metadata" >&3