Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top