bitbucket-branch-source-plugin icon indicating copy to clipboard operation
bitbucket-branch-source-plugin copied to clipboard

Send build completion notification for pull requests merged after build start

Open mguillem opened this issue 3 years ago • 12 comments

This PR fixes the problem of notifications beeing not sent to Bitbucket at the end of a build causing BitBucket to show for ever "1 Build in progress".

Steps to reproduce the problem:

  • create pull request in BitBucket with an associated "long build"
    • build starts in Jenkins
    • Jenkins sends the status INPROGRESS
    • Bitbucket shows "1 Build in progress"
  • merge PR in BitBucket
    • Jenkins receives a notification and the SCMSource associated with the running build becomes jenkins.scm.impl.NullSCMSource
  • build ends in Jenkins but no notification is send due SCMSource of the build now being NullSCMSource
  • BitBucket shows for ever "1 Build in progress" for the pull request and the associated commit

Your checklist for this pull request

  • [x] Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • [x] Ensure that the pull request title represents the desired changelog entry
  • [x] Please describe what you did
  • [ ] Link to relevant issues in GitHub or in Jenkins JIRA
  • [ ] Link to relevant pull requests, esp. upstream and downstream changes
  • [ ] Did you provide a test-case? That demonstrates feature works or fixes the issue.

The provided fix searches for the SCMSource in the enclosing job if the build now contains a NullSCMSource.

mguillem avatar Aug 18 '21 13:08 mguillem

Hi maintainers, sorry to ask again but could one of you merge this PR or tell what should be changed? Thanks.

mguillem avatar Sep 09 '21 11:09 mguillem

JENKINS-66620 was filed today for the problem that this PR is intended to fix.

KalleOlaviNiemitalo avatar Sep 13 '21 11:09 KalleOlaviNiemitalo

@car-roll, @bitwiseman could you have a look at this PR and merge it or provide feedback if it should be improved/changed?Thanks.

mguillem avatar Oct 22 '21 07:10 mguillem

I don't know currently enough around this to do a comfortable merge - maybe someone else could chip-in?

What would help would to have some tests though 😅

lifeofguenter avatar Nov 16 '21 17:11 lifeofguenter

What would help would to have some tests though 😅

@lifeofguenter can you point me on some existing tests that could help to get started here?

mguillem avatar Nov 17 '21 09:11 mguillem

This will not work reliably for multibranch projects that have multiple branch sources, if the plugin is ever changed to use Bitbucket Server's newer build-status REST API that needs the project and repository slugs in the URL. The newer API is better in that build statuses posted to it can be deleted later (BSERV-11393, https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/448#issuecomment-957247068). However, even the newer API would work more reliably with this PR than without this PR.

KalleOlaviNiemitalo avatar Nov 17 '21 10:11 KalleOlaviNiemitalo

@lifeofguenter I really appreciate your activity for this plugin since a few days but it's quite depressing if you say that you don't feel qualified to review this PR. It is waiting since > 4 months and until now no maintainer has had time to have a look at it.

Is there any change I can make to make you feel more comfortable with my fix?

mguillem avatar Nov 19 '21 15:11 mguillem

@mguillem I think you can be fair enough to give me time to review it properly or add tests for the behavior prior and expected behavior afterwards if you want an instant merge. Wdyt?

lifeofguenter avatar Nov 19 '21 16:11 lifeofguenter

@lifeofguenter I'm more than happy if you plan to look at this PR soon. Your previous comment has wrongly given me a false impression. Sorry for that.

mguillem avatar Nov 20 '21 16:11 mguillem

Hi @mguillem @lifeofguenter,

we (my company and I) would have nice benefits, if this feature will be released. May you give us a short prospect if and when work will continue?

Kind regards Michael

mischoem avatar May 24 '22 08:05 mischoem

@bitwiseman, @lifeofguenter, @car-roll could you perhaps provide some feedback here? I'm ready to ensure that the PR becomes "mergeable" again but it is only worth the effort if somebody looks at it. Thanks in advance.

mguillem avatar Nov 22 '22 06:11 mguillem

I think a lot of users are waiting for this PR to be merged)

twingg avatar Nov 03 '23 09:11 twingg