Gracefully handle missing Jenkins root URL

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When testing out the new multibranch pipeline support in version 1.1.0 of the plugin, I discovered that creation of a multibranch pipeline job via Job DSL fails when the Jenkins root URL is not set. It seems that the plugin tries to register the webhook but does not catch the exception thrown when the Jenkins root URL is unset. Full stack trace: stack-trace.txt

      Here is the Job DSL for the multibranch pipeline:

      multibranchPipelineJob('test') {
          branchSources {
              branchSource {
                  source {
                      BbS {
                          credentialsId('Build-User')
                          id('test')
                          mirrorName(null)
                          projectName('TEST')
                          repositoryName('test')
                          serverId('Bitbucket')
                          traits {
                              cleanBeforeCheckoutTrait {
                                  extension {
                                      deleteUntrackedNestedRepositories(true)
                                  }
                              }
                              gitBranchDiscovery()
                              localBranchTrait()
                              pruneStaleBranchTrait()
                          }
                      }
                  }
              }
          }
      }
      

      The equivalent multibranch pipeline definition for the CloudBees Bitbucket Branch Source plugin gracefully handles the exception and skips webhook registration when the Jenkins root URL is unset. Example:

      multibranchPipelineJob('test') {
          branchSources {
              branchSource {
                  source {
                      bitbucket {
                          credentialsId('Build-User')
                          id('test')
                          repoOwner('TEST')
                          repository('test')
                          serverUrl('https://redacted.com/scm')
                          traits {
                              bitbucketBranchDiscovery {
                                  strategyId(1)
                              }
                              bitbucketPullRequestDiscovery {
                                  strategyId(1)
                              }
                              cleanBeforeCheckoutTrait {
                                  extension {
                                      deleteUntrackedNestedRepositories(true)
                                  }
                              }
                              localBranchTrait()
                              pruneStaleBranchTrait()
                          }
                      }
                  }
              }
          }
      }
      

            Assignee:
            Unassigned
            Reporter:
            Bryan Burke
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: