Repository navigation
CI: retry an ESP32 build whose ESP-IDF component fetch fails - #12375
Conversation
ESP32 builds fail at CMake configure, before anything is compiled, when
GitHub resets one git fetch:
ERROR: 'git --git-dir=/root/.cache/Espressif/ComponentManager/b_git_a38114cd
fetch origin' failed with exit code 128
fatal: unable to access
'https://github.com/espressif/esp32-arduino-lib-builder.git/': Recv
failure: Connection reset by peer
pioarduino's IDF-libs pass builds a dummy project whose idf_component.yml
(builder/build_lib/ in platform 55.03.312-1) requires espressif/fb_gfx from
esp32-arduino-lib-builder at version "master". ESP-IDF's component manager
(idf_component_tools/git_client.py, 2.4.11) runs `git fetch origin` on its
cached bare repo every time unless FETCH_HEAD is under a minute old; pinning
a commit or providing a lock file does not avoid it, and it has no retry or
offline setting. The CI image already holds that cache, so the fetch only
re-resolves master, but every ESP32 job depends on it succeeding.
#12360 retries `pio pkg install` for the other architectures and leaves this
fetch alone because it happens inside `pio run`. build-esp32.sh now reruns
`pio run` when, and only when, its output carries that fetch failure (CMake
wraps the message across lines, so the match folds whitespace first), up to
ESP32_IDF_FETCH_ATTEMPTS times (default 3) with 15 s, 30 s backoff. Any other
failure exits at once with pio's own status. A rerun after the failed
configure starts the IDF-libs pass again: esp32_pre.py already drops the
sdkconfig.defaults an aborted pass leaves behind.
Tested with a stub pio replaying the error block from a failed CI job
(chatter2, run 43558959379): fetch failure then success runs twice and
continues; another error runs once and fails with its status; the fetch
failure every time gives up after 3 runs; an inherited pipefail does not
change that; 0, -1 and "abc" for the attempt count exit 2 before building.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011C7D9bnioSkAoyRPicEV1C
⚡ Try this PR in the Web FlasherNote Building this pull request… the flash button, badges and supported-board |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
|
It worked on this CI run, merging it. |
…tic#12375) ESP32 builds fail at CMake configure, before anything is compiled, when GitHub resets one git fetch: ERROR: 'git --git-dir=/root/.cache/Espressif/ComponentManager/b_git_a38114cd fetch origin' failed with exit code 128 fatal: unable to access 'https://github.com/espressif/esp32-arduino-lib-builder.git/': Recv failure: Connection reset by peer pioarduino's IDF-libs pass builds a dummy project whose idf_component.yml (builder/build_lib/ in platform 55.03.312-1) requires espressif/fb_gfx from esp32-arduino-lib-builder at version "master". ESP-IDF's component manager (idf_component_tools/git_client.py, 2.4.11) runs `git fetch origin` on its cached bare repo every time unless FETCH_HEAD is under a minute old; pinning a commit or providing a lock file does not avoid it, and it has no retry or offline setting. The CI image already holds that cache, so the fetch only re-resolves master, but every ESP32 job depends on it succeeding. meshtastic#12360 retries `pio pkg install` for the other architectures and leaves this fetch alone because it happens inside `pio run`. build-esp32.sh now reruns `pio run` when, and only when, its output carries that fetch failure (CMake wraps the message across lines, so the match folds whitespace first), up to ESP32_IDF_FETCH_ATTEMPTS times (default 3) with 15 s, 30 s backoff. Any other failure exits at once with pio's own status. A rerun after the failed configure starts the IDF-libs pass again: esp32_pre.py already drops the sdkconfig.defaults an aborted pass leaves behind. Tested with a stub pio replaying the error block from a failed CI job (chatter2, run 43558959379): fetch failure then success runs twice and continues; another error runs once and fails with its status; the fetch failure every time gives up after 3 runs; an inherited pipefail does not change that; 0, -1 and "abc" for the attempt count exit 2 before building. Claude-Session: https://claude.ai/code/session_011C7D9bnioSkAoyRPicEV1C Co-authored-by: Claude <noreply@anthropic.com>
Summary
ESP32 builds intermittently fail at CMake configure, before anything is compiled. Recent examples are
chatter2in run 43558959379, andheltec-vision-master-e213-inkhudandt-deck-tfton #12047. The error:pioarduino's IDF-libs pass builds a dummy project whose
idf_component.yml(builder/build_lib/in platform 55.03.312-1) requiresespressif/fb_gfxfromesp32-arduino-lib-builderatversion: "master". ESP-IDF's component manager (idf_component_tools/git_client.py, 2.4.11) runsgit fetch originon its cached repo on every build, unlessFETCH_HEADis less than a minute old. Pinning a commit or providing a lock file doesn't avoid it; I checked both locally with git's network disabled. The component manager also has no retry or offline setting. #12360 added retries topio pkg installfor the other architectures, but left this fetch alone because it happens insidepio run.Change
bin/build-esp32.shrerunspio runwhen, and only when, its output contains that fetch failure. It retries up toESP32_IDF_FETCH_ATTEMPTStimes (default 3), waiting 15 s, then 30 s. CMake wraps the message across lines, so the match folds whitespace first. Any other failure exits at once with pio's own status. A rerun after the failed configure starts the IDF-libs pass again, becauseesp32_pre.pyalready drops thesdkconfig.defaultsthat an aborted pass leaves behind.The fetch still happens on every build, so
fb_gfxkeeps resolving from upstreammaster. Only a reset connection is retried.Testing
I ran
bin/build-esp32.shwith a stubpiothat replays the error block from the failedchatter2job:piosequencepipefailinheritedESP32_IDF_FETCH_ATTEMPTS=0,-1,abcThe raw CI log doesn't match the pattern until whitespace is folded, which confirms the folding is needed.
🤝 Attestations
This is a CI script change with no firmware change. The ESP32 builds in this PR's CI run through the new loop.
Generated by Claude Code
Summary by CodeRabbit