scm {
                     BbS { 
                             id('')
                             credentialsId(credentialsId1)
                              serverId('bb')
                              sshCredentialsId('')
                              projectName(stashProject)
                              repositoryName(repoSlug)
                              mirrorName('')
                              gitTool(null)
                              branches {
                                branchSpec

      {                            name(branchName)                          }

                              }
                          }
              }
      serverId('bb') is not working , rest are pickedup 
       

       

          [JENKINS-75325] serverId using JobDSL is not working

          Dyon added a comment -

          Hi there pagadalacs,

          I havent been able to spend some time recreating this on my end yet, however from a quick chat to the team i believe you need to use the `serverName` instead of `serverId`. 

          Please let me know if that helps.

          Thanks,

          Dyon

          Dyon added a comment - Hi there pagadalacs , I havent been able to spend some time recreating this on my end yet, however from a quick chat to the team i believe you need to use the `serverName` instead of `serverId`.  Please let me know if that helps. Thanks, Dyon

          Chandra Pagadala added a comment -

          Hi, thanks for checking in. I  already tried serverName , but no success.   although  it was not mentioned in api documention  http://my-jenkins-server:8080/plugin/job-dsl/api-viewer/index.html#method/javaposse.jobdsl.dsl.helpers.ScmContext.BbS     

          also not sure what is Id() used for ? 

           

          i got below error : 
          ERROR: (jobs_by_bitbucket.groovy, line 1296) No signature of method: serverName() is applicable for argument types: (java.lang.String) values: [bb]
          Possible solutions: id(), branches(), credentialsId(), sshCredentialsId(), extensions(), gitTool(), projectName(), repositoryName(), serverId(), mirrorName()

          Chandra Pagadala added a comment - Hi, thanks for checking in. I  already tried serverName , but no success.   although  it was not mentioned in api documention  http://my-jenkins-server:8080/plugin/job-dsl/api-viewer/index.html#method/javaposse.jobdsl.dsl.helpers.ScmContext.BbS       also not sure what is Id() used for ?    i got below error :  ERROR: (jobs_by_bitbucket.groovy, line 1296) No signature of method: serverName() is applicable for argument types: (java.lang.String) values: [bb] Possible solutions: id(), branches(), credentialsId(), sshCredentialsId(), extensions(), gitTool(), projectName(), repositoryName(), serverId(), mirrorName()

          Dyon added a comment -

          Hi pagadalacs,

          could you perhaps send the error that is occurring when you try to build while using `serverId`. Is there also a reason why you cant select a server instance? Has one not been configured?

           

          Thanks,

          Dyon

          Dyon added a comment - Hi pagadalacs , could you perhaps send the error that is occurring when you try to build while using `serverId`. Is there also a reason why you cant select a server instance? Has one not been configured?   Thanks, Dyon

          Chandra Pagadala added a comment -

          Hi dgeorgopoulos , i don't see any error when using serverId. Build is rather success and jenkins job is created, but  with server instance empty.   

           

          jenkins log , shows: 

          There was a problem while trying to add webhook  error as below  , i think this is understandable as server is missing in the job.
          Feb 27, 2025 7:42:34 AM WARNING hudson.model.AbstractProject onLoad
          could not start trigger while loading project '_test/develop/build-and-test' com.atlassian.bitbucket.jenkins.internal.client.exception.BitbucketClientException: - response: -1 at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.lambda$getServer$2(BitbucketWebhookTriggerImpl.java:276) at java.base/java.util.Optional.orElseThrow(Unknown Source) at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.getServer(BitbucketWebhookTriggerImpl.java:276) at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.registerWebhook(BitbucketWebhookTriggerImpl.java:294) at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.lambda$addTrigger$1(BitbucketWebhookTriggerImpl.java:265) at java.base/java.util.ArrayList.forEach(Unknown Source)

          Chandra Pagadala added a comment - Hi dgeorgopoulos , i don't see any error when using serverId. Build is rather success and jenkins job is created, but  with server instance empty.      jenkins log , shows:  There was a problem while trying to add webhook  error as below  , i think this is understandable as server is missing in the job. Feb 27, 2025 7:42:34 AM WARNING hudson.model.AbstractProject onLoad could not start trigger while loading project '_test/develop/build-and-test' com.atlassian.bitbucket.jenkins.internal.client.exception.BitbucketClientException: - response: -1 at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.lambda$getServer$2(BitbucketWebhookTriggerImpl.java:276) at java.base/java.util.Optional.orElseThrow(Unknown Source) at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.getServer(BitbucketWebhookTriggerImpl.java:276) at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.registerWebhook(BitbucketWebhookTriggerImpl.java:294) at PluginClassLoader for atlassian-bitbucket-server-integration//com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookTriggerImpl$BitbucketWebhookTriggerDescriptor.lambda$addTrigger$1(BitbucketWebhookTriggerImpl.java:265) at java.base/java.util.ArrayList.forEach(Unknown Source)

          Chandra Pagadala added a comment - - edited

          I configured the server with name "bb" , like in the attchahed screenshot.   Its just that serverId is not picked the server instace name when dsl script run.  wondering if i am doing anything wrong, or the dsl serverId part not working ? 

          Chandra Pagadala added a comment - - edited I configured the server with name "bb" , like in the attchahed screenshot.   Its just that serverId is not picked the server instace name when dsl script run.  wondering if i am doing anything wrong, or the dsl serverId part not working ? 

            Unassigned Unassigned
            pagadalacs Chandra Pagadala
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: