spinnaker: Igor unable to fetch jobs from Jenkins after Jenkins Integration
Spinnaker is unable to display the job list from jenkins
Cloud Provider
AWS
Environment
We have installed Spinnaker using the Spinnaker-Ubuntu-14.04-22 - ami-4b35d42b image and deployed to an AWS instance.
Feature Area
Igor,Jenkins
Description
When we add a trigger,jobs should be populated in the job list dropdown when we select jenkins as the master.Jobs are present in jenkins but are not displayed in UI.
Steps to Reproduce
We have completed all the steps as described in the hello-spinnaker example below.We have used the AWS spinnaker image to directly configure spinnaker in AWS.
www.spinnaker.io/docs/hello-spinnaker.
I am trying to create a sample pipeline as noted in the above example.But while I create trigger in the first step and select jenkins ,the jobs are not getting populated and am getting below error in browser.
GET http://localhost:8084/v2/builds/Jenkins/jobs 429 (Too Many Requests)
The actual issue looks like while retrofit is trying to map the response from jenkins getjobs into the JobList class its finding an attribute _class in jenkins response xml and which is not present in JobList groovy class.Below is how we tried finding the issue
1)Login to AWS Spinnaker instance
2)Gate service is exposed at port 8084. curl http://localhost:8084/v2/builds/Jenkins/jobs.
{“failureCause”:“retrofit.RetrofitError: 429 Too Many Requests”,“error”:“Too Many Requests”,“message”:“429 Too Many Requests”,“status”:429,“url”:“http://localhost:8088/jobs/Jenkins","timestamp”:1462793944530}
3)Igor service is exposed at port 8088. curl http://localhost:8088/jobs/Jenkins
{“fallbackException”:“java.lang.UnsupportedOperationException: No fallback available.”,“failureType”:“COMMAND_EXCEPTION”,“failureCause”:“retrofit.converter.ConversionException: org.simpleframework.xml.core.AttributeException: Attribute ‘_class’ does not have a match in class com.netflix.spinnaker.igor.jenkins.client.model.JobList at line 1”,“error”:“Hystrix Failure”,“message”:“jenkins-Jenkins-getJobs failed and no fallback available.”,“status”:429,“timestamp”:1462793896853}
When I check in the igor logs,there are few exceptions which are occuring during the getprojects by jenkins poll
Caused by: retrofit.converter.ConversionException: org.simpleframework.xml.core.AttributeException: Attribute ‘_class’ does not have a match in class com.netflix.spinnaker.igor.jenkins.client.model.ProjectsList at line 2 at retrofit.converter.SimpleXMLConverter.fromBody(SimpleXMLConverter.java:38) at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:367) … 39 common frames omitted Caused by: org.simpleframework.xml.core.AttributeException: Attribute ‘_class’ does not have a match in class com.netflix.spinnaker.igor.jenkins.client.model.ProjectsList at line 2
4)Connect to jenkins and get the jobs as its being done in spinnaker code https://github.com/spinnaker/igor/blob/master/igor-web/src/main/groovy/com/netflix/spinnaker/igor/jenkins/client/JenkinsClient.groovy
resp = requests.get(‘http://jenkinserverip:8080/api/xml?tree=jobs[name,jobs[name,jobs[name,jobs[name,jobs[name,jobs[name,jobs[name,jobs[name,jobs[name,jobs[name]]]]]]]]]]’,auth=(‘admin’,‘password’)) print resp.text
<hudson` _class='hudson.model.Hudson'><job _class='hudson.model.FreeStyleProject'><name>Hello Build</name></job><job _class='hudson.model.FreeStyleProject'><name>Hello `Poll</name></job></hudson>
So as the jenkins response is having the _class attribute ,retrofit is throwing an error at this line http://grepcode.com/file/repo1.maven.org/maven2/com.squareup.retrofit/retrofit/1.9.0/retrofit/RestAdapter.java#383
How can we fix this issue ?
Can the code be updated by adding @Root(strict=false) in the ProjectsList and JobList classes ?
Additional Details
Additional information such as screenshots and exception logs.

About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 28 (3 by maintainers)
@tomaslin @sncitom3 @priteshmehta
To solve this I went to Configure Global Security and set:
Created my user and then provided those credentials to Spinnaker
Originally when deploying it was set to “Delegate to servlet container”. Even though I had created a user Spinnaker could not access Jobs this way.
To debug I disabled security and Spinnaker was able to retrieve jobs. I then set security back how it was and tried to curl using basic auth and I could not access Jenkins even through that.
Yesterday, I found out the reason of the issue in my case. I had 200 code while using curl and 429 while trying to fetch Jenkins jobs in Spinnaker UI. The issue occurred due to empty list of jobs in Jenkins. Once I integrated Jenkins and Spinnaker I’ve tested the integration with creating new Jenkins step in Spinnaker pipeline. As there were no jobs in Jenkins, I expected to see empty list of jobs in Spinnaker without any errors in web console, but got 429. However, this error has disappeared as soon as the new job (simple freestyle project) has been created in Jenkins and Spinnaker’s successfully fetched it. I’m not sure but it seems to be Igor does not expect Jenkins job list to be white clean and can not process an empty Jenkins reply
I got this fixed by configuring tomcat to allow special characters requested in Igor’s request. Specifically [ ]. This is specific to Jenkins server running on tomcat. It has been discussed here
Open $TOMCAT_HOME/conf/server.xml and append relaxedQueryChars=“[,]” after <Connector port=“80”:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" relaxedQueryChars="[,]" />