BitBucket endPoint configuration from script error

89 views
Skip to first unread message

Nicholas Brown

unread,
Oct 29, 2018, 9:00:10 AM10/29/18
to Jenkins Users
I've been trying to configure and Bitbucket Server endpoint using groovy script from the script console.
I've been following the example given here: https://plugins.jenkins.io/cloudbees-bitbucket-branch-source but using a BitbucketServerEndpoint instead of bitbucketCloudEndpoint. My code is:


import jenkins.model.Jenkins
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.*
 
def endPoint = new BitbucketServerEndpoint(
       
"Bitbucket Server",
       
"{{ bitbucket_url }}",
       
true, // manageHooks
       
"bitbucket_password_credential"
       
)
 
Jenkins jenkins = Jenkins.getInstance()
 
def bitbucketEndpointConfiguration = jenkins.getDescriptor("com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration")
 
bitbucketEndpointConfiguration
.updateEndpoint(BitbucketServerEndpoint)
 
jenkins
.save()

I'm getting the following error that I don't understand:

groovy.lang.MissingMethodException: No signature of method: com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration.updateEndpoint() is applicable for argument types: (java.lang.Class) values: [class com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketServerEndpoint] Possible solutions: updateEndpoint(com.cloudbees.jenkins.plugins.bitbucket.endpoints.AbstractBitbucketEndpoint)

Can anyone suggest what I'm doing wrong, and the correct way to do this?

Thanks,
Nick

Nicholas Brown

unread,
Oct 29, 2018, 9:13:56 AM10/29/18
to Jenkins Users
doh, simple typo. I'm just not very good at reading the error messages.

bitbucketEndpointConfiguration.updateEndpoint(BitbucketServerEndpoint)

should be:

bitbucketEndpointConfiguration.updateEndpoint(endPoint)
Reply all
Reply to author
Forward
0 new messages