Skip to content

Commit

Permalink
Merge pull request #34 from buildkite-plugins/toote_bash4.3_compat
Browse files Browse the repository at this point in the history
Bash 4.3 compatibility
  • Loading branch information
pzeballos authored Jan 13, 2023
2 parents b1e4543 + 9a30ad6 commit fd4f463
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions hooks/pre-exit
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ done < <("${FIND_CMD[@]}" . -path "./${FILES_PATTERN}")

if [[ "${#matching_files[@]}" -eq "0" ]]; then
echo "No files found matching '${FILES_PATTERN}'"
if [[ -z "${BUILDKITE_COMMAND_EXIT_STATUS+x}" ]] || [[ "${BUILDKITE_COMMAND_EXIT_STATUS}" -eq "0" ]]; then
if [[ "${BUILDKITE_COMMAND_EXIT_STATUS:-0}" -eq "0" ]]; then
exit 1
fi
fi

for file in "${matching_files[@]}"; do
echo "Uploading '$file'..."
if ! upload "$TOKEN_VALUE" "$FORMAT" "${file}"; then
echo "Error uploading, will continue"
fi
done
else
# needs to be part of else for bash4.3 compatibility
for file in "${matching_files[@]}"; do
echo "Uploading '$file'..."
if ! upload "$TOKEN_VALUE" "$FORMAT" "${file}"; then
echo "Error uploading, will continue"
fi
done
fi

0 comments on commit fd4f463

Please sign in to comment.