Skip to content

Commit 48c90b6

Browse files
committed
Fix JSON generation in tests
1 parent 21b6e6f commit 48c90b6

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

ci/settings.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ jobs:
8080
old_version="1.1.1j"
8181
8282
latest_version_json=$(
83-
/opt/resource/check <<EOF
84-
{ "source": { "family": "${version_family}" } }
85-
EOF
83+
jq --null-input \
84+
--arg "family" "${version_family}" \
85+
'{ "source": { "family": $family } }' \
86+
| /opt/resource/check
8687
)
8788
latest_version=$(jq --raw-output '.[0].version' <<< "${latest_version_json}")
8889
@@ -92,11 +93,14 @@ jobs:
9293
fi
9394
9495
mkdir "old"
95-
/opt/resource/in "old" <<EOF
96-
{ "version": { "version": "${old_version}" },
97-
"source": { "family": "${version_family}" }
98-
}
99-
EOF
96+
jq --null-input \
97+
--arg "version" "${old_version}" \
98+
--arg "family" "${version_family}" \
99+
'{
100+
"version": { "version": $version },
101+
"source": { "family": $family }
102+
}' \
103+
| /opt/resource/in "old"
100104
101105
if [[ ! -f "old/openssl-${old_version}.tar.gz" ]]; then
102106
>&2 echo "FAIL: expected to found a 'openssl-${old_version}.tar.gz' tarball, but got:"
@@ -111,11 +115,14 @@ jobs:
111115
fi
112116
113117
mkdir "current"
114-
/opt/resource/in "current" <<EOF
115-
{ ${latest_version_json},
116-
"source": { "family": "${version_family}" }
117-
}
118-
EOF
118+
jq --null-input \
119+
--arg "version" "${latest_version}" \
120+
--arg "family" "${version_family}" \
121+
'{
122+
"version": { "version": $version },
123+
"source": { "family": $family }
124+
}' \
125+
| /opt/resource/in "current"
119126
120127
if [[ ! -f "current/openssl-${latest_version}.tar.gz" ]]; then
121128
>&2 echo "FAIL: expected to found a 'openssl-${latest_version}.tar.gz' tarball, but got:"

0 commit comments

Comments
 (0)