jenkins_pipeline_builder 1.6.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +22 -3
  3. data/.rubocop_todo.yml +0 -6
  4. data/.travis.yml +0 -1
  5. data/Dockerfile +30 -0
  6. data/README.md +1 -0
  7. data/jenkins_pipeline_builder.gemspec +5 -8
  8. data/lib/jenkins_pipeline_builder.rb +2 -2
  9. data/lib/jenkins_pipeline_builder/cli/describe.rb +0 -2
  10. data/lib/jenkins_pipeline_builder/cli/helper.rb +3 -2
  11. data/lib/jenkins_pipeline_builder/cli/list.rb +2 -1
  12. data/lib/jenkins_pipeline_builder/cli/pipeline.rb +5 -4
  13. data/lib/jenkins_pipeline_builder/compiler.rb +15 -2
  14. data/lib/jenkins_pipeline_builder/extension_set.rb +5 -1
  15. data/lib/jenkins_pipeline_builder/extensions.rb +6 -2
  16. data/lib/jenkins_pipeline_builder/extensions/build_steps.rb +1 -1
  17. data/lib/jenkins_pipeline_builder/extensions/helpers/job_attributes/parameters_helper.rb +2 -2
  18. data/lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb +1 -0
  19. data/lib/jenkins_pipeline_builder/extensions/job_attributes.rb +24 -0
  20. data/lib/jenkins_pipeline_builder/extensions/publishers.rb +26 -1
  21. data/lib/jenkins_pipeline_builder/extensions/wrappers.rb +2 -1
  22. data/lib/jenkins_pipeline_builder/generator.rb +7 -2
  23. data/lib/jenkins_pipeline_builder/job.rb +3 -0
  24. data/lib/jenkins_pipeline_builder/job_collection.rb +5 -3
  25. data/lib/jenkins_pipeline_builder/module_registry.rb +4 -0
  26. data/lib/jenkins_pipeline_builder/promotion.rb +1 -0
  27. data/lib/jenkins_pipeline_builder/pull_request_generator.rb +12 -11
  28. data/lib/jenkins_pipeline_builder/remote_dependencies.rb +2 -2
  29. data/lib/jenkins_pipeline_builder/utils.rb +12 -7
  30. data/lib/jenkins_pipeline_builder/version.rb +1 -1
  31. data/lib/jenkins_pipeline_builder/view.rb +3 -1
  32. data/spec/lib/jenkins_pipeline_builder/cli/helper_spec.rb +1 -1
  33. data/spec/lib/jenkins_pipeline_builder/compiler_spec.rb +1 -1
  34. data/spec/lib/jenkins_pipeline_builder/extension_dsl_spec.rb +1 -1
  35. data/spec/lib/jenkins_pipeline_builder/extension_set_spec.rb +3 -3
  36. data/spec/lib/jenkins_pipeline_builder/extensions/build_steps_spec.rb +1 -1
  37. data/spec/lib/jenkins_pipeline_builder/extensions/builders_spec.rb +6 -6
  38. data/spec/lib/jenkins_pipeline_builder/extensions/job_attributes_spec.rb +1 -1
  39. data/spec/lib/jenkins_pipeline_builder/extensions/promotion_conditions_spec.rb +1 -1
  40. data/spec/lib/jenkins_pipeline_builder/extensions/publishers_spec.rb +28 -11
  41. data/spec/lib/jenkins_pipeline_builder/extensions/registered_spec.rb +3 -1
  42. data/spec/lib/jenkins_pipeline_builder/extensions/triggers_spec.rb +1 -1
  43. data/spec/lib/jenkins_pipeline_builder/extensions/wrappers_spec.rb +1 -1
  44. data/spec/lib/jenkins_pipeline_builder/extensions_spec.rb +1 -1
  45. data/spec/lib/jenkins_pipeline_builder/fixtures/generator_tests/pullrequest_pipeline/project.yaml +1 -0
  46. data/spec/lib/jenkins_pipeline_builder/generator_spec.rb +90 -36
  47. data/spec/lib/jenkins_pipeline_builder/job_collection_spec.rb +2 -2
  48. data/spec/lib/jenkins_pipeline_builder/job_spec.rb +1 -1
  49. data/spec/lib/jenkins_pipeline_builder/module_registry_spec.rb +1 -1
  50. data/spec/lib/jenkins_pipeline_builder/promotion_spec.rb +1 -1
  51. data/spec/lib/jenkins_pipeline_builder/pull_request_generator_spec.rb +16 -16
  52. data/spec/lib/jenkins_pipeline_builder/spec_helper.rb +1 -1
  53. data/spec/lib/jenkins_pipeline_builder/utils_spec.rb +1 -1
  54. data/spec/lib/jenkins_pipeline_builder/view_spec.rb +2 -2
  55. data/spec/requests/pipeline_spec.rb +1 -1
  56. metadata +20 -20
@@ -2,6 +2,7 @@ class CoberturaReportHelper < ExtensionHelper
2
2
  def thresholds
3
3
  @thresholds ||= params[:metric_targets]
4
4
  return @thresholds if @thresholds
5
+
5
6
  @thresholds = {
6
7
  failing: [
7
8
  { type: 'type', value: 0 },
@@ -227,6 +227,7 @@ job_attribute do
227
227
  if params[:changelog_to_branch]
228
228
  opts = params[:changelog_to_branch]
229
229
  raise 'remote and branch are required for changelog_to_branch' unless opts[:remote] && opts[:branch]
230
+
230
231
  send('hudson.plugins.git.extensions.impl.ChangelogToBranch') do
231
232
  options do
232
233
  compareRemote opts[:remote]
@@ -264,6 +265,29 @@ job_attribute do
264
265
  end
265
266
  end
266
267
 
268
+ job_attribute do
269
+ name :google_chat
270
+ plugin_id 'google-chat-notification'
271
+ description 'This plugin allows your team to setup build notifications to be sent to Google Chat rooms.'
272
+ jenkins_name 'Google Chat Notification'
273
+ announced false
274
+
275
+ xml path: '//properties' do |params|
276
+ send('io.cnaik.GoogleChatNotification', 'plugin' => 'google-chat-notification') do
277
+ url params[:url] || ''
278
+ notifyAborted params[:notifyAborted] || false
279
+ notifyFailure params[:notifyFailure] || false
280
+ notifyNotBuilt params[:notifyNotBuilt] || false
281
+ notifySuccess params[:notifySuccess] || false
282
+ notifyUnstable params[:notifyUnstable] || false
283
+ notifyBackToNormal params[:notifyBackToNormal] || false
284
+ suppressInfoLoggers params[:suppressInfoLoggers] || false
285
+ sameThreadNotification params[:sameThreadNotification] || false
286
+ message params[:message] || ''
287
+ end
288
+ end
289
+ end
290
+
267
291
  job_attribute do
268
292
  name :hipchat
269
293
  plugin_id 'hipchat'
@@ -72,6 +72,32 @@ publisher do
72
72
  end
73
73
  end
74
74
 
75
+ publisher do
76
+ name :google_chat
77
+ plugin_id 'google-chat-notification'
78
+ description 'This plugin allows your team to setup build notifications to be sent to Google Chat rooms.'
79
+ jenkins_name 'Google Chat Notification'
80
+ announced false
81
+
82
+ version '0' do
83
+ xml do |params|
84
+ params = {} if params == true
85
+ send('io.cnaik.GoogleChatNotification') do
86
+ url params[:url] || ''
87
+ message params[:message] || ''
88
+ notifyAborted params[:notifyAborted] || false
89
+ notifyFailure params[:notifyFailure] || false
90
+ notifyNotBuilt params[:notifyNotBuilt] || false
91
+ notifySuccess params[:notifySuccess] || false
92
+ notifyUnstable params[:notifyUnstable] || false
93
+ notifyBackToNormal params[:notifyBackToNormal] || false
94
+ suppressInfoLoggers params[:suppressInfoLoggers] || false
95
+ sameThreadNotification params[:sameThreadNotification] || false
96
+ end
97
+ end
98
+ end
99
+ end
100
+
75
101
  publisher do
76
102
  name :hipchat
77
103
  plugin_id 'hipchat'
@@ -382,7 +408,6 @@ publisher do
382
408
  xml do |params|
383
409
  send('hudson.plugins.sonar.SonarPublisher') do
384
410
  jdk params[:jdk] || '(Inherit From Job)'
385
- branch params[:branch] || ''
386
411
  language
387
412
  mavenOpts
388
413
  jobAdditionalProperties params[:additional_properties] || ''
@@ -26,7 +26,6 @@ wrapper do
26
26
  announced false
27
27
  jenkins_name 'Color ANSI Console Output'
28
28
  description 'This plugin adds support for ANSI escape sequences, including color, to Console Output.'
29
-
30
29
  xml do |_|
31
30
  send('hudson.plugins.ansicolor.AnsiColorBuildWrapper') do
32
31
  colorMapName 'xterm'
@@ -99,6 +98,7 @@ wrapper do
99
98
  passwords = wrapper
100
99
  end
101
100
  break unless passwords
101
+
102
102
  passwordEntries do
103
103
  passwords.each do |password|
104
104
  EnvInjectPasswordEntry do
@@ -148,6 +148,7 @@ wrapper do
148
148
  resolvePattern
149
149
  matrixParams wrapper[:properties]
150
150
  deployBuildInfo wrapper[:'publish-build-info']
151
+ useSpecs false
151
152
  includeEnvVars false
152
153
  envVarsPatterns do
153
154
  includePatterns
@@ -56,7 +56,7 @@ module JenkinsPipelineBuilder
56
56
  publish(project_name || job_collection.projects.first[:name])
57
57
  end
58
58
 
59
- def pull_request(path, project_name)
59
+ def pull_request(path, project_name, base_branch_only = false)
60
60
  logger.info "Pull Request Generator Running from path #{path}"
61
61
  load_job_collection path unless job_collection.loaded?
62
62
  defaults = job_collection.defaults[:value]
@@ -64,7 +64,9 @@ module JenkinsPipelineBuilder
64
64
  pr_generator.delete_closed_prs
65
65
  errors = []
66
66
  pr_generator.open_prs.each do |pr|
67
- pr_generator.convert! job_collection, pr
67
+ next if base_branch_only && defaults[:git_branch] != pr[:base]
68
+
69
+ pr_generator.convert! job_collection, pr[:number]
68
70
  error = publish(project_name)
69
71
  errors << error unless error.empty?
70
72
  end
@@ -102,6 +104,7 @@ module JenkinsPipelineBuilder
102
104
  def resolve_job_by_name(name, settings = {})
103
105
  job = job_collection.get_item(name)
104
106
  raise "Failed to locate job by name '#{name}'" if job.nil?
107
+
105
108
  job_value = job[:value]
106
109
  logger.debug "Compiling job #{name}"
107
110
  compiler = JenkinsPipelineBuilder::Compiler.new self
@@ -211,6 +214,7 @@ module JenkinsPipelineBuilder
211
214
  # A hash of promoted_builds names => associated job names
212
215
  promotion_job_pairs = jobs.each_with_object({}) do |j, acc|
213
216
  next unless j[:result][:promoted_builds]
217
+
214
218
  j[:result][:promoted_builds].each do |promotion_name|
215
219
  acc[promotion_name] = j[:result][:name]
216
220
  end
@@ -235,6 +239,7 @@ module JenkinsPipelineBuilder
235
239
  logger.info "Processing #{i}"
236
240
  job = i[:result]
237
241
  raise "Result is empty for #{i}" if job.nil?
242
+
238
243
  job = Job.new job
239
244
  success, payload = job.create_or_update
240
245
  errors[job.name] = payload unless success
@@ -17,6 +17,7 @@ module JenkinsPipelineBuilder
17
17
  def create_or_update
18
18
  success, payload = to_xml
19
19
  return success, payload unless success
20
+
20
21
  xml = payload
21
22
  return local_output(xml) if JenkinsPipelineBuilder.debug || JenkinsPipelineBuilder.file_mode
22
23
 
@@ -31,6 +32,7 @@ module JenkinsPipelineBuilder
31
32
  job[:job_type] = 'free_style' unless job[:job_type]
32
33
  type = job[:job_type]
33
34
  return false, "Job type: #{type} is not one of #{job_methods.join(', ')}" unless known_type? type
35
+
34
36
  @xml = setup_freestyle_base(job)
35
37
  payload = send("update_#{type}")
36
38
 
@@ -109,6 +111,7 @@ module JenkinsPipelineBuilder
109
111
  if params.key?(:template)
110
112
  template_name = params[:template]
111
113
  raise "Job template '#{template_name}' can't be resolved." unless @job_templates.key?(template_name)
114
+
112
115
  params.delete(:template)
113
116
  template = @job_templates[template_name]
114
117
  params = template.deep_merge(params)
@@ -75,8 +75,8 @@ module JenkinsPipelineBuilder
75
75
  hash.each do |section|
76
76
  load_section section, remote
77
77
  end
78
- rescue StandardError => err
79
- raise CustomErrors::ParseError.new err.message, path
78
+ rescue StandardError => e
79
+ raise CustomErrors::ParseError.new e.message, path
80
80
  end
81
81
 
82
82
  def load_section(section, remote)
@@ -108,6 +108,7 @@ module JenkinsPipelineBuilder
108
108
  # skip if the existing item is local and the new item is remote
109
109
  return if remote && !existing_remote
110
110
  raise "Duplicate item with name '#{name}' was detected." unless existing_remote && !remote
111
+
111
112
  # override if the existing item is remote and the new is local
112
113
  logger.info "Duplicate item with name '#{name}' was detected from the remote folder."
113
114
  end
@@ -118,9 +119,10 @@ module JenkinsPipelineBuilder
118
119
  path = "#{path}/extensions"
119
120
  path = File.expand_path(path, Dir.getwd)
120
121
  return unless File.directory?(path)
122
+
121
123
  logger.info "Loading extensions from folder #{path}"
122
124
  logger.info Dir.glob("#{path}/*.rb").inspect
123
- Dir.glob("#{path}/**/*.rb").each do |file|
125
+ Dir.glob("#{path}/**/*.rb").sort.each do |file|
124
126
  logger.info "Loaded #{file}"
125
127
  require file
126
128
  end
@@ -29,6 +29,7 @@ module JenkinsPipelineBuilder
29
29
  def versions
30
30
  # Return a hash with a default of 1000 so that we'll get the newest in debug
31
31
  return Hash.new { |_| '1000.0' } if JenkinsPipelineBuilder.debug
32
+
32
33
  @versions ||= JenkinsPipelineBuilder.client.plugin.list_installed
33
34
  end
34
35
 
@@ -77,6 +78,7 @@ module JenkinsPipelineBuilder
77
78
  def get_by_path_collection(path, registry)
78
79
  item = registry[path.shift.to_sym]
79
80
  return item if path.count == 0
81
+
80
82
  get_by_path_collection(path, item)
81
83
  end
82
84
 
@@ -88,8 +90,10 @@ module JenkinsPipelineBuilder
88
90
  def traverse_registry(registry, params, n_xml, strict = false)
89
91
  params.each do |key, value|
90
92
  next unless registry.is_a? Hash
93
+
91
94
  unless registry.key? key
92
95
  raise TypeError, "!!!! could not find key #{key} !!!!" if strict
96
+
93
97
  next
94
98
  end
95
99
  reg_value = registry[key]
@@ -31,6 +31,7 @@ module JenkinsPipelineBuilder
31
31
  def create(params, job_name)
32
32
  success, payload = prom_to_xml(params)
33
33
  return success, payload unless success
34
+
34
35
  xml = payload
35
36
  return local_output(xml) if JenkinsPipelineBuilder.debug || JenkinsPipelineBuilder.file_mode
36
37
 
@@ -29,32 +29,33 @@ module JenkinsPipelineBuilder
29
29
  @open_prs = active_prs defaults[:github_site], defaults[:git_org], defaults[:git_repo_name]
30
30
  end
31
31
 
32
- def convert!(job_collection, pr)
33
- job_collection.defaults[:value][:application_name] = "#{application_name}-PR#{pr}"
34
- job_collection.defaults[:value][:pull_request_number] = pr.to_s
35
- job_collection.jobs.each { |j| override j[:value], pr }
32
+ def convert!(job_collection, pr_number)
33
+ job_collection.defaults[:value][:application_name] = "#{application_name}-PR#{pr_number}"
34
+ job_collection.defaults[:value][:pull_request_number] = pr_number.to_s
35
+ job_collection.jobs.each { |j| override j[:value], pr_number }
36
36
  end
37
37
 
38
38
  def delete_closed_prs
39
39
  return if JenkinsPipelineBuilder.debug
40
+
40
41
  jobs_to_delete = JenkinsPipelineBuilder.client.job.list "^#{application_name}-PR(\\d+)-(.*)$"
41
- open_prs.each do |n|
42
- jobs_to_delete.reject! { |j| j.start_with? "#{application_name}-PR#{n}" }
42
+ open_prs.each do |pr|
43
+ jobs_to_delete.reject! { |j| j.start_with? "#{application_name}-PR#{pr[:number]}" }
43
44
  end
44
45
  jobs_to_delete.each { |j| JenkinsPipelineBuilder.client.job.delete j }
45
46
  end
46
47
 
47
48
  private
48
49
 
49
- def override(job, pr)
50
+ def override(job, pr_number)
50
51
  git_version = JenkinsPipelineBuilder.registry.registry[:job][:scm_params].installed_version
51
- job[:scm_branch] = "origin/pr/#{pr}/head"
52
+ job[:scm_branch] = "origin/pr/#{pr_number}/head"
52
53
  job[:scm_params] ||= {}
53
- job[:scm_params][:refspec] = "refs/pull/#{pr}/head:refs/remotes/origin/pr/#{pr}/head"
54
+ job[:scm_params][:refspec] = "refs/pull/#{pr_number}/head:refs/remotes/origin/pr/#{pr_number}/head"
54
55
  job[:scm_params][:changelog_to_branch] ||= {}
55
56
  if Gem::Version.new(2.0) < git_version
56
57
  job[:scm_params][:changelog_to_branch]
57
- .merge!(remote: 'origin', branch: "pr/#{pr}/head")
58
+ .merge!(remote: 'origin', branch: "pr/#{pr_number}/head")
58
59
  end
59
60
  end
60
61
 
@@ -66,7 +67,7 @@ module JenkinsPipelineBuilder
66
67
  begin
67
68
  resp = Net::HTTP.get_response(URI.parse(url))
68
69
  pulls = JSON.parse(resp.body)
69
- pulls.map { |p| p['number'] }
70
+ pulls.map { |p| { number: p['number'], base: p['base']['ref'] } }
70
71
  rescue StandardError
71
72
  raise 'Failed connecting to github!'
72
73
  end
@@ -88,8 +88,8 @@ module JenkinsPipelineBuilder
88
88
  def download_yaml(url, file, remote_opts = {})
89
89
  entries[url] = file
90
90
  logger.info "Downloading #{url} to #{file}.tar"
91
- open("#{file}.tar", 'w') do |local_file|
92
- open(url, remote_opts) do |remote_file|
91
+ File.open("#{file}.tar", 'w') do |local_file|
92
+ URI.parse(url).open(remote_opts) do |remote_file|
93
93
  local_file.write(Zlib::GzipReader.new(remote_file).read)
94
94
  end
95
95
  end
@@ -30,14 +30,19 @@ end
30
30
  module JenkinsPipelineBuilder
31
31
  class Utils
32
32
  # Code was duplicated from jeknins_api_client
33
- def self.symbolize_keys_deep!(h)
34
- return unless h.is_a?(Hash)
35
- h.keys.each do |k|
36
- ks = k.respond_to?(:to_sym) ? k.to_sym : k
37
- h[ks] = h.delete k # Preserve order even when k == ks
38
- symbolize_keys_deep! h[ks] if h[ks].is_a? Hash
39
- h[ks].each { |item| symbolize_keys_deep!(item) } if h[ks].is_a?(Array)
33
+ def self.symbolize_keys_deep!(to_symbolize)
34
+ return unless to_symbolize.is_a?(Hash)
35
+
36
+ # This lint is disabled here because each_key requires that you not add or remove keys
37
+ # during iteration, which apparently this block does...
38
+ # rubocop:disable Style/HashEachMethods
39
+ to_symbolize.keys.each do |k|
40
+ ks = k.respond_to?(:to_sym) ? k.to_sym : k
41
+ to_symbolize[ks] = to_symbolize.delete k # Preserve order even when k == ks
42
+ symbolize_keys_deep! to_symbolize[ks] if to_symbolize[ks].is_a? Hash
43
+ to_symbolize[ks].each { |item| symbolize_keys_deep!(item) } if to_symbolize[ks].is_a?(Array)
40
44
  end
45
+ # rubocop:enable Style/HashEachMethods
41
46
  end
42
47
 
43
48
  def self.symbolize_with_empty_hash!(array_of_maybe_str)
@@ -21,5 +21,5 @@
21
21
  #
22
22
 
23
23
  module JenkinsPipelineBuilder
24
- VERSION = '1.6.0'.freeze
24
+ VERSION = '1.10.0'.freeze
25
25
  end
@@ -67,6 +67,7 @@ module JenkinsPipelineBuilder
67
67
  def create(params)
68
68
  # Name is a required parameter. Raise an error if not specified
69
69
  raise ArgumentError, 'Name is required for creating view' unless params.is_a?(Hash) && params[:name]
70
+
70
71
  clean_up_views(params) unless JenkinsPipelineBuilder.debug
71
72
  params[:type] ||= 'listview'
72
73
  create_base_view(params[:name], params[:type], params[:parent_view])
@@ -133,7 +134,8 @@ module JenkinsPipelineBuilder
133
134
  'dashboardView' => 'hudson.plugins.view.dashboard.Dashboard',
134
135
  'multijobView' => 'com.tikal.jenkins.plugins.multijob.views.MultiJobView'
135
136
  }
136
- raise "Type #{type} is not supported by Jenkins." unless types.keys.include? type
137
+ raise "Type #{type} is not supported by Jenkins." unless types.key?(type)
138
+
137
139
  types[type]
138
140
  end
139
141
 
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
1
+ require File.expand_path('../spec_helper', __dir__)
2
2
 
3
3
  describe JenkinsPipelineBuilder::CLI::Helper do
4
4
  file_suffixes = JenkinsPipelineBuilder::CLI::Helper::DEFAULT_FILE_FORMATS
@@ -1,4 +1,4 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ require File.expand_path('spec_helper', __dir__)
2
2
  describe JenkinsPipelineBuilder::Compiler do
3
3
  before :all do
4
4
  JenkinsPipelineBuilder.credentials = {
@@ -1,4 +1,4 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ require File.expand_path('spec_helper', __dir__)
2
2
 
3
3
  describe 'extension dsl' do
4
4
  before :all do
@@ -1,7 +1,7 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ require File.expand_path('spec_helper', __dir__)
2
2
 
3
3
  describe JenkinsPipelineBuilder::ExtensionSet do
4
- subject(:set) { JenkinsPipelineBuilder::ExtensionSet.new('foo'){} }
4
+ subject(:set) { JenkinsPipelineBuilder::ExtensionSet.new('foo') {} }
5
5
 
6
6
  before :each do
7
7
  set.name 'example'
@@ -108,7 +108,7 @@ describe JenkinsPipelineBuilder::ExtensionSet do
108
108
  it 'works for snapshot/beta stuff' do
109
109
  ext_versions ['1.9', '2.3']
110
110
 
111
- set.installed_version = '2.0-SNAPSHOT (private-06/06/2014 09:51-bgaulin)'
111
+ set.installed_version = '2.0-SNAPSHOT'
112
112
  # Other examples
113
113
  # set.installed_version = '2.0-beta-1'
114
114
  # set.installed_version = '2.0+build.93'
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
1
+ require File.expand_path('../spec_helper', __dir__)
2
2
 
3
3
  describe 'build_steps' do
4
4
  after :each do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
1
+ require File.expand_path('../spec_helper', __dir__)
2
2
 
3
3
  describe 'builders' do
4
4
  after :each do
@@ -329,9 +329,9 @@ describe 'builders' do
329
329
 
330
330
  begin
331
331
  JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
332
- rescue RuntimeError => boom
333
- puts "Caught error #{boom}"
334
- error = boom.to_s
332
+ rescue RuntimeError => e
333
+ puts "Caught error #{e}"
334
+ error = e.to_s
335
335
  end
336
336
  builder = @n_xml.root.children.first
337
337
  expect(builder.name).to match 'hudson.plugins.groovy.SystemGroovy'
@@ -407,8 +407,8 @@ describe 'builders' do
407
407
  )
408
408
  begin
409
409
  JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
410
- rescue RuntimeError => err
411
- puts 'Runtime Error: ' + err.to_s
410
+ rescue RuntimeError => e
411
+ puts 'Runtime Error: ' + e.to_s
412
412
  end
413
413
  builder = @n_xml.root.children.first
414
414
  expect(builder.name).to match 'jenkins.plugins.nodejs.NodeJsCommandInterpreter'
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
1
+ require File.expand_path('../spec_helper', __dir__)
2
2
 
3
3
  describe 'job_attributes' do
4
4
  after :each do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
1
+ require File.expand_path('../spec_helper', __dir__)
2
2
 
3
3
  describe 'promotion_conditions' do
4
4
  after :each do