bitbucket-branch-source-plugin
bitbucket-branch-source-plugin copied to clipboard
ServerUri does not support ssh
Jenkins and plugins versions report
Jenkins: 2.319.2 OS: Linux - 3.10.0-1160.66.1.el7.x86_64 scm-api:595.vd5a_df5eb_0e39 cloudbees-bitbucket-branch-source:751.vda_24678a_f781 ...
What Operating System are you using (both controller, and any agents involved in the problem)?
Linux, both
Reproduction steps
I would like to configure bitbucket so git clone goes over ssh, not https
Currently I have
unclassified:
bitbucketEndpointConfiguration:
endpoints:
- bitbucketServerEndpoint:
credentialsId: "jenkins-key"
displayName: "bitbucket.local"
manageHooks: true
serverUrl: "https://bitbucket.local"
webhookImplementation: NATIVE
but then when Jenkinsfile ir started then following code clones repository over https, not ssh
stage ("Checkout pipelines") {
checkout scm
}
According to the documentation and error message, ssh could not be used

Expected Results
ssh is supported
Actual Results
Error message when ssh is configured
Anything else?
No response
It needs an http or https URI in order to use the REST API, but you can add SSHCheckoutTrait.
@KalleOlaviNiemitalo I have configuration:
<jenkins.branch.BranchSource>
<source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="[email protected]">
<id>6a304b1c-...</id>
<serverUrl>https://bitbucket.local</serverUrl>
<credentialsId>jenkins-repo-key</credentialsId>
<repoOwner>REPOOWNER</repoOwner>
<repository>REPOSITORY</repository>
<traits>
and core configuration:
unclassified:
bitbucketEndpointConfiguration:
endpoints:
- bitbucketServerEndpoint:
credentialsId: "jenkins-repo-key"
displayName: "bitbucket.local"
manageHooks: true
serverUrl: "https://bitbucket.local"
webhookImplementation: NATIVE
how this should be reconfigured to use SSHCheckoutTrail ?
@damianszczepanik, in config.xml, it would look like this
<jenkins.branch.BranchSource>
<source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="[email protected]">
<id>6a304b1c-...</id>
<serverUrl>https://bitbucket.local</serverUrl>
<credentialsId>jenkins-repo-key</credentialsId>
<repoOwner>REPOOWNER</repoOwner>
<repository>REPOSITORY</repository>
<traits>
<com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait>
<credentialsId>d680a0c3-f069-40cf-9216-7100fd0e92e0</credentialsId>
</com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait>
</traits>
And then you'd need to define the d680a0c3-f069-40cf-9216-7100fd0e92e0 credential somewhere.
The configuration UI for this trait also offers "- use build agent's key -" instead of a credential, but I don't know how that works.