Skip to content

[ML]Fail CMake configure if 3rd-party git clone fails - #3164

Merged
edsavage merged 3 commits into
elastic:mainfrom
edsavage:fix/harden-3rd-party-cmake-clones
Aug 31, 2026
Merged

edsavage merged 3 commits into
elastic:mainfrom
edsavage:fix/harden-3rd-party-cmake-clones

Conversation

@edsavage

@edsavage edsavage commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds RESULT_VARIABLE checking to the execute_process() git clone call in pull-eigen.cmake.
  • Previously, a transient failure (e.g. GitLab overloaded) would be silently ignored, CMake would finish configuring, and the build would fail hundreds of lines later with a cryptic fatal error: Eigen/Core: No such file or directory.
  • With this change, CMake configure fails immediately with a clear message pointing at the network issue.

Root cause

The 9.4 and 9.5 snapshot builds on 2026-08-30 failed with Eigen/Core: No such file or directory. The build log showed:

Cloning into 'eigen'...
fatal: remote error: GitLab is currently unable to handle this request due to load (ID a3316bd44fafacac-ORD).

CMake continued silently and the compiler later failed when trying to include Eigen headers.

Test plan

  • Confirmed the fix correctly uses RESULT_VARIABLE per the CMake execute_process() docs
  • CI on this PR will exercise a successful clone (non-zero result path can be tested by temporarily pointing at a bad URL)

🤖 Generated with Claude Code

edsavage and others added 2 commits August 31, 2026 09:46
Previously, execute_process() silently ignored a non-zero exit from the
git clone command. If the GitLab server is unavailable or overloaded,
CMake would continue configuring with no Eigen headers present, leading
to a cryptic compiler error hundreds of lines later instead of a clear
configure-time failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Same hardening as pull-eigen.cmake: report a clear configure-time error
if the git clone fails rather than silently continuing and producing a
cryptic compiler error later.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@elasticsearchmachine

Copy link
Copy Markdown

Pinging @elastic/ml-core (Team:ML)

@edsavage edsavage added v9.5.3 auto-backport Automatically merge backport PRs when CI passes and removed v9.5.4 labels Aug 30, 2026
@edsavage
edsavage requested a lite review from Copilot August 31, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is small and low-risk, and the new failure mode correctly surfaces clone errors during configure rather than later during compilation.

Pull request overview

This PR hardens third-party dependency fetching during CMake configure by failing fast when git clone fails, avoiding later compile errors due to missing headers.

Changes:

  • Add RESULT_VARIABLE checking for the Eigen clone and terminate configure with FATAL_ERROR on failure.
  • Apply the same failure-fast behavior to the Valijson clone.
File summaries
File Description
3rd_party/pull-eigen.cmake Fail CMake configure immediately if cloning Eigen fails.
3rd_party/pull-valijson.cmake Fail CMake configure immediately if cloning Valijson fails.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread 3rd_party/pull-eigen.cmake Resolved
Comment thread 3rd_party/pull-valijson.cmake Resolved
…causes

Address Copilot review: include the clone URL in the error message and
replace "Check network access to X" with "Check network connectivity,
proxy settings, and git availability" since git clone can fail for
reasons beyond simple network access.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@edsavage
edsavage requested a review from valeriy42 August 31, 2026 03:33
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
✅ 8.19
✅ 9.4
✅ 9.5

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@edsavage edsavage changed the title Fail CMake configure if 3rd-party git clone fails [ML]Fail CMake configure if 3rd-party git clone fails Aug 31, 2026
elastic-vault-github-plugin-prod Bot added a commit that referenced this pull request Aug 31, 2026
Previously, execute_process() silently ignored a non-zero exit from the
git clone command. If the GitLab server is unavailable or overloaded,
CMake would continue configuring with no Eigen headers present, leading
to a cryptic compiler error hundreds of lines later instead of a clear
configure-time failure.

Same hardening for valijson as for pull-eigen.cmake: report a clear configure-time error
if the git clone fails rather than silently continuing and producing a
cryptic compiler error later.

(cherry picked from commit f95b8ef)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
elastic-vault-github-plugin-prod Bot added a commit that referenced this pull request Aug 31, 2026
Previously, execute_process() silently ignored a non-zero exit from the
git clone command. If the GitLab server is unavailable or overloaded,
CMake would continue configuring with no Eigen headers present, leading
to a cryptic compiler error hundreds of lines later instead of a clear
configure-time failure.

Same hardening for valijson as for pull-eigen.cmake: report a clear configure-time error
if the git clone fails rather than silently continuing and producing a
cryptic compiler error later.

(cherry picked from commit f95b8ef)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
elastic-vault-github-plugin-prod Bot added a commit that referenced this pull request Aug 31, 2026
Previously, execute_process() silently ignored a non-zero exit from the
git clone command. If the GitLab server is unavailable or overloaded,
CMake would continue configuring with no Eigen headers present, leading
to a cryptic compiler error hundreds of lines later instead of a clear
configure-time failure.

Same hardening for valijson as for pull-eigen.cmake: report a clear configure-time error
if the git clone fails rather than silently continuing and producing a
cryptic compiler error later.

(cherry picked from commit f95b8ef)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
edsavage added a commit to edsavage/ml-cpp that referenced this pull request Oct 6, 2026
The Eigen and Valijson sources are cloned at CMake configure time from
gitlab.com and github.com respectively. Those hosts occasionally return
transient errors (e.g. GitLab "currently unable to handle this request
due to load"), and a single failed clone was enough to break an entire
CI build, requiring a manual rebuild.

Wrap each clone in a bounded retry loop (5 attempts, increasing backoff)
that starts from a clean slate on every attempt, so a brief hosting
outage no longer fails the build.

Also propagate the failure from the outer execute_process() calls that
run these scripts. Previously the FATAL_ERROR raised inside the child
`cmake -P` process was swallowed: configure logged the error but
continued with an empty 3rd_party/eigen, so the failure only surfaced
much later as a cryptic "Eigen/Core: No such file or directory" compile
error. COMMAND_ERROR_IS_FATAL ANY makes configure stop immediately with
the clear message once retries are exhausted, finally delivering the
behaviour elastic#3164 intended.

Co-authored-by: Cursor <cursoragent@cursor.com>
edsavage added a commit that referenced this pull request Oct 8, 2026
The Eigen and Valijson sources are cloned at CMake configure time from
gitlab.com and github.com respectively. Those hosts occasionally return
transient errors (e.g. GitLab "currently unable to handle this request
due to load"), and a single failed clone was enough to break an entire
CI build, requiring a manual rebuild.

Wrap each clone in a bounded retry loop (5 attempts, increasing backoff)
that starts from a clean slate on every attempt, so a brief hosting
outage no longer fails the build.

Also propagate the failure from the outer execute_process() calls that
run these scripts. Previously the FATAL_ERROR raised inside the child
`cmake -P` process was swallowed: configure logged the error but
continued with an empty 3rd_party/eigen, so the failure only surfaced
much later as a cryptic "Eigen/Core: No such file or directory" compile
error. COMMAND_ERROR_IS_FATAL ANY makes configure stop immediately with
the clear message once retries are exhausted, finally delivering the
behaviour #3164 intended.
edsavage added a commit that referenced this pull request Oct 13, 2026
…3235)

The Eigen and Valijson sources are cloned at CMake configure time from
gitlab.com and github.com respectively. Those hosts occasionally return
transient errors (e.g. GitLab "currently unable to handle this request
due to load"), and a single failed clone was enough to break an entire
CI build, requiring a manual rebuild.

Wrap each clone in a bounded retry loop (5 attempts, increasing backoff)
that starts from a clean slate on every attempt, so a brief hosting
outage no longer fails the build.

Also propagate the failure from the outer execute_process() calls that
run these scripts. Previously the FATAL_ERROR raised inside the child
`cmake -P` process was swallowed: configure logged the error but
continued with an empty 3rd_party/eigen, so the failure only surfaced
much later as a cryptic "Eigen/Core: No such file or directory" compile
error. COMMAND_ERROR_IS_FATAL ANY makes configure stop immediately with
the clear message once retries are exhausted, finally delivering the
behaviour #3164 intended.

(cherry picked from commit bcce4aa)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
edsavage added a commit that referenced this pull request Oct 13, 2026
…3234)

The Eigen and Valijson sources are cloned at CMake configure time from
gitlab.com and github.com respectively. Those hosts occasionally return
transient errors (e.g. GitLab "currently unable to handle this request
due to load"), and a single failed clone was enough to break an entire
CI build, requiring a manual rebuild.

Wrap each clone in a bounded retry loop (5 attempts, increasing backoff)
that starts from a clean slate on every attempt, so a brief hosting
outage no longer fails the build.

Also propagate the failure from the outer execute_process() calls that
run these scripts. Previously the FATAL_ERROR raised inside the child
`cmake -P` process was swallowed: configure logged the error but
continued with an empty 3rd_party/eigen, so the failure only surfaced
much later as a cryptic "Eigen/Core: No such file or directory" compile
error. COMMAND_ERROR_IS_FATAL ANY makes configure stop immediately with
the clear message once retries are exhausted, finally delivering the
behaviour #3164 intended.

(cherry picked from commit bcce4aa)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
edsavage added a commit that referenced this pull request Oct 13, 2026
…3236)

The Eigen and Valijson sources are cloned at CMake configure time from
gitlab.com and github.com respectively. Those hosts occasionally return
transient errors (e.g. GitLab "currently unable to handle this request
due to load"), and a single failed clone was enough to break an entire
CI build, requiring a manual rebuild.

Wrap each clone in a bounded retry loop (5 attempts, increasing backoff)
that starts from a clean slate on every attempt, so a brief hosting
outage no longer fails the build.

Also propagate the failure from the outer execute_process() calls that
run these scripts. Previously the FATAL_ERROR raised inside the child
`cmake -P` process was swallowed: configure logged the error but
continued with an empty 3rd_party/eigen, so the failure only surfaced
much later as a cryptic "Eigen/Core: No such file or directory" compile
error. COMMAND_ERROR_IS_FATAL ANY makes configure stop immediately with
the clear message once retries are exhausted, finally delivering the
behaviour #3164 intended.

(cherry picked from commit bcce4aa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically merge backport PRs when CI passes >build :ml v8.19.22 v9.4.7 v9.5.3 v9.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants