Hi All,
Problem statement:
Jenkins build must be automated i.e Given a branch as input to the script, the script must do Jenkins build with the specified git branch .
I have to build a project in Jenkins with varying configurations. (Configurations should be changed dynamically for each job - through passing parameters)
So, to achieve this , I am using " jenkins_api_client " which helps me to build a specified job :
Example :
test_job = "some_test_job"
code = @client.job.build(test_job) . This will build successfully with default configuration, but I have to override this configuration and pass the branch name as parameter and build the project.
I tried something like this :
test_job = "some_test_job"
params={}
params[:scm_branch] = "some_branch_name"
code = @client.job.build(test_job, params)
This gives me :
INFO : Building job 'some_test_job' with parameters: {:branch=>"some_branch_name"}
ERROR -- : JenkinsApi::Exceptions::InternalServerError: Internal Server Error. Perhaps the in-memory configuration Jenkins is different from the disk configuration. Please try to reload the configuration
(JenkinsApi::Exceptions::InternalServerError)
from /Users/yj051292/.rvm/gems/ruby-2.4.0@global/gems/jenkins_api_client-1.4.5/lib/jenkins_api_client/client.rb:405:in `api_post_request'
from /Users/yj051292/.rvm/gems/ruby-2.4.0@global/gems/jenkins_api_client-1.4.5/lib/jenkins_api_client/job.rb:858:in `build'
from jenkins_test.rb:47:in `<main>'
Is there anything wrong in passing the parameters ? Can anyone help me in building a project with parameters from the script ?
Please post an example of building with parameters.
Any thoughts and suggestions are much appreciated. Thank you .