Skip to content

ci: remove the partial depot_tools clone before retrying it - #53486

Merged
MarshallOfSound merged 1 commit into
mainfrom
fix/retry-clean-partial-clone
Sep 3, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
fix/retry-clean-partial-clone

Conversation

@claude

@claude claude Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested via Slack

Description of Change

Before: when the test job's "Get Depot Tools" clone failed after git had already written the repository, retry.sh reran the same git clone against the leftover ./depot_tools directory, so every retry failed instantly and the step was guaranteed to fail.

After: retry.sh takes an opt-in RETRY_CLEAN_PATH; the depot_tools clone sets it to depot_tools, and the wrapper removes that path before each retry (never before the first attempt), so a retried clone starts from a clean destination.

This makes the retry wrapper actually recover from a clone that dies mid-way instead of turning one transient network error into four identical failures.

How: #53470 (backported to 44-x-y in #53473) added script/actions/retry.sh on the assumption that "a failed git clone removes its partial directory". That only holds while git is still fetching the pack: once the repository is written, a failure in the checkout stage keeps the directory, and with --filter=tree:0 the checkout still fetches trees over the network. macos-x64 / test (darwin, 2) on #53479 hit exactly that (job 100841887205): a DNS blip during checkout, then

fatal: destination path 'depot_tools' already exists and is not an empty directory.
##[error]'git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git' failed with exit code 128 after 4 attempts

The cleanup is opt-in and takes an explicit path rather than parsing git clone's arguments, so the script never deletes anything a caller didn't name, and the other wrapped commands (npm i -g, e d update_depot_tools, git fetch) are unchanged. The header comment in retry.sh is corrected to match.

Testing

Reproduced with a fake git on PATH that leaves depot_tools/ behind and exits 128 on the first clone, then behaves like real git (fails if the destination exists, succeeds otherwise):

$ RETRY_DELAY=0 bash retry.sh git clone --filter=tree:0 https://example/depot_tools.git
fatal: could not fetch abc from promisor remote
::warning::'git clone ...' failed with exit code 128 (attempt 1 of 4); retrying in 0s
fatal: destination path 'depot_tools' already exists and is not an empty directory.
::warning::'git clone ...' failed with exit code 128 (attempt 2 of 4); retrying in 0s
fatal: destination path 'depot_tools' already exists and is not an empty directory.
::warning::'git clone ...' failed with exit code 128 (attempt 3 of 4); retrying in 0s
fatal: destination path 'depot_tools' already exists and is not an empty directory.
::error::'git clone ...' failed with exit code 128 after 4 attempts
exit=128

$ RETRY_CLEAN_PATH=depot_tools RETRY_DELAY=0 bash retry.sh git clone --filter=tree:0 https://example/depot_tools.git
fatal: could not fetch abc from promisor remote
::warning::'git clone ...' failed with exit code 128 (attempt 1 of 4); retrying in 0s
removing 'depot_tools' left behind by the failed attempt
Cloning into 'depot_tools'... ok
exit=0 attempts=2

Also checked that a pre-existing path is left alone when the first attempt succeeds (RETRY_CLEAN_PATH=keep bash retry.sh true keeps keep/x). bash -n and a YAML parse of the workflow pass; shellcheck was not available in the environment, and node script/lint.js needs a full checkout so it was not run.

Checklist

Release Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pgo4hKUF1UNQCWyBFwRdjg

Notes: none


Generated by Claude Code

script/actions/retry.sh (#53470, backported in #53473) assumed that a
failed `git clone` removes its directory, so it rerun the command as is.
That is only true while git is still fetching the pack: once the
repository has been written, a failure in the checkout stage keeps the
directory, and with --filter=tree:0 the checkout still fetches trees over
the network. In the 44-x-y run for #53479, the "Get Depot Tools" step lost
DNS mid-clone ("fatal: could not fetch ... from promisor remote"), left
./depot_tools behind, and every retry then failed with "fatal: destination
path 'depot_tools' already exists and is not an empty directory", so the
wrapper turned one transient error into a guaranteed failure.

Add an opt-in RETRY_CLEAN_PATH to retry.sh: when set, the path is removed
before each retry, never before the first attempt, and set it to
depot_tools at the clone call site. The other callers (npm install, `e d
update_depot_tools`, `git fetch`) are unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Pgo4hKUF1UNQCWyBFwRdjg
@claude claude Bot added target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 3, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) September 3, 2026 23:01
@MarshallOfSound
MarshallOfSound merged commit 32b79dd into main Sep 3, 2026
112 checks passed
@MarshallOfSound
MarshallOfSound deleted the fix/retry-clean-partial-clone branch September 3, 2026 23:57
@release-clerk

release-clerk Bot commented Sep 3, 2026

Copy link
Copy Markdown

No Release Notes

@trop

trop Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #53487

@trop

trop Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #53488

@trop

trop Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #53489

@trop trop Bot removed the target/44-x-y PR should also be added to the "44-x-y" branch. label Sep 3, 2026
@trop

trop Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #53490

@trop trop Bot added in-flight/42-x-y in-flight/45-x-y and removed target/43-x-y PR should also be added to the "43-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. in-flight/44-x-y labels Sep 3, 2026
@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. and removed in-flight/45-x-y in-flight/42-x-y in-flight/43-x-y labels Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/none

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants