Skip to content

Instantly share code, notes, and snippets.

@anuragmathur1
Created April 13, 2018 05:34
Show Gist options
  • Save anuragmathur1/76811ee9a5850f8a94de13aa0ab9bd0c to your computer and use it in GitHub Desktop.
Save anuragmathur1/76811ee9a5850f8a94de13aa0ab9bd0c to your computer and use it in GitHub Desktop.
Example : Ruby script to invoke Jenkins job remotely
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment