jenkins_pipeline_builder 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0687f03b5b619d7c56c13d34bfe575bbe94c4311
4
- data.tar.gz: 1c55278ff7368bbcb28996ed110d12f73cfd3672
3
+ metadata.gz: 0015906b8d8d1be908004af6227116d2b2cf44f0
4
+ data.tar.gz: 0c29e265ded1b244d5a3572ea1ec8eaa3dbab5ff
5
5
  SHA512:
6
- metadata.gz: 36713dd4e6e414e241cb738d6efd757efae7e8bd0c3c4419831d0820829040920c453b887d8a0942307b1feb62e6d25ec9f97d44981f44cde3cb381922d3b256
7
- data.tar.gz: b7118099694c46ca1d4b7e8c85da0604394d3e004c5f92b59ab3d91bef3241c2b556098c7f35dc9a4fc3e302815bdf7a0484a7a756c3e867b39e5d7e4e67a1e0
6
+ metadata.gz: 0c9f85580321286f501449bc5de9c41042838f33f60d0f570d2037b51c0bfaa7c51baaae60c5337324202b46076262566b8dc6f7984ee58797610564dfff4621
7
+ data.tar.gz: e113a4d54514393cb96db1967524d329b585d2e265d0699e087dc6ea59cceb71acefc5a3fe795f142d5f88a857afc2eb35d2b97ea62390bc565a6f42442cfec4
@@ -26,36 +26,86 @@ builder do
26
26
  jenkins_name 'MultiJob Phase'
27
27
  announced false
28
28
 
29
- xml do |params|
30
- params[:phases].each do |name, content|
31
- send('com.tikal.jenkins.plugins.multijob.MultiJobBuilder') do
32
- phaseName name
33
- phaseJobs do
34
- content[:jobs].each do |job|
35
- send('com.tikal.jenkins.plugins.multijob.PhaseJobsConfig') do
36
- jobName job[:name]
37
- currParams job[:current_params] || false
38
- exposedSCM job[:exposed_scm] || false
39
- if job[:config]
40
- configs do
41
- if job[:config].key? :predefined_build_parameters
42
- send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') do
43
- properties job[:config][:predefined_build_parameters]
29
+ version '0' do
30
+ xml do |params|
31
+ params[:phases].each do |name, content|
32
+ send('com.tikal.jenkins.plugins.multijob.MultiJobBuilder') do
33
+ phaseName name
34
+ phaseJobs do
35
+ content[:jobs].each do |job|
36
+ send('com.tikal.jenkins.plugins.multijob.PhaseJobsConfig') do
37
+ jobName job[:name]
38
+ currParams job[:current_params] || false
39
+ exposedSCM job[:exposed_scm] || false
40
+ if job[:config]
41
+ configs do
42
+ if job[:config].key? :predefined_build_parameters
43
+ send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') do
44
+ properties job[:config][:predefined_build_parameters]
45
+ end
46
+ end
47
+ if job[:config].key? :properties_file
48
+ send('hudson.plugins.parameterizedtrigger.FileBuildParameters') do
49
+ propertiesFile job[:config][:properties_file][:file]
50
+ failTriggerOnMissing job[:config][:properties_file][:skip_if_missing] || 'false'
51
+ end
44
52
  end
45
53
  end
46
- if job[:config].key? :properties_file
47
- send('hudson.plugins.parameterizedtrigger.FileBuildParameters') do
48
- propertiesFile job[:config][:properties_file][:file]
49
- failTriggerOnMissing job[:config][:properties_file][:skip_if_missing] || 'false'
54
+ end
55
+ killPhaseOnJobResultCondition job[:kill_phase_on] || 'FAILURE'
56
+ end
57
+ end
58
+ end
59
+ continuationCondition content[:continue_condition] || 'SUCCESSFUL'
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ version '1.27' do
66
+ xml do |params|
67
+ params[:phases].each do |name, content|
68
+ send('com.tikal.jenkins.plugins.multijob.MultiJobBuilder') do
69
+ phaseName name
70
+ phaseJobs do
71
+ content[:jobs].each do |job|
72
+ send('com.tikal.jenkins.plugins.multijob.PhaseJobsConfig') do
73
+ jobName job[:name]
74
+ currParams job[:current_params] || false
75
+ exposedSCM job[:exposed_scm] || false
76
+ disableJob job[:disable_job] || false
77
+ maxRetries job[:max_retries] || 0
78
+ enableRetryStrategy job[:enable_retry_strategy] || false
79
+ abortAllJob job[:abort_all_job] || false
80
+ if job[:condition]
81
+ enableCondition true
82
+ condition job[:condition]
83
+ applyConditionOnlyIfNoSCMChanges job[:apply_condition_only_if]
84
+ end
85
+
86
+ if job[:config]
87
+ configs do
88
+ if job[:config].key? :predefined_build_parameters
89
+ send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') do
90
+ properties job[:config][:predefined_build_parameters]
91
+ end
92
+ end
93
+ if job[:config].key? :properties_file
94
+ send('hudson.plugins.parameterizedtrigger.FileBuildParameters') do
95
+ propertiesFile job[:config][:properties_file][:file]
96
+ failTriggerOnMissing job[:config][:properties_file][:skip_if_missing] || 'false'
97
+ end
50
98
  end
51
99
  end
52
100
  end
101
+ killPhaseOnJobResultCondition job[:kill_phase_on] || 'FAILURE'
102
+ buildOnlyIfSCMChanges job[:build_only_if_scm_changes] || false
53
103
  end
54
- killPhaseOnJobResultCondition job[:kill_phase_on] || 'FAILURE'
55
104
  end
56
105
  end
106
+ continuationCondition content[:continue_condition] || 'SUCCESSFUL'
107
+ executionType content[:execution_type] || 'PARALLEL'
57
108
  end
58
- continuationCondition content[:continue_condition] || 'SUCCESSFUL'
59
109
  end
60
110
  end
61
111
  end
@@ -255,3 +255,56 @@ wrapper do
255
255
  send('hudson.plugins.ws__cleanup.PreBuildCleanup', 'plugin' => 'ws-cleanup')
256
256
  end
257
257
  end
258
+
259
+ wrapper do
260
+ name :build_timeout
261
+ plugin_id 'build-timeout'
262
+ description 'Abort the build if it\'s stuck'
263
+ jenkins_name 'Abort the build if it\'s stuck'
264
+ announced false
265
+
266
+ xml do |wrapper|
267
+ send('hudson.plugins.build__timeout.BuildTimeoutWrapper', 'plugin' => 'build-timeout@1.18') do
268
+ if wrapper[:timeout_strategy] == 'Absolute'
269
+ strategy 'class' => 'hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy' do
270
+ timeoutMinutes wrapper[:timeout_minutes]
271
+ end
272
+ elsif wrapper[:timeout_strategy] == 'Deadline'
273
+ strategy 'class' => 'hudson.plugins.build_timeout.impl.DeadlineTimeOutStrategy' do
274
+ deadlineTime wrapper[:deadline_time]
275
+ deadlineToleranceInMinutes wrapper[:deadline_tolerance]
276
+ end
277
+ elsif wrapper[:timeout_strategy] == 'Elastic'
278
+ strategy 'class' => 'hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy' do
279
+ timeoutPercentage wrapper[:timeout_percentage]
280
+ numberOfBuilds wrapper[:number_of_builds]
281
+ failSafeTimeoutDuration wrapper[:fail_safe_timeout]
282
+ timeoutMinutesElasticDefault wrapper[:timeout_minutes]
283
+ end
284
+ elsif wrapper[:timeout_strategy] == 'Likely stuck'
285
+ strategy 'class' => 'hudson.plugins.build_timeout.impl.LikelyStuckTimeOutStrategy'
286
+ elsif wrapper[:timeout_strategy] == 'No Activity'
287
+ strategy 'class' => 'hudson.plugins.build_timeout.impl.NoActivityTimeOutStrategy' do
288
+ timeoutSecondsString wrapper[:timeout_seconds]
289
+ end
290
+ end
291
+ timeoutEnvVar wrapper[:timeout_env_var] unless wrapper[:timeout_env_var].nil?
292
+ if wrapper[:operation] == 'Abort'
293
+ operationList do
294
+ send('hudson.plugins.build__timeout.operations.AbortOperation')
295
+ end
296
+ elsif wrapper[:operation] == 'Fail'
297
+ operationList do
298
+ send('hudson.plugins.build__timeout.operations.FailOperation')
299
+ end
300
+ elsif wrapper[:operation] == 'Writing'
301
+ operationList do
302
+ send('hudson.plugins.build__timeout.operations.WriteDescriptionOperation') do
303
+ description wrapper[:description]
304
+ end
305
+ end
306
+ else operationList
307
+ end
308
+ end
309
+ end
310
+ end
@@ -21,5 +21,5 @@
21
21
  #
22
22
 
23
23
  module JenkinsPipelineBuilder
24
- VERSION = '1.3.0'.freeze
24
+ VERSION = '1.4.0'.freeze
25
25
  end
@@ -50,25 +50,91 @@ describe 'builders' do
50
50
  end
51
51
 
52
52
  context 'multi_job builder' do
53
+ params = {}
54
+
53
55
  before :each do
56
+ params = { builders: { multi_job: { phases: { foo: { jobs:
57
+ [{
58
+ name: 'foo'
59
+ }] } } } } }
54
60
  allow(JenkinsPipelineBuilder.client).to receive(:plugin).and_return double(
55
61
  list_installed: { 'jenkins-multijob-plugin' => '20.0' }
56
62
  )
57
63
  end
58
64
 
59
65
  it 'generates a configuration' do
60
- params = { builders: { multi_job: { phases: { foo: { jobs: [{ name: 'foo' }] } } } } }
61
66
  JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
62
67
  builder = @n_xml.root.children.first
63
68
  expect(builder.name).to match 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder'
64
69
  end
65
70
 
66
- it 'provides job specific config' do
67
- params = { builders: { multi_job: { phases: { foo: { jobs: [{ name: 'foo', config: {
68
- predefined_build_parameters: 'bar',
69
- properties_file: { file: 'props', skip_if_missing: true }
70
- } }] } } } } }
71
+ it 'generates a jobName' do
72
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
73
+ node = @n_xml.xpath '//jobName'
74
+ expect(node.text).to eq 'foo'
75
+ end
71
76
 
77
+ it 'generates buildOnlyIfSCMChanges flag and sets to parameter' do
78
+ params = { builders: { multi_job: { phases: { foo: { jobs:
79
+ [{
80
+ name: 'foo',
81
+ build_only_if_scm_changes: true
82
+ }] } } } } }
83
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
84
+ node = @n_xml.xpath '//buildOnlyIfSCMChanges'
85
+ expect(node.text).to eq 'true'
86
+ end
87
+
88
+ it 'generates buildOnlyIfSCMChanges flag and sets to default' do
89
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
90
+ node = @n_xml.xpath '//buildOnlyIfSCMChanges'
91
+ expect(node.text).to eq 'false'
92
+ end
93
+
94
+ it 'generates disableJob flag and sets to parameter' do
95
+ params = { builders: { multi_job: { phases: { foo: { jobs:
96
+ [{
97
+ name: 'foo',
98
+ disable_job: true
99
+ }] } } } } }
100
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
101
+ node = @n_xml.xpath '//disableJob'
102
+ expect(node.text).to eq 'true'
103
+ end
104
+
105
+ it 'generates disableJob flag and sets to default' do
106
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
107
+ node = @n_xml.xpath '//disableJob'
108
+ expect(node.text).to eq 'false'
109
+ end
110
+
111
+ it 'generates maxRetries tag' do
112
+ params = { builders: { multi_job: { phases: { foo: { jobs:
113
+ [{
114
+ name: 'foo',
115
+ max_retries: 1
116
+ }] } } } } }
117
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
118
+ node = @n_xml.xpath '//maxRetries'
119
+ expect(node.text).to eq '1'
120
+ end
121
+
122
+ it 'generates enableRetryStrategy tag and sets to default' do
123
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
124
+ node = @n_xml.xpath '//enableRetryStrategy'
125
+ expect(node.text).to eq 'false'
126
+ end
127
+
128
+ it 'provides job specific config' do
129
+ params = { builders: { multi_job: { phases: { foo: { jobs:
130
+ [{
131
+ name: 'foo',
132
+ config:
133
+ {
134
+ predefined_build_parameters: 'bar',
135
+ properties_file: { file: 'props', skip_if_missing: true }
136
+ }
137
+ }] } } } } }
72
138
  JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
73
139
 
74
140
  node = @n_xml.xpath '//hudson.plugins.parameterizedtrigger.PredefinedBuildParameters'
@@ -80,6 +146,93 @@ describe 'builders' do
80
146
  node = @n_xml.xpath '//hudson.plugins.parameterizedtrigger.FileBuildParameters/failTriggerOnMissing'
81
147
  expect(node.children.first.content).to eq 'true'
82
148
  end
149
+
150
+ it 'generates conditional job tag' do
151
+ condition = '1+1==2'
152
+ params = { builders: [{ multi_job: { phases: { foo: { jobs:
153
+ [{
154
+ name: 'foo',
155
+ condition: condition,
156
+ apply_condition_only_if: false
157
+ }] } } } }] }
158
+
159
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
160
+
161
+ node = @n_xml.xpath '//enableCondition'
162
+ expect(node.children.first.content).to eq 'true'
163
+
164
+ node = @n_xml.xpath '//condition'
165
+ expect(node.children.first.content).to eq condition
166
+
167
+ node = @n_xml.xpath '//applyConditionOnlyIfNoSCMChanges'
168
+ expect(node.children.first.content).to eq 'false'
169
+ end
170
+
171
+ it 'generates abort all other jobs tag' do
172
+ params = { builders: [{ multi_job: { phases: { foo: { jobs:
173
+ [{
174
+ name: 'foo',
175
+ abort_all_job: true
176
+ }] } } } }] }
177
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
178
+ node = @n_xml.xpath '//abortAllJob'
179
+ expect(node.children.first.content).to eq 'true'
180
+ end
181
+
182
+ it 'generates abort all other jobs tag and sets to default' do
183
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
184
+ node = @n_xml.xpath '//abortAllJob'
185
+ expect(node.children.first.content).to eq 'false'
186
+ end
187
+
188
+ it 'generates current job parameters with parameters' do
189
+ params = { builders: [{ multi_job: { phases: { foo: { jobs:
190
+ [{
191
+ name: 'foo',
192
+ current_params: true
193
+ }] } } } }] }
194
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
195
+ node = @n_xml.xpath '//currParams'
196
+ expect(node.children.first.content).to eq 'true'
197
+ end
198
+
199
+ it 'generates current job parameters and sets to default' do
200
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
201
+ node = @n_xml.xpath '//currParams'
202
+ expect(node.children.first.content).to eq 'false'
203
+ end
204
+
205
+ it 'generates continuation condition tag with parameter' do
206
+ params = { builders: [{ multi_job: { phases: { foo: {
207
+ jobs: [{ name: 'foo' }],
208
+ continue_condition: 'ALWAYS'
209
+ } } } }] }
210
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
211
+ node = @n_xml.xpath '//continuationCondition'
212
+ expect(node.children.first.content).to eq 'ALWAYS'
213
+ end
214
+
215
+ it 'generates continuation condition tag and sets to default' do
216
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
217
+ node = @n_xml.xpath '//continuationCondition'
218
+ expect(node.children.first.content).to eq 'SUCCESSFUL'
219
+ end
220
+
221
+ it 'generates execution type tag with parameter' do
222
+ params = { builders: [{ multi_job: { phases: { foo: {
223
+ jobs: [{ name: 'foo' }],
224
+ execution_type: 'SEQUENTIALLY'
225
+ } } } }] }
226
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
227
+ node = @n_xml.xpath '//executionType'
228
+ expect(node.children.first.content).to eq 'SEQUENTIALLY'
229
+ end
230
+
231
+ it 'generates execution type tag and sets to default' do
232
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
233
+ node = @n_xml.xpath '//executionType'
234
+ expect(node.children.first.content).to eq 'PARALLEL'
235
+ end
83
236
  end
84
237
 
85
238
  context 'maven3' do
@@ -9,7 +9,8 @@ WRAPPERS = {
9
9
  rvm: ['0', '0.5'],
10
10
  timestamp: ['0'],
11
11
  xvfb: ['0'],
12
- prebuild_cleanup: ['0']
12
+ prebuild_cleanup: ['0'],
13
+ build_timeout: ['0']
13
14
  }.freeze
14
15
 
15
16
  PUBLISHERS = {
@@ -41,7 +42,7 @@ BUILDERS = {
41
42
  copy_artifact: ['0'],
42
43
  inject_vars_file: ['0'],
43
44
  maven3: ['0'],
44
- multi_job: ['0'],
45
+ multi_job: ['0', '1.27'],
45
46
  remote_job: ['0'],
46
47
  shell_command: ['0'],
47
48
  checkmarx_scan: ['0'],
@@ -129,4 +129,115 @@ describe 'wrappers' do
129
129
  expect(node.first).to_not be_nil
130
130
  end
131
131
  end
132
+
133
+ context 'build_timeout' do
134
+ before :each do
135
+ JenkinsPipelineBuilder.registry.registry[:job][:wrappers][:build_timeout].installed_version = '0.0'
136
+ end
137
+
138
+ it 'generates the correct tags and values for the Absolute strategy' do
139
+ params = { wrappers: { build_timeout: {
140
+ timeout_strategy: 'Absolute',
141
+ timeout_minutes: '5'
142
+ } } }
143
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
144
+
145
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/strategy')
146
+ expect(node.to_s).to include('AbsoluteTimeOutStrategy')
147
+ expect(node.xpath('timeoutMinutes').first).to_not be_nil
148
+ expect(node.xpath('timeoutMinutes').first.content).to match('5')
149
+ end
150
+
151
+ it 'generates the correct tags and values for the Deadline strategy' do
152
+ params = { wrappers: { build_timeout: {
153
+ timeout_strategy: 'Deadline',
154
+ deadline_time: '12:05:12',
155
+ deadline_tolerance: '10'
156
+ } } }
157
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
158
+
159
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/strategy')
160
+ expect(node.to_s).to include('DeadlineTimeOutStrategy')
161
+ expect(node.xpath('deadlineTime').first).to_not be_nil
162
+ expect(node.xpath('deadlineToleranceInMinutes').first).to_not be_nil
163
+ expect(node.xpath('deadlineTime').first.content).to match('12:05:12')
164
+ expect(node.xpath('deadlineToleranceInMinutes').first.content).to match('10')
165
+ end
166
+
167
+ it 'generates the correct tags and values for the Elastic strategy' do
168
+ params = { wrappers: { build_timeout: {
169
+ timeout_strategy: 'Elastic',
170
+ timeout_percentage: '150',
171
+ number_of_builds: '5',
172
+ fail_safe_timeout: 'true',
173
+ timeout_minutes: '60'
174
+ } } }
175
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
176
+
177
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/strategy')
178
+ expect(node.to_s).to include('ElasticTimeOutStrategy')
179
+ expect(node.xpath('timeoutPercentage').first).to_not be_nil
180
+ expect(node.xpath('numberOfBuilds').first).to_not be_nil
181
+ expect(node.xpath('failSafeTimeoutDuration').first).to_not be_nil
182
+ expect(node.xpath('timeoutMinutesElasticDefault').first).to_not be_nil
183
+ expect(node.xpath('timeoutPercentage').first.content).to match('150')
184
+ expect(node.xpath('numberOfBuilds').first.content).to match('5')
185
+ expect(node.xpath('failSafeTimeoutDuration').first.content).to match('true')
186
+ expect(node.xpath('timeoutMinutesElasticDefault').first.content).to match('60')
187
+ end
188
+
189
+ it 'generates the Likely stuck strategy' do
190
+ params = { wrappers: { build_timeout: { timeout_strategy: 'Likely stuck' } } }
191
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
192
+
193
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/strategy')
194
+ expect(node.to_s).to include('LikelyStuckTimeOutStrategy')
195
+ end
196
+
197
+ it 'generates the correct tags for the No Activity strategy' do
198
+ params = { wrappers: { build_timeout: {
199
+ timeout_strategy: 'No Activity',
200
+ timeout_seconds: '180'
201
+ } } }
202
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
203
+
204
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/strategy')
205
+ expect(node.to_s).to include('NoActivityTimeOutStrategy')
206
+ expect(node.xpath('timeoutSecondsString').first).to_not be_nil
207
+ expect(node.xpath('timeoutSecondsString').first.content).to match('180')
208
+ end
209
+
210
+ it 'generates the correct tags and values for Time-out variable' do
211
+ params = { wrappers: { build_timeout: { timeout_env_var: '55' } } }
212
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
213
+
214
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/timeoutEnvVar')
215
+ expect(node.first).to_not be_nil
216
+ end
217
+
218
+ it 'generates the correct tag for the Abort the build action' do
219
+ params = { wrappers: { build_timeout: { operation: 'Abort' } } }
220
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
221
+
222
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/operationList')
223
+ expect(node.xpath('hudson.plugins.build__timeout.operations.AbortOperation').first).to_not be_nil
224
+ end
225
+
226
+ it 'generates the correct tag for the Fail the build action' do
227
+ params = { wrappers: { build_timeout: { operation: 'Fail' } } }
228
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
229
+
230
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/operationList')
231
+ expect(node.xpath('hudson.plugins.build__timeout.operations.FailOperation').first).to_not be_nil
232
+ end
233
+
234
+ it 'generates the correct tags for the Writing the build description actions' do
235
+ params = { wrappers: { build_timeout: { operation: 'Writing' } } }
236
+ JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
237
+ str = 'hudson.plugins.build__timeout.operations.WriteDescriptionOperation'
238
+ node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/operationList')
239
+ expect(node.xpath(str).first).to_not be_nil
240
+ expect(node.xpath("#{str}/description").first).to_not be_nil
241
+ end
242
+ end
132
243
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_pipeline_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Moochnick
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-24 00:00:00.000000000 Z
12
+ date: 2017-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri