Skip to content

Instantly share code, notes, and snippets.

@anuragmathur1
Created April 13, 2018 05:34

Revisions

  1. Anurag Mathur created this gist Apr 13, 2018.
    8 changes: 8 additions & 0 deletions run_remote_jenkins_job.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    require 'jenkins_api_client'
    SERVER_IP = 'jenkins.dev.example.com'
    $build = JenkinsApi::Client.new(:server_ip => "#{SERVER_IP}",:username => 'admin', :password => 'admin')
    $opts = {'build_start_timeout' => 60, 'cancel_on_build_start_timeout' => true}
    $build.job.build("test-project",{:parameter1=>"value-1",\
    :parameter2=>"value-2",\
    :parameter3=>"value-3",\
    :parameter4=>"value-4"} || {}, $opts)