Skip to content

Conversation

@trentm
Copy link
Member

@trentm trentm commented Aug 23, 2021

Fixes: #2296

@trentm trentm self-assigned this Aug 23, 2021
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Aug 23, 2021
@ghost
Copy link

ghost commented Aug 23, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-08-24T17:07:49.561+0000

  • Duration: 3 min 17 sec

  • Commit: 703ebf7

Trends 🧪

Image of Build Times

trentm added 5 commits August 23, 2021 13:50
…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
@trentm trentm changed the title attempt to get more info on ci "nightly" test failure ci: fix frequent nightly build failure in CI determining latest_edge_version Aug 23, 2021
@trentm
Copy link
Member Author

trentm commented Aug 23, 2021

Discussion is all in #2296

@trentm
Copy link
Member Author

trentm commented Aug 23, 2021

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.

@trentm trentm marked this pull request as ready for review August 23, 2021 23:20
@trentm trentm requested a review from astorm August 23, 2021 23:20
Copy link
Contributor

@astorm astorm left a 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

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.

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.

@trentm trentm merged commit c44cedb into master Aug 25, 2021
@trentm trentm deleted the trentm/y-u-fail-nightly-test branch August 25, 2021 17:09
dgieselaar pushed a commit to dgieselaar/apm-agent-nodejs that referenced this pull request Sep 10, 2021
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-nodejs Make available for APM Agents project planning.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: "nightly" test failed when determining latest_edge_version

3 participants