Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .ci/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ else
fi

# Turn on xtrace output only after processing args.
set -x
export PS4='${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see here we're setting PS4 in order to change the -x/-xtrace prompt/prefix.


# ---- For nightly and rc builds, determine if there is a point in testing.
Expand All @@ -144,8 +145,9 @@ if [[ $BUILD_TYPE != "release" && $FORCE != "true" ]]; then
#
# Note: We are relying on new releases being added to the top of index.tab,
# which currently seems to be the case.
latest_edge_version=$(curl -sS ${NVM_NODEJS_ORG_MIRROR}/index.tab \
| (grep "^v${NODE_VERSION}" || true) | awk '{print $1}' | head -1)
index_tab_content=$(curl -sS "${NVM_NODEJS_ORG_MIRROR}/index.tab" \
| (grep "^v${NODE_VERSION}" || true) | awk '{print $1}')
latest_edge_version=$(echo "$index_tab_content" | head -1)
if [[ -z "$latest_edge_version" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see here we've broken up the previous one liner into two lines. I also am not sure why this second version works more consistently and the first version does not, but this does not appear to do any harm so 👍

Copy link
Member Author

@trentm trentm Aug 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details are in comments on #2296

  1. One of the reproducible issues with the former is that curl | ... | head -1 can mean (if the file being downloaded by curl is large enough) that the read pipe is closed by head before curl has fully downloaded the file. Curl (with the curl -s option we are using) errors out in this case; and because we are using set -o pipefail in this bash script, the script exits non-zero. The solution there is to only include things in the pipeline that won't close the read pipe before all output is read.
  2. The part that was still un-understood flailing for me is why downloading the full content to a local temp file and doing cat "$localFile" | grep ... | awk ... | head -1 would fail... but only in CI. I could not repro locally.

So the current solution is an unsatisfying answer that seems to work for now.

skip "No ${BUILD_TYPE} build of Node v${NODE_VERSION} was found. Skipping tests."
fi
Expand Down