Skip to content

Commit 963f1c1

Browse files
committed
fix: parse json to extract terraform version
Request JSON output when getting the Terraform version to build the versions.txt file. When using terraform version, and piping the output to head (to get the first line) and then to awk (to get the version string), there's a race condition that might cause head to close the pipe before Terraform flushed its entire output to the pipe, resulting in a 141 error (141 -128 = 13 -> SIGPIPE). This change is expected to make the CI workflow more stable.
1 parent 30403f6 commit 963f1c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/linterVersions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ for LANGUAGE in "${!LINTER_NAMES_ARRAY[@]}"; do
223223
elif [[ "${LINTER}" == "sqlfluff" ]]; then
224224
GET_VERSION_CMD="$("${LINTER}" --version | awk '{ print $3 }')"
225225
elif [[ ${LINTER} == "terraform" ]]; then
226-
GET_VERSION_CMD="$(CHECKPOINT_DISABLE="not needed for version checks" "${LINTER}" --version | head -n 1 | awk '{ print $2 }')"
226+
GET_VERSION_CMD="$("${LINTER}" version | jq --raw-output .terraform_version)"
227227
elif [[ "${LINTER}" == "terragrunt" ]]; then
228228
GET_VERSION_CMD="$("${LINTER}" --version | awk '{ print $2 }')"
229229
elif [[ ${LINTER} == "terrascan" ]]; then

0 commit comments

Comments
 (0)