-
Notifications
You must be signed in to change notification settings - Fork 238
ci: fix frequent nightly build failure in CI determining latest_edge_version #2298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Trends 🧪 |
…loading index.tab Piping a curl download into commands that close the read pipe before curl has fully downloaded the file (per a Context-Length header) will result in curl erroring out. This breaks this script, because it is running with 'set -o pipefail' Fixes: #2296
|
Discussion is all in #2296 |
|
Builds 5 and 7 at https://apm-ci.elastic.co/job/apm-agent-nodejs/job/apm-agent-nodejs-mbp/job/PR-2298/ should successful "egde" builds using the current PR changes. |
astorm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| set -x | ||
| export PS4='${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' | ||
| set -o xtrace | ||
|
|
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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
- One of the reproducible issues with the former is that
curl | ... | head -1can mean (if the file being downloaded by curl is large enough) that the read pipe is closed byheadbeforecurlhas fully downloaded the file. Curl (with thecurl -soption we are using) errors out in this case; and because we are usingset -o pipefailin 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. - 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 -1would fail... but only in CI. I could not repro locally.
So the current solution is an unsatisfying answer that seems to work for now.
…version (elastic#2298) Piping a curl download into commands that close the read pipe before curl has fully downloaded the file (per a Context-Length header) will result in curl erroring out with "Failed writing body". This breaks this script, because it is running with 'set -o pipefail'. An attempt to use a local temp file was discarded because of a not understood failure in CI. See elastic#2296 comments. Fixes: elastic#2296
Fixes: #2296