Skip to content

Commit 481a113

Browse files
committed
Don't return Ok if update handler isn't run
We're losing jobs to publish crates. It's not clear why. The requests are returning 200, which implies they are being queued correctly. There is no log to indicate that these jobs failed, so right now I believe that this job is erroneously returning `Ok` when it failed. Given GitHub is having a partial outage, that seems to reinforce this theory. From looking at the code, this looks like the only way we could have returned `Ok` when the publish failed. I believe we got some sort of error response (or lack of one) from GitHub that caused this callback not to be run.
1 parent c8845f5 commit 481a113

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/git.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,11 @@ impl Repository {
203203

204204
// git push
205205
let mut ref_status = Ok(());
206+
let mut callback_called = false;
206207
{
207208
let mut origin = self.repository.find_remote("origin")?;
208209
let mut callbacks = git2::RemoteCallbacks::new();
210+
callback_called = true;
209211
callbacks.credentials(|_, user_from_url, cred_type| {
210212
self.credentials.git2_callback(user_from_url, cred_type)
211213
});
@@ -214,12 +216,18 @@ impl Repository {
214216
if let Some(s) = status {
215217
ref_status = Err(format!("failed to push a ref: {}", s).into())
216218
}
219+
callback_called = true;
217220
Ok(())
218221
});
219222
let mut opts = git2::PushOptions::new();
220223
opts.remote_callbacks(callbacks);
221224
origin.push(&["refs/heads/master"], Some(&mut opts))?;
222225
}
226+
227+
if !callback_called {
228+
ref_status = Err("update_reference callback was not called".into());
229+
}
230+
223231
ref_status
224232
}
225233

0 commit comments

Comments
 (0)