Github force-push confuses drone?

I switched to Drone 0.5-rc a couple of weeks ago and I noticed that Drone builds the wrong commit after a force-push. If I manually press on “Rebuild”, the correct version of the code is picked up and everything is fine. Here are the steps:

  • open a PR. Drone picks it up and builds. Assume it failed
  • I fix the failure and force-push (amending the last commit, for instance)
  • Drone builds the code again, fails in exactly the same way (interestingly, the Drone UI shows the correct commit hash in the build header)
  • I press “Rebuild”. This time the build succeeds

I think Drone is using the old version of the code/old commit hash, but I don’t know exactly how to debug it. The git plugin doesn’t print the git hash after checking out FETCH_HEAD. I used Drone 0.4.2 for a long time and this never happened.

Here’s what I see on the Git section:

+ git init
Initialized empty Git repository in /drone/src/
+ git remote add origin
+ git fetch --no-tags origin +refs/pull/32/merge:
 * branch            refs/pull/32/merge -> FETCH_HEAD
+ git checkout -qf FETCH_HEAD
+ git submodule update --init --recursive
exit code 0

There is an open issue for this

There is also a patch that was submitted to the git plugin, but this is failing unit tests and cannot be merged until passing.

Thanks! To me it’s not clear it is the same issue. #1000 is about building the “newer” SHA, while I’m observing the opposite: the old, broken SHA is being built even after a force push (and there are no running builds when I force-push). I am printing now the git commit that’s being built and I see that it is indeed the wrong one.

Should I file another ticket?

@drago not sure, I can tell you there have been no changes to how receives build information or clones the repository between 0.4 and 0.5. If you are experiencing this issue, I recommend jumping into the code and looking at the contents of the pull request hook from GitHub to ensure the correct SHA is being sent and being saved in the database. If you see any issues and can send a PR that is much appreciated.

You can also create a new ticket, but to be 100% up front this won’t get worked on unless someone volunteers to debug and patch.

It seems a restart helped, at least for now. I’ll keep an eye on it and if it happens again I’ll try to have a look at the code.

@dragos - we suffered from the same problem as you describe. It seems to be fixed if you use this new Git logic, but isn’t a problem in Travis which uses the same Git logic as is broken at the moment.

Ultimately, I believe it to be an issue with how Drone evaluates if a build is required or not - but I’ve yet to provide evidence or a fix of this.


Any news on this?

We are suffering from this problem, so after force push it shows the right commit in a build job, but somehow builds the the wrong one and I don’t know how to fix it.

Sometimes it needs to be force pushed with different hashes 10 times, sometimes it helps just to try in hours… We haven’t found reliable workaround yet, but it solves somehow later mostly, but even new branch doesn’t help. Would be nice at least to know a workaround to this problem.

One thing, I have thought from last short investigation, that it can be github cache and not drone problem at all…

Many thanks in advance!