-
Bug
-
Resolution: Unresolved
-
Major
-
None
I'm trying to create a Build Pipeline View using the jenkins_api_client Ruby client. As far as I can tell, it's essentially POSTing JSON to Jenkins, which it uses to instantiate Java objects. This seems to work fine for many views, but not the Build Pipeline View.
The Ruby code I have is:
require 'jenkins_api_client'
@client = JenkinsApi::Client.new(:server_ip => '127.0.0.1')
json = {
'name' => 'sub view',
'mode' => 'au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView',
'buildViewTitle' => 'sub view',
'description' => "Pipeline view of a project project",
'gridBuilder' => {
'firstjob' => 'something',
},
}initial_post_params = {
"name" => 'sub view',
"mode" => 'au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView',
"json" => json.to_json,
}
begin
@client.api_post_request("/createView", initial_post_params)
rescue JenkinsApi::Exceptions::ViewAlreadyExists => e
puts "Didn't create the view because it already exists\n"
return nil
end
return true
When run I get a "500 server error" from Jenkins and I get a huge stack trace in the Jenkins server.log, which ends with:
Caused by: java.lang.IllegalArgumentException: Failed to instantiate class au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView from {"name":"sub view","mode":"au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView","buildViewTitle":"sub view","description":"Pipeline view of a project project","gridBuilder":{"firstjob":"something"}}
at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:589)
at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400)
at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:396)
at hudson.model.Descriptor.newInstance(Descriptor.java:567)
... 55 more
Caused by: java.lang.IllegalArgumentException: Failed to convert the gridBuilder parameter of the constructor public au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView(java.lang.String,java.lang.String,au.com.centrumsystems.hudson.plugin.buildpipeline.ProjectGridBuilder,java.lang.String,boolean,boolean,boolean,boolean,boolean,int,java.lang.String)
at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:686)
at org.kohsuke.stapler.RequestImpl.access$100(RequestImpl.java:81)
at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:587)
... 58 more
Caused by: java.lang.IllegalArgumentException: Failed to instantiate class au.com.centrumsystems.hudson.plugin.buildpipeline.ProjectGridBuilder from {"firstjob":"something"}
at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:589)
at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400)
at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:684)
... 60 more
Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class au.com.centrumsystems.hudson.plugin.buildpipeline.ProjectGridBuilder
at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:176)
at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:671)
at org.kohsuke.stapler.RequestImpl.access$100(RequestImpl.java:81)
at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:587)
... 62 more
This looks like Jenkins is unable to instantiate the ProjectGridBuilder class based on the JSON I've supplied.
Is my JSON wrong, is the Ruby API client doing something funky or is ProjectGridBuilder at fault here?
For what it's worth, I tried version 1.3.0, which pre-dates the ProjectGridBuilder code, and it works fine. Sadly, I can't downgrade to it permanently though
Any help much appreciated!