jenkins_launcher 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ v0.1.1 [14-JAN-2013]
5
+ ---------------------
6
+ * Added option to specify which node the Job should run.
7
+ * Minor usability tweaks to print success messages if operation completed successfully.
8
+
4
9
  v0.1.0 [13-JAN-2013]
5
10
  ---------------------
6
11
  * Added options for source control management: Git and Subversion.
@@ -1,7 +1,7 @@
1
1
  name: test_build_kannan_svn
2
2
  svn: https://src.chromium.org/chrome/trunk/src/chrome/common/extensions/docs/examples/tutorials/getstarted/
3
3
  ref: master
4
- shell_command:
4
+ script:
5
5
  - echo "first echo"
6
6
  - sleep 10
7
7
  - echo "second echo"
data/config/sample.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  name: test_build_kannan
2
- shell_command:
2
+ node: slave
3
+ script:
3
4
  - echo "first echo"
4
5
  - sleep 10
5
6
  - echo "second echo"
@@ -88,5 +88,13 @@ module JenkinsLauncher
88
88
  @client.toggle_debug if debug_changed
89
89
  end
90
90
 
91
+ def use_node(job_name, node_name)
92
+ if @client.node.list.include?(node_name)
93
+ @client.job.restrict_to_node(job_name, node_name)
94
+ else
95
+ puts "Node '#{node_name}' is not found on Jenkins server. Skipping...".yellow
96
+ end
97
+ end
98
+
91
99
  end
92
100
  end
@@ -68,6 +68,8 @@ module JenkinsLauncher
68
68
  params = @config.load_config(config_file)
69
69
  unless @api.job_exists?(params[:name])
70
70
  @api.create_job(params)
71
+ @api.use_node(params[:name], params[:node]) if params[:node]
72
+ puts "The Job '#{params[:name]}' is created successfully.".green
71
73
  else
72
74
  puts "The job is already created. Please use 'start' command to build the job.".yellow
73
75
  end
@@ -79,7 +81,10 @@ module JenkinsLauncher
79
81
  method_option :delete_after, :type => :boolean, :aliases => "-d", :desc => "Delete the job from Jenkins after the build is finished"
80
82
  def start(config_file)
81
83
  params = @config.load_config(config_file)
82
- @api.create_job(params) unless @api.job_exists?(params[:name])
84
+ unless @api.job_exists?(params[:name])
85
+ @api.create_job(params)
86
+ @api.use_node(params[:name], params[:node]) if params[:node]
87
+ end
83
88
  unless @api.job_building?(params[:name])
84
89
  @api.build_job(params[:name])
85
90
  quiet_period = options[:quiet_period] ? options[:quiet_period] : 5
@@ -149,6 +154,7 @@ module JenkinsLauncher
149
154
  else
150
155
  @api.stop_job(params[:name]) if options[:force] && @api.job_building?(params[:name])
151
156
  @api.delete_job(params[:name])
157
+ puts "The job '#{params[:name]}' is destroyed successfully.".green
152
158
  end
153
159
  end
154
160
 
@@ -39,6 +39,9 @@ module JenkinsLauncher
39
39
  raise "'name' is required and not set in the yml file." unless loaded_params['name']
40
40
  valid_params[:name] = loaded_params['name']
41
41
 
42
+ # Node to restrict the job to
43
+ valid_params[:node] = loaded_params['node'] if loaded_params['node']
44
+
42
45
  # Source control
43
46
  # Git, Subversion
44
47
  if loaded_params['git']
@@ -23,7 +23,7 @@
23
23
  module JenkinsLauncher
24
24
  MAJOR = 0
25
25
  MINOR = 1
26
- TINY = 0
26
+ TINY = 1
27
27
  PRE = nil
28
28
  VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-13 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jenkins_api_client