Skip to content

Commit 8cd8562

Browse files
committed
fix(update): handle retry for cargo version pinning after version bump
1 parent 85b792a commit 8cd8562

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

rake_tasks/rust.rake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ end
1414

1515
desc 'Update the rust lock files'
1616
task :update do
17+
# The first repin after a version bump can fail due to a stale checksum in
18+
# Cargo.Bazel.lock; a second run lets Bazel reconcile and succeeds.
1719
puts 'pinning cargo versions'
18-
Bazel.execute('fetch', ['--repo_env=CARGO_BAZEL_REPIN=true'], '@crates//:all')
20+
begin
21+
Bazel.execute('fetch', ['--repo_env=CARGO_BAZEL_REPIN=true'], '@crates//:all')
22+
rescue RuntimeError
23+
puts 'repin failed, retrying...'
24+
Bazel.execute('fetch', ['--repo_env=CARGO_BAZEL_REPIN=true'], '@crates//:all')
25+
end
1926
end
2027

2128
desc 'Pin Rust dependencies'

0 commit comments

Comments
 (0)