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

Multibranch Pipeline Source for Bitbucket server shows blank "Bitbucket Server instance" when Configured with Job DSL

XMLWordPrintable

      When configuring a multibranch pipeline job via job DSL, I was unable to successfully have it populate the "Bitbucket Server instance" field. I set the serverId in the job DSL to the same value in the "Instance name" from the Jenkins configuration settings, but it would not work. I then attempted the "Instance URL" and that did not work either. I finally got creative, and I dug around in the Jenkins home. Inside com.atlassian.bitbucket.jenkins.internal.config.BitbucketPluginConfiguration.xml I found an ID field, which looks like some sort of GUID (big long string of letters, numbers, and dashes). When I put that into the serverId field in the job DSL, it worked! So I have a work around, but I highly doubt the plugin is supposed to behave that way as it should likely take the "Instance name" value instead which is the value you select in the UI when configuring the multibranch pipeline job.

      Example Job DSL

      multibranchPipelineJob('TestGroup/test-multi') {
          displayName('test-multi')
          branchSources {
              branchSource {
                  source {
                      BbS {
                          id("test-multi")
                          credentialsId("bitbucket-scan")
                          serverId("42181cb2-1735-49ac-88b3-6e9f018c72ff")
                          mirrorName("Primary")
                          projectName("TestGroup")
                          repositoryName("test-multi")
                          traits {
                              gitBranchDiscovery()
                              headWildcardFilter {
                                  includes('*')
                                  excludes('master')
                              }
                          }
                      }
                  }
              }
          }
          triggers {
              BitbucketWebhookMultibranchTriggerImpl()
          }
      }
      

            Unassigned Unassigned
            jeremycornett Jeremy Cornett
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: