jenkins_pipeline_builder 0.4.2 → 0.5.0

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +65 -0
  3. data/LICENSE +1 -1
  4. data/README.md +64 -2
  5. data/Rakefile +13 -11
  6. data/bin/generate +2 -4
  7. data/jenkins_pipeline_builder.gemspec +14 -11
  8. data/lib/jenkins_pipeline_builder.rb +2 -1
  9. data/lib/jenkins_pipeline_builder/builders.rb +89 -33
  10. data/lib/jenkins_pipeline_builder/cli/base.rb +21 -29
  11. data/lib/jenkins_pipeline_builder/cli/helper.rb +12 -15
  12. data/lib/jenkins_pipeline_builder/cli/pipeline.rb +6 -1
  13. data/lib/jenkins_pipeline_builder/cli/view.rb +2 -2
  14. data/lib/jenkins_pipeline_builder/compiler.rb +58 -56
  15. data/lib/jenkins_pipeline_builder/generator.rb +362 -172
  16. data/lib/jenkins_pipeline_builder/job_builder.rb +48 -45
  17. data/lib/jenkins_pipeline_builder/module_registry.rb +4 -6
  18. data/lib/jenkins_pipeline_builder/publishers.rb +53 -38
  19. data/lib/jenkins_pipeline_builder/pull_request.rb +156 -0
  20. data/lib/jenkins_pipeline_builder/triggers.rb +24 -25
  21. data/lib/jenkins_pipeline_builder/utils.rb +13 -7
  22. data/lib/jenkins_pipeline_builder/version.rb +2 -2
  23. data/lib/jenkins_pipeline_builder/view.rb +120 -98
  24. data/lib/jenkins_pipeline_builder/wrappers.rb +44 -44
  25. data/lib/jenkins_pipeline_builder/xml_helper.rb +4 -4
  26. data/spec/func_tests/spec_helper.rb +2 -2
  27. data/spec/func_tests/view_spec.rb +6 -6
  28. data/spec/unit_tests/compiler_spec.rb +7 -7
  29. data/spec/unit_tests/fixtures/files/Job-Gem-Build.xml +2 -2
  30. data/spec/unit_tests/fixtures/files/Job-Gem-Build.yaml +1 -0
  31. data/spec/unit_tests/fixtures/files/concurrent_build.xml +17 -0
  32. data/spec/unit_tests/fixtures/files/concurrent_build.yaml +4 -0
  33. data/spec/unit_tests/fixtures/files/downstream_blocking.xml +19 -0
  34. data/spec/unit_tests/fixtures/files/downstream_blocking.yaml +15 -0
  35. data/spec/unit_tests/fixtures/files/groovy_postbuild.xml +29 -0
  36. data/spec/unit_tests/fixtures/files/groovy_postbuild.yaml +9 -0
  37. data/spec/unit_tests/generator_spec.rb +30 -25
  38. data/spec/unit_tests/module_registry_spec.rb +9 -9
  39. data/spec/unit_tests/resolve_dependencies_spec.rb +108 -89
  40. data/spec/unit_tests/spec_helper.rb +1 -1
  41. metadata +62 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd3fbe192beffd805980b40fc49e45a17fc91573
4
- data.tar.gz: 985c10461b9cda3e85736c37a448072d1c360b11
3
+ metadata.gz: 074e6a33bccd22a77790d7785fa41e3aed3b0643
4
+ data.tar.gz: bb21d846871e41518155c1569384de9d0a17377f
5
5
  SHA512:
6
- metadata.gz: 9bcc9b579331bddee28a89bfa86e8a0f312dc071ae3e38b31c213d932f6b8744a44bc1dae8381fa552ea166c3a4eb661e22cc5d1e526375812898d9889246062
7
- data.tar.gz: d52753724255e12b3662c441278d69a1423095d5661a415577f8578630a5c162c3934f0b8115cfaa657c77d094dc67c524eb4bd4deebb7dadd7a645cd31e6fc3
6
+ metadata.gz: 4c5c5d2102413b49a1f9cedbba8a7ee84541ddd2701cb69bc5e8305b2192f3f61a300332c729b6cf3c89e5ade81f79b25fc6abc2aafaf6716f6e3cdb71c5d331
7
+ data.tar.gz: 3a79067cc83f4e015200af29b2a8255c2d7f6b881cd2b8eedad5992435b4d95e5cbba4c170f8fc080a98876f05b857595ef626b3459148206b0741cc32acaa2a
@@ -0,0 +1,65 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-06-23 17:07:53 -0400 using RuboCop version 0.23.0.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ #######
9
+ # WIP
10
+ # Offense count: 17
11
+ Style/LineLength:
12
+ Enabled: false
13
+ Max: 120
14
+
15
+ # Offense count: 8
16
+ # Configuration parameters: CountComments.
17
+ Style/MethodLength:
18
+ Enabled: false
19
+ Max: 30
20
+
21
+ ########
22
+ # Fix these later
23
+ # Offense count: 1
24
+ Lint/Eval:
25
+ Enabled: false
26
+
27
+ # Offense count: 6
28
+ Lint/ShadowingOuterLocalVariable:
29
+ Enabled: false
30
+
31
+ # Offense count: 2
32
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
33
+ Style/ClassAndModuleChildren:
34
+ Enabled: false
35
+
36
+ # Offense count: 6
37
+ # Configuration parameters: CountComments.
38
+ Style/ClassLength:
39
+ Max: 506
40
+
41
+ # Offense count: 12
42
+ Style/CyclomaticComplexity:
43
+ Max: 18
44
+
45
+ # Offense count: 17
46
+ Style/Documentation:
47
+ Enabled: false
48
+
49
+ #######
50
+ # We actually want these off
51
+
52
+ # Offense count: 2
53
+ Lint/UselessSetterCall:
54
+ Enabled: false
55
+
56
+ # Offense count: 9
57
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
58
+ Style/Next:
59
+ Enabled: false
60
+
61
+ # Offense count: 7
62
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
63
+ Style/VariableName:
64
+ Enabled: false
65
+ #######
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 IgorShare
3
+ Copyright (c) 2014 Constant Contact
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -86,6 +86,7 @@ Here's a high level overview of what's available:
86
86
  - job:
87
87
  name: nameStr # Name of your Job
88
88
  job_type: free_style # Optional [free_style|multi_project]
89
+ concurrent_build: true or false
89
90
  discard_old: # Discard old builds after:
90
91
  days: 1 # Optional, number of days after which the build is deleted
91
92
  number: 2 # Optional, number of builds after which the build is deleted
@@ -147,7 +148,7 @@ Here's a high level overview of what's available:
147
148
  mavenName: maven-name # Optional
148
149
  - remote_job:
149
150
  server: 'Name of Server' # Name of the Remote Jenkins Server
150
- job_name: name_of_remote_build
151
+ job_name: name_of_remote_build
151
152
  blocking: true # Block current job until remote job finishes
152
153
  polling_interval: 10 # Optional, number of seconds between polls, defaults to 10
153
154
  continue_on_remote_failure: false
@@ -160,6 +161,18 @@ Here's a high level overview of what's available:
160
161
  type: api_token or none
161
162
  username: name_of_user
162
163
  api_token: APITOKEN
164
+ - blocking_downstream:
165
+ project: nameStr
166
+ data:
167
+ - params: |
168
+ param1
169
+ param2
170
+ condition: FAILURE
171
+ trigger_with_no_parameters: false
172
+ # Below is Optional, values can be SUCCESS, FAILURE, UNSTABLE, never
173
+ fail: FAILURE # Fail this build step if the triggered build is worse or equal to
174
+ mark_fail: SUCCESS # Mark this build as failure if the triggered build is worse or equal to
175
+ mark_unstable: UNSTABLE # Mark this build as unstable if the triggered build is worse or equal to
163
176
  wrappers:
164
177
  - timestamp: true
165
178
  - ansicolor: true
@@ -170,13 +183,14 @@ Here's a high level overview of what's available:
170
183
  snapshot-repo: snapshot
171
184
  publish: 'pkg/*.gem'
172
185
  publish-build-info: true # Optional
186
+ properties: key=value;key2=value2,value2.1
173
187
  - maven3artifactory:
174
188
  url: https://artifactory.com/artifactory
175
189
  artifactory-name: name
176
190
  release-repo: release
177
191
  snapshot-repo: snapshot
178
192
  publish-build-info: true # Optional
179
- - inject_env_var:
193
+ - inject_env_var:
180
194
  file: 'foo.prop'
181
195
  content: |
182
196
  VAR1 = value_1
@@ -230,6 +244,35 @@ Here's a high level overview of what's available:
230
244
  }
231
245
  ```
232
246
 
247
+ ### Pull Request Generator
248
+
249
+ The pull request generator will generate pipelines for pull requests that are noticed on your repo. It will also remove old pipelines from Jenkins if the pull_request is closed.
250
+ If you need to modify job parameters please just specify that in the jobs section like the example below.
251
+
252
+ When running a project through this module, the project {{name}} is appended with "-PR##" where ## is the number of the pull request.
253
+
254
+ ```yaml
255
+ - job:
256
+ name: '{{name}}-ReqGen'
257
+ job_type: pull_request_generator
258
+ git_url: 'https://www.github.com/'
259
+ git_repo: 'jenkins_pipeline_builder'
260
+ git_org: 'IgorShare'
261
+ jobs:
262
+ - '{{name}}-Job1':
263
+ publishers:
264
+ - downstream:
265
+ project: '{{name}}-Job2'
266
+ - '{{name}}-Job2':
267
+ discard_old:
268
+ number: '100'
269
+ - '{{name}}-Job3'
270
+ builders:
271
+ - shell_command: |
272
+ generate -v || gem install jenkins_pipeline_builder
273
+ generate pipeline pull_request pipeline/ {{name}}
274
+ ```
275
+
233
276
  ### View DSL
234
277
  ```yaml
235
278
  - view:
@@ -265,6 +308,25 @@ If a set of Defaults is specified with the name global, that will be used by all
265
308
  param1: 'value 1'
266
309
  ```
267
310
 
311
+ PLUGINS:
312
+ --------
313
+
314
+ A number of the DSL options rely on Jenkins plugins, including:
315
+
316
+ * ansicolor - "AnsiColor"
317
+ * (view) type: 'categorizedView' - "categorized-view"
318
+ * hipchat - "HipChat Plugin"
319
+ * inject_env_vars - "Environment Injector Plugin"
320
+ * priority - "Priority Sorter plugin"
321
+ * downstream - "Parameterized Trigger plugin"
322
+ * rvm - "Rvm"
323
+ * throttle - "Throttle Concurrent Builds Plug-in"
324
+ * timestamp - "Timestamper"
325
+ * groovy_postbuild - "Groovy Postbuild"
326
+
327
+ Just about every plugin above can be installed through Jenkins (Manage Jenkins > Manage Plugins > Available)
328
+
329
+ Exceptions:
268
330
 
269
331
  CONTRIBUTING:
270
332
  ----------------
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2014 Igor Moochnick
2
+ # Copyright (c) 2014 Constant Contact
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -20,15 +20,17 @@
20
20
  # THE SOFTWARE.
21
21
  #
22
22
 
23
- #!/usr/bin/env rake
24
23
  require 'rspec/core/rake_task'
25
24
  require 'yard'
25
+ require 'rubocop/rake_task'
26
26
 
27
- RSpec::Core::RakeTask.new(:spec, :tag) do |t, task_args|
28
- t.pattern = ".spec/**/*_spec.rb"
29
- t.verbose = true
30
- t.fail_on_error = false
31
- t.rspec_opts = spec_output 'spec.xml'
27
+ RuboCop::RakeTask.new
28
+
29
+ RSpec::Core::RakeTask.new(:spec, :tag) do |spec|
30
+ spec.pattern = '.spec/**/*_spec.rb'
31
+ spec.verbose = true
32
+ spec.fail_on_error = false
33
+ spec.rspec_opts = spec_output 'spec.xml'
32
34
  end
33
35
 
34
36
  def spec_output(filename)
@@ -58,13 +60,13 @@ end
58
60
  namespace :doc do
59
61
  # This task requires that graphviz is installed locally. For more info:
60
62
  # http://www.graphviz.org/
61
- desc "Generates the class diagram using the yard generated dot file"
63
+ desc 'Generates the class diagram using the yard generated dot file'
62
64
  task :generate_class_diagram do
63
- puts "Generating the dot file..."
65
+ puts 'Generating the dot file...'
64
66
  `yard graph --file jenkins_api_client.dot`
65
- puts "Generating class diagram from the dot file..."
67
+ puts 'Generating class diagram from the dot file...'
66
68
  `dot jenkins_api_client.dot -Tpng -o jenkins_api_client_class_diagram.png`
67
69
  end
68
70
  end
69
71
 
70
- task default: :unit_tests
72
+ task default: [:unit_tests, :rubocop]
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (c) 2014 Igor Moochnick
3
+ # Copyright (c) 2014 Constant Contact
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -21,8 +21,6 @@
21
21
  # THE SOFTWARE.
22
22
  #
23
23
 
24
-
25
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
24
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
26
25
  require 'jenkins_pipeline_builder'
27
26
  JenkinsPipelineBuilder::CLI::Base.start
28
-
@@ -6,30 +6,32 @@ require 'jenkins_pipeline_builder/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'jenkins_pipeline_builder'
8
8
  spec.version = JenkinsPipelineBuilder::VERSION
9
- spec.authors = ['Igor Moochnick']
10
- spec.email = %w(igor.moochnick@gmail.com)
11
- spec.description = %q{This is a simple and easy-to-use Jenkins Pipeline generator with features focused on
12
- automating Job & Pipeline creation from the YAML files checked-in with your application source code}
13
- spec.summary = %q{This gem is will boostrap your Jenkins pipelines}
14
- spec.homepage = 'https://github.com/IgorShare/jenkins_pipeline_builder'
9
+ spec.authors = ['Igor Moochnick', 'Joseph Henrich']
10
+ spec.email = %w(igor.moochnick@gmail.com crimsonknave@gmail.com)
11
+ spec.description = %q(This is a simple and easy-to-use Jenkins Pipeline generator with features focused on
12
+ automating Job & Pipeline creation from the YAML files checked-in with your application source code)
13
+ spec.summary = %q(This gem is will boostrap your Jenkins pipelines)
14
+ spec.homepage = 'https://github.com/ConstantContact/jenkins_pipeline_builder'
15
15
  spec.license = 'MIT'
16
16
 
17
- spec.files = `git ls-files`.split($/)
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ["lib"]
17
+ spec.files = `git ls-files`.split($RS)
18
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
20
+ spec.require_paths = ['lib']
21
21
 
22
- ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES']='true'
22
+ ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] = 'true'
23
23
 
24
24
  spec.add_dependency 'nokogiri', '~> 1.5.0'
25
25
  spec.add_dependency 'jenkins_api_client', '~> 0.14.1'
26
26
  spec.add_dependency 'thor', '>= 0.18.0'
27
27
  spec.add_dependency 'activesupport'
28
+ spec.add_dependency 'archive-tar-minitar'
28
29
 
29
30
  spec.add_development_dependency 'bundler', '~> 1.3'
30
31
  spec.add_development_dependency 'rake'
31
32
  spec.add_development_dependency 'rspec', '~> 2.14'
32
33
  spec.add_development_dependency 'bump'
34
+ spec.add_development_dependency 'json'
33
35
  spec.add_development_dependency 'gem-release'
34
36
  spec.add_development_dependency 'pry'
35
37
  spec.add_development_dependency 'simplecov'
@@ -40,4 +42,5 @@ automating Job & Pipeline creation from the YAML files checked-in with your appl
40
42
  spec.add_development_dependency 'yard'
41
43
  spec.add_development_dependency 'rspec_junit_formatter'
42
44
  spec.add_development_dependency 'webmock'
45
+ spec.add_development_dependency 'rubocop'
43
46
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2014 Igor Moochnick
2
+ # Copyright (c) 2014 Constant Contact
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@ require 'jenkins_pipeline_builder/builders'
30
30
  require 'jenkins_pipeline_builder/wrappers'
31
31
  require 'jenkins_pipeline_builder/triggers'
32
32
  require 'jenkins_pipeline_builder/publishers'
33
+ require 'jenkins_pipeline_builder/pull_request'
33
34
  require 'jenkins_pipeline_builder/view'
34
35
  require 'jenkins_pipeline_builder/generator'
35
36
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2014 Igor Moochnick
2
+ # Copyright (c) 2014 Constant Contact
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -24,57 +24,114 @@ module JenkinsPipelineBuilder
24
24
  class Builders
25
25
  def self.build_multijob(params, xml)
26
26
  params[:phases].each do |name, content|
27
- xml.send('com.tikal.jenkins.plugins.multijob.MultiJobBuilder') {
27
+ xml.send('com.tikal.jenkins.plugins.multijob.MultiJobBuilder') do
28
28
  xml.phaseName name
29
- xml.phaseJobs {
29
+ xml.phaseJobs do
30
30
  content[:jobs].each do |job|
31
- xml.send('com.tikal.jenkins.plugins.multijob.PhaseJobsConfig') {
31
+ xml.send('com.tikal.jenkins.plugins.multijob.PhaseJobsConfig') do
32
32
  xml.jobName job[:name]
33
33
  xml.currParams job[:current_params] || false
34
34
  xml.exposedSCM job[:exposed_scm] || false
35
35
  if job[:config]
36
- xml.configs {
37
- if job[:config].has_key? :predefined_build_parameters
38
- xml.send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') {
36
+ xml.configs do
37
+ if job[:config].key? :predefined_build_parameters
38
+ xml.send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') do
39
39
  xml.properties job[:config][:predefined_build_parameters].join "\n"
40
- }
40
+ end
41
41
  end
42
- }
42
+ end
43
43
  end
44
- }
44
+ end
45
45
  end
46
- }
46
+ end
47
47
  xml.continuationCondition content[:continue_condition] || 'SUCCESSFUL'
48
- }
48
+ end
49
49
  end
50
50
  end
51
51
 
52
52
  def self.build_maven3(params, xml)
53
- xml.send('org.jfrog.hudson.maven3.Maven3Builder') {
53
+ xml.send('org.jfrog.hudson.maven3.Maven3Builder') do
54
54
  xml.mavenName params[:mavenName] || 'tools-maven-3.0.3'
55
55
  xml.rootPom params[:rootPom]
56
56
  xml.goals params[:goals]
57
57
  xml.mavenOpts params[:options]
58
- }
58
+ end
59
59
  end
60
60
 
61
61
  def self.build_shell_command(param, xml)
62
- xml.send('hudson.tasks.Shell') {
62
+ xml.send('hudson.tasks.Shell') do
63
63
  xml.command param
64
- }
64
+ end
65
65
  end
66
66
 
67
67
  def self.build_environment_vars_injector(params, xml)
68
- xml.EnvInjectBuilder {
69
- xml.info {
68
+ xml.EnvInjectBuilder do
69
+ xml.info do
70
70
  xml.propertiesFilePath params
71
- }
72
- }
71
+ end
72
+ end
73
+ end
74
+
75
+ def self.blocking_downstream(params, xml)
76
+ colors = { 'SUCCESS' => { ordinal: 0, color: 'BLUE' }, 'FAILURE' => { ordinal: 2, color: 'RED' }, 'UNSTABLE' => { ordinal: 1, color: 'YELLOW' } }
77
+ xml.send('hudson.plugins.parameterizedtrigger.TriggerBuilder', 'plugin' => 'parameterized-trigger') do
78
+ xml.configs do
79
+ xml.send('hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig') do
80
+
81
+ xml.configs do
82
+ params[:data] = [{ params: '' }] unless params[:data]
83
+ params[:data].each do |config|
84
+ if config[:params]
85
+ xml.send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') do
86
+ xml.properties config[:params]
87
+ end
88
+ end
89
+ if config[:file]
90
+ xml.send('hudson.plugins.parameterizedtrigger.FileBuildParameters') do
91
+ xml.propertiesFile config[:file]
92
+ xml.failTriggerOnMissing false
93
+ end
94
+ end
95
+ end
96
+ end
97
+ xml.projects params[:project]
98
+ xml.condition params[:condition] || 'SUCCESS'
99
+ xml.triggerWithNoParameters params[:trigger_with_no_parameters] || false
100
+ xml.block do
101
+ if params[:fail] && colors.include?(params[:fail])
102
+ xml.buildStepFailureThreshold do
103
+ xml.name params[:fail]
104
+ xml.ordinal colors[params[:fail]][:ordinal]
105
+ xml.color colors[params[:fail]][:color]
106
+ xml.completeBuild 'true'
107
+ end
108
+ end
109
+ if params[:mark_fail] && colors.include?(params[:mark_fail])
110
+ xml.failureThreshold do
111
+ xml.name params[:mark_fail]
112
+ xml.ordinal colors[params[:mark_fail]][:ordinal]
113
+ xml.color colors[params[:mark_fail]][:color]
114
+ xml.completeBuild 'true'
115
+ end
116
+ end
117
+ if params[:mark_unstable] && colors.include?(params[:mark_unstable])
118
+ xml.unstableThreshold do
119
+ xml.name params[:mark_unstable]
120
+ xml.ordinal colors[params[:mark_unstable]][:ordinal]
121
+ xml.color colors[params[:mark_unstable]][:color]
122
+ xml.completeBuild 'true'
123
+ end
124
+ end
125
+ end
126
+ xml.buildAllNodesWithLabel false
127
+ end
128
+ end
129
+ end
73
130
  end
74
131
 
75
132
  def self.start_remote_job(params, xml)
76
133
  parameters = params[:parameters][:content].split("\n") if params[:parameters] && params[:parameters][:content]
77
- xml.send('org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration', 'plugin'=>'Parameterized-Remote-Trigger'){
134
+ xml.send('org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration', 'plugin' => 'Parameterized-Remote-Trigger') do
78
135
  xml.remoteJenkinsName params[:server]
79
136
  xml.job params[:job_name]
80
137
  xml.shouldNotFailBuild params[:continue_on_remote_failure] if params[:continue_on_remote_failure]
@@ -83,36 +140,35 @@ module JenkinsPipelineBuilder
83
140
  xml.token
84
141
  if params[:parameters] && params[:parameters][:content]
85
142
  xml.parameters parameters.join("\n")
86
- xml.parameterList{
143
+ xml.parameterList do
87
144
  parameters.each do |p|
88
145
  xml.string p
89
146
  end
90
- }
147
+ end
91
148
  elsif params[:parameters] && params[:parameters][:file]
92
- xml.loadParamsFromFile 'true'
149
+ xml.loadParamsFromFile 'true'
93
150
  xml.parameterFile params[:parameters][:file]
94
151
  else
95
152
  xml.parameters
96
- xml.parameterList{
153
+ xml.parameterList do
97
154
  xml.string
98
- }
155
+ end
99
156
  end
100
157
  if params[:credentials] && params[:credentials][:type]
101
158
  xml.overrideAuth 'true'
102
- xml.auth{
103
- xml.send('org.jenkinsci.plugins.ParameterizedRemoteTrigger.Auth'){
104
- if params[:credentials][:type]=="api_token"
159
+ xml.auth do
160
+ xml.send('org.jenkinsci.plugins.ParameterizedRemoteTrigger.Auth') do
161
+ if params[:credentials][:type] == 'api_token'
105
162
  xml.authType 'apiToken'
106
163
  xml.username params[:credentials][:username]
107
164
  xml.API__TOKEN params[:credentials][:api_token]
108
165
  else
109
166
  xml.authType 'none'
110
167
  end
111
- }
112
- }
168
+ end
169
+ end
113
170
  end
114
- }
171
+ end
115
172
  end
116
-
117
173
  end
118
174
  end