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

Provide logging for BitbucketClientException when attempting to fetch mirror from non-DC instance

XMLWordPrintable

      When attempting to fetch a non-null mirror name against a Bitbucket Server license, the upstream will return an error which is sent back unhelpfully as an unhandled BitbucketClientException with no logging (except the error code). This should be caught when initializing an SCM or SCMSource to ask users to check the status of their mirror or license.

      Original description:

      Hi, 

      I am trying to see a pipeline job, executing the DSL script below.

      When the serverId is left blank, it works, but then we have to manually open the generated pipeline job to select the server, which is not an automated way.

      When the serverId is filled with the id related to the Bitbucket server defined in jenkins configuration , the generation fails, with the following error:

      java.lang.IllegalArgumentException: Could not instantiate {id=74aeb686-0b0d-41a8-b1de-b635e74ca659, branches=[feature/DEVOPS-122-creates-a-dsl-job-to-automate-bitbucket-pipeline-j], credentialsId=git-token, mirrorName=Primary Server, projectName=software, repositoryName=devops-fwk, serverId=ce23d98c-d9b6-43cc-ab84-6f205c3fb812, sshCredentialsId=null, gitTool=null, extensions=[]} for com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM: java.lang.reflect.InvocationTargetException

      ...

      ..

      .

      Caused by: com.atlassian.bitbucket.jenkins.internal.client.exception.BadRequestException: - response: 409

       

      -----------

      My assumption is that there is an internal failured related to the temptative to create a webhook which fails in a automated way.

      Any workaround or fix to propose?

      Generating this file from a DSL is key, since jenkins master creation is fully automated, no means to use jenkins front end to manually fine tune some jobs

       

       

      #Unable to render embedded object: File (/usr/bin/env groovy#) not found./usr/bin/env groovy

      pipelineJob("BitbucketExample") {   

      triggers

      {      BitbucketWebhookTriggerImpl\{         pullRequestTrigger(false)         refTrigger(true)       }

          }     

      definition {       

      cpsScm {                       

      scm {                   

      BbS {                     

      id("id")                     

      branches {                       

      branchSpec

      {                          name("branchname")                        }

                           

      }                     

      credentialsId("token")                     

      mirrorName("Primary Server")                     

      projectName("proj")                     

      repositoryName("repo")                     

      serverId('XXXXX')

      sshCredentialsId(null)                     

      gitTool(null)                   

      }           

      lightweight()                     

      scriptPath("Jenkinsfile")       

      }    }}

            Unassigned Unassigned
            cbernard_psee Cedric Bernard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: