Jenkins adding a new view using gem jenkins_api_client

937 Views Asked by At

I am new to jenkins. I would like to add a new view in jenkins using ruby gem jenkins_api_client. Can anyone help me with a small example using that gem for adding a new view?

1

There are 1 best solutions below

0
On BEST ANSWER

I was able to do it by using the following code

require "jenkins_api_client"
@client = JenkinsApi::Client.new(:server_url => 'http://ip:port/jenkins/')
@client.view.create_list_view(:name => "NewView")

Previously, I was using :server_ip and since I had jenkins prefix in the url , I was getting an error. but using :server_url solved it.

May be it helps someone.