nishio-dens / bitbucket-pullrequest-builder-plugin

Bitbucket Pull Request Builder Plugin for Jenkins
Other
125 stars 145 forks source link

Some build failures (unstable status) resulting in "in progress" rather than failure status posting to Bitbucket (Cloud) #193

Open stevemuskiewicz opened 5 years ago

stevemuskiewicz commented 5 years ago

We are on Bitbucket Cloud with version 1.4.30 of Bitbucket pull request builder plugin. It seems like there are certain cases of a Jenkins build failure that are not posting a proper "failed" build status back to the Bitbucket PR, instead we just see an "in progress" build status but the link does not actually go back to a Jenkins build result, only to our main Jenkins URL. If I look at the commit status in the bitbucket API, I see these (relevant) fields:

      u'refname': None,
      u'state': u'INPROGRESS',
      u'type': u'build',
      u'updated_on': u'2019-03-06T15:46:48.456391+00:00',
      u'url': u'http://XXXXXX:8080/'}

However there are other failing builds (checkstyle results) that are properly posting their status back to the PR so this isn't completely broken.

For the Jenkins job with the "failed" (actually unstable) result, the unstable status actually comes from the Violations plugin based on a specific type of check failure (PEP8). I'm not sure if this is significant but figured I would mention in case it is...so I see this at the end of the Jenkins console:

11:33:11 Build step 'Report Violations' changed build result to UNSTABLE
11:33:11 [Slack Notifications] found #359 as previous completed, non-aborted build
11:33:11 Finished: UNSTABLE

Unfortunately I don't see anything else in the build logs to indicate that there was an issue with build status being posted. I don't really see anything relevant in the jenkins.log file either but if there is something specific I should look for please let me know and I'll post here.

stevemuskiewicz commented 5 years ago

Seeing this issue again, but looks like what might be happening is that build (triggered by the PR builder) is in progress and before the build completes a new commit is pushed to the PR (we have both "Rebuild if destination branch changes?" and "Cancel outdated jobs?" enabled in our Jenkins job config).

It looks like the pull request builder is posting an "in progress" status on the new commit SHA but it is not canceling the existing build and then nothing else happens and no Jenkins build is triggered against the new commit (nor is the old build cancelled).

So seems to me like some of what was supposed to be fixed in #188 is still not working using this version of the plugin.

Indeed I checked our builds today and older builds are definitely not getting cancelled whereas they did when we were using plugin version 1.4.28.

So may still be the same bug as before?

CodeMonk commented 5 years ago

Thanks - I'll start looking into it.

otalio commented 5 years ago

@CodeMonk

Hello, We're still facing this with version 1.4.30. Do you have any new release planned in which this will be fixed?

CodeMonk commented 5 years ago

I have not personally reproduced or fixed it. However, I do hope to get time soon.

If anyone else has cycles to dig, it would be appreciated . . . if not, I will try to get to it as soon as I can -- hopefully this week I can start. Ya know - paying job and stuff . ;-)

stevemuskiewicz commented 3 years ago

Just confirming that this is still present in the latest version (1.5.0) of the plugin

stevemuskiewicz commented 3 years ago

Some clarification on when this happens: if the build results in a "FAILED" status in Jenkins then it does post the correct status to the Bitbucket commit. The problem seems to be when the Jenkins build status is "UNSTABLE" (ie. test failures), in these cases instead of posting a "FAILED" status to Bitbucket (like we see in the 1.4.x plugin versions), it is instead posting an "INPROGRESS" status and the build URL only links to the general CI/Jenkins top URL, not to the specific build job itself.

HTH

HeidiRechek commented 2 years ago

following