Skip to content

Commit

Permalink
Merge branch 'IDX-3079-exit-status-38' into 'master'
Browse files Browse the repository at this point in the history
fix(bazel): ERROR: The Build Event Protocol upload failed

Closes IDX-3079 

Closes IDX-3079

See merge request dfinity-lab/public/ic!17730
  • Loading branch information
marko-k0 committed Feb 16, 2024
2 parents 6111d5a + cb6de0d commit 802b20b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ build:ci --build_event_binary_file=bazel-bep.pb
build --bes_results_url=https://dash.idx.dfinity.network/invocation/
build --bes_backend=bes.idx.dfinity.network
build --bes_timeout=30s # Default is no timeout.
# sync=true implies --bes_upload_mode=wait_for_upload_complete
# https://github.com/buildbuddy-io/buildbuddy/pull/3906
# Should help with ERROR: The Build Event Protocol upload failed (Error: exit status 38)
build --sync=true
build:ci --bes_timeout=180s # Default is no timeout.
build:ci --bes_upload_mode=wait_for_upload_complete
build --experimental_remote_build_event_upload=minimal

build --remote_local_fallback
Expand Down
12 changes: 1 addition & 11 deletions gitlab-ci/src/bazel-ci/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ if [[ "${CI_COMMIT_TAG:-}" =~ ^release-.+ ]]; then
RC="True"
fi

EXIT_CODE=0
# shellcheck disable=SC2086
# ${BAZEL_...} variables are expected to contain several arguments. We have `set -f` set above to disable globbing (and therefore only allow splitting)"
buildevents cmd "${ROOT_PIPELINE_ID}" "${CI_JOB_ID}" "${CI_JOB_NAME}-bazel-cmd" -- bazel \
Expand All @@ -53,13 +52,4 @@ buildevents cmd "${ROOT_PIPELINE_ID}" "${CI_JOB_ID}" "${CI_JOB_NAME}-bazel-cmd"
${BAZEL_EXTRA_ARGS:-} \
${BAZEL_TARGETS} \
2>&1 \
| perl -pe 'BEGIN { select(STDOUT); $| = 1 } s/(.*Streaming build results to:.*)/\o{33}[92m$1\o{33}[0m/' || EXIT_CODE="${PIPESTATUS[0]}"

if [ "$EXIT_CODE" == "38" ]; then
echo "Tolerating BEP upload failure."
# ERROR: The Build Event Protocol upload failed: Not retrying publishBuildEvents, no more attempts left: status='Status{code=CANCELLED, description=context canceled, cause=null}' CANCELLED: CANCELLED: context canceled CANCELLED: CANCELLED: context canceled
#Error: exit status 38
else
echo "bazel process exited with $EXIT_CODE" >&2
exit "$EXIT_CODE"
fi
| perl -pe 'BEGIN { select(STDOUT); $| = 1 } s/(.*Streaming build results to:.*)/\o{33}[92m$1\o{33}[0m/'

0 comments on commit 802b20b

Please sign in to comment.