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

"Repository name" in the first Bitbucket Server branch source clears when I change "Project name" in another branch source of the same multibranch project

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • Jenkins 2.277.3
      Bitbucket Server Integration plugin 2.1.3
      Git plugin 4.7.1
      Git client plugin 3.7.1
      Pipeline: Multibranch plugin 2.23
      SCM API plugin 2.6.4

      I had a Multibranch Pipeline project in Jenkins, with a Bitbucket Server branch source that refers to a repository in Bitbucket Server. That worked OK. Then I added a second Bitbucket Server branch source to the same Jenkins project, now referring to a personal fork of the repository. The original repository and the fork have only one branch each, and the names of these branches are not the same, so I hoped that Jenkins would find both branches. However, when I typed the name of my profile in the "Project name" field of the second branch source, the configuration screen cleared the "Repository name" of the first branch source. I did not originally notice that before saving, and the empty "Repository name" field then caused the following exception:

      [Thu Apr 29 10:50:15 EEST 2021] Starting branch indexing...
      ERROR: [to huhtikuuta 29 10:50:15 EEST 2021] Could not fetch branches from source 5b61467d-72cb-4a41-b24d-c27900d1093d
      java.lang.NullPointerException
      	at hudson.Util.getDigestOf(Util.java:636)
      	at jenkins.plugins.git.AbstractGitSCMSource.getCacheEntry(AbstractGitSCMSource.java:1391)
      	at jenkins.plugins.git.AbstractGitSCMSource.getCacheEntry(AbstractGitSCMSource.java:1218)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:339)
      	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:566)
      	at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource$CustomGitSCMSource.accessibleRetrieve(BitbucketSCMSource.java:505)
      	at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:233)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:641)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      [Thu Apr 29 10:50:15 EEST 2021] Finished branch indexing. Indexing took 1 ms
      FATAL: Failed to recompute children of [REDACTED]
      java.lang.NullPointerException
      	at hudson.Util.getDigestOf(Util.java:636)
      	at jenkins.plugins.git.AbstractGitSCMSource.getCacheEntry(AbstractGitSCMSource.java:1391)
      	at jenkins.plugins.git.AbstractGitSCMSource.getCacheEntry(AbstractGitSCMSource.java:1218)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:339)
      	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:566)
      	at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource$CustomGitSCMSource.accessibleRetrieve(BitbucketSCMSource.java:505)
      	at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:233)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:641)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Finished: FAILURE
      

      Editing one branch source on the configuration screen should not automatically clear or change any fields of other branch sources.

          [JENKINS-65509] "Repository name" in the first Bitbucket Server branch source clears when I change "Project name" in another branch source of the same multibranch project

          I tried the same with Bitbucket Branch Source plugin 2.9.8 and that worked just fine, even generated the appropriate "Bitbucket" sidebar link pointing to the correct repository of each branch. So yeah, this seems a bug in the Bitbucket Server Integration plugin.

          Kalle Niemitalo added a comment - I tried the same with Bitbucket Branch Source plugin 2.9.8 and that worked just fine, even generated the appropriate "Bitbucket" sidebar link pointing to the correct repository of each branch. So yeah, this seems a bug in the Bitbucket Server Integration plugin.

          Oops, I edited the configuration of the Multibranch Pipeline project again and I found that the "Repository name" field in the first branch source (which was supposed to refer to the original repository) was blank. I typed the repository name there and now the exception no longer occurs. So the actual bug here is that, when I select a Bitbucket Server project for the second branch source, the configuration UI clears the repository name from the first branch source as well.

          Kalle Niemitalo added a comment - Oops, I edited the configuration of the Multibranch Pipeline project again and I found that the "Repository name" field in the first branch source (which was supposed to refer to the original repository) was blank. I typed the repository name there and now the exception no longer occurs. So the actual bug here is that, when I select a Bitbucket Server project for the second branch source, the configuration UI clears the repository name from the first branch source as well.

          I get the same behaviour when trying to add a second Bitbucket Server repository inside Multiple SCMs: the first repository name is cleared.

           

          Environment:

          Jenkins 2.303.1
          Bitbucket Server Integration plugin 2.1.3
          Git plugin 4.8.2
          Git client plugin 3.9.0
          Multiple SCMs plugin: 0.8
          SCM API plugin 2.6.5

          Jonathan Gowland added a comment - I get the same behaviour when trying to add a second Bitbucket Server repository inside Multiple SCMs: the first repository name is cleared.   Environment: Jenkins 2.303.1 Bitbucket Server Integration plugin 2.1.3 Git plugin 4.8.2 Git client plugin 3.9.0 Multiple SCMs plugin: 0.8 SCM API plugin 2.6.5

          Kalle Niemitalo added a comment - - edited

          Perhaps it’s caused by this: https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/blob/4b40bf89b60d2568d2f57a4fe6f3f784a6c4a86e/src/main/webapp/js/searchableField.js#L77-L85

          The code to clear the fields was added in https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/46.

          I assume the fillDependsOn attributes in the DOM are generated from the names of parameters of doFillRepositoryNameItems.

          I am out of office and cannot verify this hypothesis yet.

          Kalle Niemitalo added a comment - - edited Perhaps it’s caused by this: https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/blob/4b40bf89b60d2568d2f57a4fe6f3f784a6c4a86e/src/main/webapp/js/searchableField.js#L77-L85 The code to clear the fields was added in https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/46 . I assume the fillDependsOn attributes in the DOM are generated from the names of parameters of doFillRepositoryNameItems . I am out of office and cannot verify this hypothesis yet.

          Sorry it's taken me so long to get to this bug report.

          The repository name disappearing when clicking the project is known behaviour. We always clear the repository upon editing the project name because it's expected upon making such a change, your repo name will need to change as well. I believe we're defining a change as focusing on the project field- so making no change and clicking away empties the repo field when it probably shouldn't. I definitely think the multiple source branch case is a bug, but multiple source branches in general needs to be made more robust so this will likely be part of that effort.

          Martin Henschke added a comment - Sorry it's taken me so long to get to this bug report. The repository name disappearing when clicking the project is known behaviour. We always clear the repository upon editing the project name because it's expected upon making such a change, your repo name will need to change as well. I believe we're defining a change as focusing on the project field- so making no change and clicking away empties the repo field when it probably shouldn't. I definitely think the multiple source branch case is a bug, but multiple source branches in general needs to be made more robust so this will likely be part of that effort.

            Unassigned Unassigned
            kon Kalle Niemitalo
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: