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

bitbucket-build-status-notifier-plugin fails for multiple Git repo

      I created a new build with multiple Git repositories ( Not Multi-SCM ).
      I set the advanced name setting for each repository.
      I am able to build from first Git repo, and upon success push to second Git repo using 'Git Publisher'. I am getting error from the notifier plugin during the build process. It would be helpful to have an option in the plugin to choose which repository to notify.

      Stack trace output:

      Bitbucket notify on start failed: None or multiple repos
      java.lang.Exception: None or multiple repos
      at org.jenkinsci.plugins.bitbucket.scm.GitScmAdapter.getCommitRepoMap(GitScmAdapter.java:53)
      at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper.createBuildStatusResources(BitbucketBuildStatusHelper.java:87)
      at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper.createBuildStatusResources(BitbucketBuildStatusHelper.java:144)
      at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper.notifyBuildStatus(BitbucketBuildStatusHelper.java:231)
      at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper.notifyBuildStatus(BitbucketBuildStatusHelper.java:224)
      at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.prebuild(BitbucketBuildStatusNotifier.java:109)
      at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:834)
      at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:829)
      at hudson.model.Build$BuildExecution.doRun(Build.java:144)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      at hudson.model.Run.execute(Run.java:1728)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:404)

          [JENKINS-41147] bitbucket-build-status-notifier-plugin fails for multiple Git repo

          Alex Juarez added a comment -

          The solution involves changes to the BitbucketBuildStatusHelper and to the <*>ScmAdapter classes. The former must add a new parameter (e.g. repoToNotify) with its corresponding DataBound setter to capture the user input. The SCM adapters already receive the correct scm object but only get one build action from the build object. When there are more than one repo being accessed in a build, there will be multiple actions so we need to get all the actions and then check which of them corresponds to the target repository that will be notified. This will ensure we get the correct commit hash to be notified (instead of just the first one that is in the build's scm object list). It's tempting to notify multiple repositories at once, but I woujld vote to start with single repo notification at first. 

          Alex Juarez added a comment - The solution involves changes to the BitbucketBuildStatusHelper and to the <*>ScmAdapter classes. The former must add a new parameter (e.g. repoToNotify) with its corresponding DataBound setter to capture the user input. The SCM adapters already receive the correct scm object but only get one build action from the build object. When there are more than one repo being accessed in a build, there will be multiple actions so we need to get all the actions and then check which of them corresponds to the target repository that will be notified. This will ensure we get the correct commit hash to be notified (instead of just the first one that is in the build's scm object list). It's tempting to notify multiple repositories at once, but I woujld vote to start with single repo notification at first. 

          Sean MacKay added a comment -

          I get this error when merging my PR branches together before running the build. I think the notifier does not know which branch to send notifications for since it's a merged commit that isn't in the bitbucket remote.

          Sean MacKay added a comment - I get this error when merging my PR branches together before running the build. I think the notifier does not know which branch to send notifications for since it's a merged commit that isn't in the bitbucket remote.

          Erik van Velzen added a comment - - edited

          Possibly fixed by https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/pull/43 ?

          This is not tagged yet for release.

          Erik van Velzen added a comment - - edited Possibly fixed by https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/pull/43 ? This is not tagged yet for release.

            alex_juarez Alex Juarez
            dlaprade Daniel LaPrade
            Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: