fix(compute): ensure trailing newline in fetched discovery doc - #16407
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the update_discovery_doc.sh script to ensure that the fetched discovery document ends with a trailing newline. The review feedback suggests improving portability by separating the option and argument in the tail command (using tail -c 1 instead of tail -c1) and simplifying the echo command used to append the newline.
| if [[ -s "${TEMP_JSON}" && -n "$(tail -c1 "${TEMP_JSON}")" ]]; then | ||
| echo "" >>"${TEMP_JSON}" | ||
| fi |
There was a problem hiding this comment.
For better portability across different POSIX-compliant environments (such as BSD/macOS and various Linux distributions), it is recommended to separate the option and its argument with a space (i.e., tail -c 1 instead of tail -c1). Additionally, echo without arguments can be used instead of echo "" to append a newline.
| if [[ -s "${TEMP_JSON}" && -n "$(tail -c1 "${TEMP_JSON}")" ]]; then | |
| echo "" >>"${TEMP_JSON}" | |
| fi | |
| if [[ -s "${TEMP_JSON}" && -n "$(tail -c 1 "${TEMP_JSON}")" ]]; then | |
| echo >>"${TEMP_JSON}" | |
| fi |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16407 +/- ##
=======================================
Coverage 92.24% 92.24%
=======================================
Files 2246 2246
Lines 212296 212296
=======================================
+ Hits 195825 195840 +15
+ Misses 16471 16456 -15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes a failure encountered during the scheduled run of the
.github/workflows/update-compute-discovery.ymlautomation workflow.