Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35664

StashNotifier does not notify Stash when Git Plugin fails to merge

XMLWordPrintable

      Not sure if this error belongs to StashNotifier or GitPlugin, but as it causes problems with the former I will post it here.

      Problem: StashNotifier won't notify Stash instance about failed build, throwing error in the log instead: "found no commit info", when there is failed merge in GitPlugin.

      Detail: I'm using GitPlugin with advanced setting Merge Before Build, which just pulls another branch of my source code and tries to merge it with the branch being built, then does some tasks on merged build. It may happen that the merge fails, and so does the build. Problem is - some plugins, especially StashNotifier, don't fire in this case, so my Stash doesn't know the build failed, it looks like the build didn't happen at all.

      Here is typical console log when this happens:

      Merging Revision cc20020e824791cf9ae52de5fefe29ed64a9badb (origin/feature-D) to origin/master, UserMergeOptions{mergeRemote='origin', mergeTarget='master', mergeStrategy='default', fastForwardMode='--ff'}
       > git rev-parse origin/master^{commit} # timeout=10
       > git config core.sparsecheckout # timeout=10
       > git checkout -f origin/master
       > git merge --ff cc20020e824791cf9ae52de5fefe29ed64a9badb # timeout=10
       > git config core.sparsecheckout # timeout=10
       > git checkout -f cc20020e824791cf9ae52de5fefe29ed64a9badb
      ERROR: Branch not suitable for integration as it does not merge cleanly: Could not merge AnyObjectId[cc20020e824791cf9ae52de5fefe29ed64a9badb]
      found no commit info
      Sending e-mails to: *****
      Finished: FAILURE
      

      From what I checked in StashNotifier source code, it relies on some info passed from the build like commit SHA, which it doesn't find in case like the above. Build clearly is in failed state, but plugin can't figure out what commit should be notified back to Stash it seems. I don't know enough of Jenkins/GitPlugin/StashNotifier internals to dig it further, so I hope someone could help here, because not having info about failed builds in this case may be problematic in the future.

      From what you can see, mail notify post-build task works fine. From what I noticed, some other plugins also have problem with this (for example plugin that alters build name doesn't do this when build fails on merge). So I'm not sure if this is not a bigger issue tied to how GitPlugin handles failure on merge internally?

            scaytrase Pavel Batanov
            noizex Kamil N
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: