gocd-build-github-pull-requests icon indicating copy to clipboard operation
gocd-build-github-pull-requests copied to clipboard

Plugin execution is not triggered on merge commits

Open akurkin opened this issue 9 years ago • 27 comments
trafficstars

hello guys, consider this situation:

  • create feature branch from master
  • make changes, commit and push -- pipeline will be executed automatically
  • few PRs went into master
  • merge master into feature branch -- this generates a merge commit
  • push to remote repo -- it won't be picked up by gocd plugin

Is it known limitation? any way to work around it?

akurkin avatar May 12 '16 18:05 akurkin

I just had a PR not trigger the plugin this morning, not understanding why. After starting the pipeline manually the build status was reported to the PR.

I am not sure if it followed the exact sequence you describe here since I was only playing around to try out the plugin, but I can confirm that the topmost commit in the PR was indeed a merge commit.

gunnarx avatar May 13 '16 14:05 gunnarx

Does it pick up the latest changes when you trigger the pipeline manually?

ashwanthkumar avatar May 15 '16 12:05 ashwanthkumar

@ashwanthkumar yes, and it also works if I trigger for specific revision (revision is properly shown) the problem is that it's not triggered automatically

akurkin avatar May 15 '16 15:05 akurkin

@akurkin Can you share the plugin logs? If possible enable debug logging on the go server and if you can retry the above steps and share the logs, that would be even great.

ashwanthkumar avatar May 15 '16 15:05 ashwanthkumar

We're experiencing the exact same issue: Automatic triggering works, unless it's a merge commit. Unfortunately I don't have access to the log files.

whiskeysierra avatar May 21 '16 11:05 whiskeysierra

Confirm, autobuild does not work after merge commit push

AlexanderYastrebov avatar May 24 '16 15:05 AlexanderYastrebov

Thanks for the issue report. I'll have a look at it and keep you guys posted.

On Tue, May 24, 2016 at 8:50 PM, Alexander Yastrebov < [email protected]> wrote:

Confirm, autobuild does not work after merge commit push

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/ashwanthkumar/gocd-build-github-pull-requests/issues/71#issuecomment-221305892

Ashwanth Kumar / ashwanthkumar.in

ashwanthkumar avatar May 24 '16 16:05 ashwanthkumar

Hello. I have created pull request to fix it. Actual fix is just removing break in cycle. See #74

AlexanderYastrebov avatar May 24 '16 18:05 AlexanderYastrebov

that's awesome. Looking forward to seeing this issue fixed!

akurkin avatar May 25 '16 14:05 akurkin

@AlexanderYastrebov Thank you so much for getting this done. I'll verify and merge them.

Meanwhile @akurkin @whiskeysierra @gunnarx - can you guys also verify the changes from your side?

ashwanthkumar avatar May 25 '16 15:05 ashwanthkumar

Sure, happy to do it. Is there a jar file available or some instructions on how to build it myself? (sorry, not well versed in java world)

akurkin avatar May 25 '16 16:05 akurkin

@akurkin Please check out github-pr-poller-1.2.4-merge-commit-fix.jar.zip

PS: Github doesn't support attaching JAR files on the issues. So had to compress into into a ZIP :(

ashwanthkumar avatar May 25 '16 16:05 ashwanthkumar

Here's the Git Feature Branch plugin (with fixes from #74), if you're directly using it from Git repos without Github.

git-fb-poller-1.2.4-merge-commit-fix.jar.zip

ashwanthkumar avatar May 25 '16 16:05 ashwanthkumar

@akurkin Please check out github-pr-poller-1.2.4-merge-commit-fix.jar.zip

I tried it, but a merge commit still doesn't trigger a build for my PR:

See my attached screenshots. Last build was an hour ago, but the last changes show my merge from 7 minutes ago.

screenshot from 2016-06-23 11-07-33 screenshot from 2016-06-23 11-08-13

whiskeysierra avatar Jun 23 '16 09:06 whiskeysierra

Same issue here, any news on this?

decoomanj avatar Sep 08 '16 09:09 decoomanj

It seems that when the modified-material list is empty, the pipeline is NOT triggered. This happens when e.g. GitHub does a merge (master into a branch, for example). The change is detected, but nothing happens because the modified-material-list is empty.

I have made a plain work-around by inserted a fake-change in the list to trigger the pipeline. This is probably not the way to go, but I didn't really see another solution since the Java-Git library doesn't give me extra information.

Take a look here for the change.

BTW, the use-case is that we want that ALL changes on a PR are build in the pipeline, including all the merges!

decoomanj avatar Sep 09 '16 09:09 decoomanj

I just made a release with the changes on PR at ashwanthkumar/git-cmd#2

https://github.com/ashwanthkumar/gocd-build-github-pull-requests/releases/tag/v1.3.0-RC2

Please check and let me know if that fixes the problem.

cc: @juhasipo

ashwanthkumar avatar Oct 29 '16 07:10 ashwanthkumar

Please check and let me know if that fixes the problem.

Not for us, no.

whiskeysierra avatar Nov 09 '16 12:11 whiskeysierra

I'm still seeing the issue as well.

Josaphat avatar Nov 09 '16 15:11 Josaphat

Actually I just realized that we're still using the old version of the plugin. I have to check again, next time a merge appears.

whiskeysierra avatar Nov 10 '16 20:11 whiskeysierra

Nope, doesn't work.

whiskeysierra avatar Nov 10 '16 21:11 whiskeysierra

Okay, I finally got some time to look into this issue and it seems that for merge commits the modifiedFiles list seems to be empty, even after the changes from https://github.com/ashwanthkumar/git-cmd/pull/2/ that doesn't seem to help for cases wherein there're only new files added via merge commits. Added an ugly patch to force trigger the commits and it seems to be working. The fix is part of https://github.com/ashwanthkumar/gocd-build-github-pull-requests/pull/94.

EDIT - Thanks to @decoomanj for the original solution.

ashwanthkumar avatar Feb 24 '17 12:02 ashwanthkumar

@ashwanthkumar It seems like the issue is back again in v1.3.3

I tried to deploy gocd server v17.2.0.2 with github-pr-poller-1.3.3.jar - the issue's back.

Then I deployed gocd server v17.2.0.2 with github-pr-poller-1.3.1.jar - the issue's gone.

qlibin avatar Apr 25 '17 12:04 qlibin

@qlibin Oops looks like a regression, most likely as part of this. Will fix it but this time with tests around that part. Thanks for reporting.

ashwanthkumar avatar Apr 25 '17 13:04 ashwanthkumar

This issue also seems to applies to the stash-pr-poller. Would you be so kind to fix it there as well?

GordonGuenther avatar Apr 27 '17 06:04 GordonGuenther

This issue also exists on git-fb-poller-1.3.4.jar. Will this be fixed too ?

jinayvora1990 avatar Aug 11 '17 07:08 jinayvora1990

I am still facing this issue @ashwanthkumar, is there any updates on this?

I am facing this issue when :

1.)I create a feature branch which does not have the latest changes from master. 2.) then I click on the button given to update the branch with master changes which rebases all the commits from master into our feature branch.

The pipeline does not run.

For the time being I am ammending the commit with some whitespace or making a dummy commit and force pushing it into my feature branch to retrigger the pipeline.

amithalef avatar Apr 23 '20 07:04 amithalef