Issue
Preface: I'm pretty green in the Jenkins\Artifactory\DSL space, so I'll prob sound like I'm bumbling along.
I'm working on a Jenkins DSL script to pull information on\about our Artifactory setup.
I don't have admin rights to Jenkins or Artifactory, just normal credentials to login and run things.
The Jenkins server has Artifactory credentials and the plugin is installed.
So my question goes...
I was using this snippet of code;
// Get Default Artifactory Info
import jenkins.model.*
def instance = Jenkins.get()
def defaultServer = Jenkins.instance.getDescriptor('org.jfrog.hudson.ArtifactoryBuilder').getArtifactoryServers()[0]
def defaultArtifactoryName = defaultServer.getName()
def defaultArtifactoryUrl = defaultServer.getUrl()
def defaultArtifactoryCredId = defaultServer.getDeployerCredentialsConfig().getCredentialsId()
To pull the info about our Artifactory server, to then pass as variables.
It used to work fine, but after an update (by our admins), it no longer works.
The error it throws in the Jenkins console is...
No signature of method: org.jfrog.hudson.ArtifactoryBuilder$DescriptorImpl.getArtifactoryServers() is applicable for argument types: () values: []
Could someone point me in the direction of any documentation as I've tried searching for the getArtifactoryServers method and can't seem to find anything.
Versions:
- Jenkins 2.289.1
- Artifactory Plugin 3.11.4
- Job DSL 1.77
Thanks in advance!
Solution
Looks like you are running an internal Jenkins Artifactory plugin code.
getArtifactoryServers
is recently changed to getJfrogInstances
.
I'm not sure what are you trying to do, but to get the same results as before, you should modify the script as following:
import jenkins.model.*
def instance = Jenkins.get()
def defaultServer = Jenkins.instance.getDescriptor('org.jfrog.hudson.ArtifactoryBuilder').getJfrogInstances()[0]
def jfrogInstanceId = defaultServer.getId()
def defaultArtifactoryUrl = defaultServer.getArtifactoryUrl()
def defaultArtifactoryCredId = defaultServer.getDeployerCredentialsConfig().getCredentialsId()
Answered By - yahavi