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

Bitbucket Server Integration cannot checkout to the remote in a pipeline job

      I have used many pipeline jobs and define the bbs_checkout steps.
      In a pipeline job, it seems that the `bbs_checkout` with the newer version of the plugin cannot access to the credentials
      or something is wrong with the ssh username and password secrets.

      Here is my step code:

      bbs_checkout branches: [[name: "*/${GIT_BRANCH}"]], projectName: GIT_PROJECT, repositoryName: GIT_REPOSITORY, serverId: '21197389-53b2-4e6a-8bf8-b24661cc08b7', sshCredentialsId: GIT_CREDENTIALS
      

      And the logs are below:

      Bitbucket - responded with not authorized 
      May 06, 2022 1:55:53 PM INFO com.atlassian.bitbucket.jenkins.internal.scm.BitbucketScmHelper getRepository
      Error creating the Bitbucket SCM: Something went wrong when trying to contact Bitbucket Server: Provided credentials cannot access the resource
      May 06, 2022 1:55:53 PM INFO com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM initializeGitScm
      

      This is totally fine when I use the plugin version 2.1.3 with the same credentials. Is there anything spec changed?

          [JENKINS-68423] Bitbucket Server Integration cannot checkout to the remote in a pipeline job

          Hi Daeho, sorry for the delay in responding.

          To answer your question, your BBS pipeline step is not working because you did not provide a credentials ID in your step- only an SSH credential. The bbs_checkout_branches step has a few behaviours that require a standard credential:

          • Upon creating an SCM, the credential is used to resolve the specified project and repository, which is used in creating a clone URL
          • It is also used for posting build statuses when the checkout is performed, and again at the end of the job

          The step will not function without it. By adding a 'credentialsId: CREDENTIAL` this problem should be resolved. If this isn't possible for your setup, could you please vote and leave a comment on JENKINS-65466 explaining your use case?

          Thanks,
          Martin

          Martin Henschke added a comment - Hi Daeho, sorry for the delay in responding. To answer your question, your BBS pipeline step is not working because you did not provide a credentials ID in your step- only an SSH credential. The bbs_checkout_branches step has a few behaviours that require a standard credential: Upon creating an SCM, the credential is used to resolve the specified project and repository, which is used in creating a clone URL It is also used for posting build statuses when the checkout is performed, and again at the end of the job The step will not function without it. By adding a 'credentialsId: CREDENTIAL` this problem should be resolved. If this isn't possible for your setup, could you please vote and leave a comment on JENKINS-65466 explaining your use case? Thanks, Martin

          Daeho Ro added a comment -

          This is so weird changes.

          When I set the Bitbucket server information, I have used the personal access token from the admin account with readonly access.
          Until the version 2.1.3, it seems that the pipeline automatically use this credentials without any implicit settings but now it is not.

          Daeho Ro added a comment - This is so weird changes. When I set the Bitbucket server information, I have used the personal access token from the admin account with readonly access. Until the version 2.1.3, it seems that the pipeline automatically use this credentials without any implicit settings but now it is not.

            mhenschke_atlassian Martin Henschke
            lamanus Daeho Ro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: