jenkins_pipeline_builder 0.16.0 → 0.16.2
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.
- checksums.yaml +4 -4
- data/lib/jenkins_pipeline_builder/extensions/builders.rb +70 -22
- data/lib/jenkins_pipeline_builder/version.rb +1 -1
- data/spec/lib/jenkins_pipeline_builder/extensions/builders_spec.rb +103 -0
- data/spec/lib/jenkins_pipeline_builder/extensions/registered_spec.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e6d66b2aeb97ff13d1857f917d40823f04a0475
|
4
|
+
data.tar.gz: c65360bb36f9b0b75c726d069672dbfdd701887d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cfefd6a9a7955b33858657599a9899d91c32b304d631f86f184c7f90321409754d182eda1bf8ee11209fc448067d7c51b10cc6a3cd6420f664a03d06f4bdc27
|
7
|
+
data.tar.gz: 5221d04269f542077e959f047f01f0062767d0a9f8e3b3f8a1be145760063b430f6b78d2786fba06c9232b8497e14381f8144448de172767bcab216c4cbad07b
|
@@ -377,31 +377,79 @@ builder do
|
|
377
377
|
filterPattern params[:filterPattern]
|
378
378
|
end
|
379
379
|
end
|
380
|
+
end
|
381
|
+
|
382
|
+
builder do
|
383
|
+
name :sonar_standalone
|
384
|
+
plugin_id 'sonar'
|
385
|
+
description 'The plugin allows you to trigger SonarQube analysis from Jenkins using a Post-build action to trigger the analysis with MavenQuickly benefit from Sonar, the open source platform for Continuous Inspection of code quality.'
|
386
|
+
jenkins_name 'SonarQube Plugin'
|
387
|
+
announced false
|
388
|
+
parameters [
|
389
|
+
:sonarInstallation,
|
390
|
+
:taskToRun,
|
391
|
+
:jdk,
|
392
|
+
:pathToProjectProperties,
|
393
|
+
:projectProperties,
|
394
|
+
:jvmOptions
|
395
|
+
]
|
380
396
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
:
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
:projectProperties,
|
393
|
-
:jvmOptions
|
394
|
-
]
|
397
|
+
xml do |params|
|
398
|
+
send('hudson.plugins.sonar.SonarRunnerBuilder', 'plugin' => 'sonar@2.1') do
|
399
|
+
installationName params[:sonarInstallation]
|
400
|
+
jdk params[:jdk] || '(Inherit From Job)'
|
401
|
+
project params[:pathToProjectProperties]
|
402
|
+
properties params[:projectProperties]
|
403
|
+
javaOpts params[:jvmOptions]
|
404
|
+
task params[:taskToRun]
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
395
408
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
409
|
+
builder do
|
410
|
+
name :conditional_multijob_step
|
411
|
+
plugin_id 'conditional-buildstep'
|
412
|
+
description 'description'
|
413
|
+
jenkins_name 'Conditional Build Step'
|
414
|
+
announced false
|
415
|
+
|
416
|
+
xml do |params|
|
417
|
+
send('org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder', 'plugin' => 'conditional-buildstep@1.3.3') do
|
418
|
+
condition('class' => 'org.jenkins_ci.plugins.run_condition.contributed.ShellCondition', 'plugin' => 'run-condition@1.0') do
|
419
|
+
command params[:conditional_shell]
|
420
|
+
end
|
421
|
+
params[:phases].each do |name, content|
|
422
|
+
buildStep('class' => 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder', 'plugin' => 'jenkins-multijob-plugin@1.13') do
|
423
|
+
phaseName name
|
424
|
+
phaseJobs do
|
425
|
+
content[:jobs].each do |job|
|
426
|
+
send('com.tikal.jenkins.plugins.multijob.PhaseJobsConfig') do
|
427
|
+
jobName job[:name]
|
428
|
+
currParams job[:current_params] || false
|
429
|
+
exposedSCM job[:exposed_scm] || false
|
430
|
+
if job[:config]
|
431
|
+
configs do
|
432
|
+
if job[:config].key? :predefined_build_parameters
|
433
|
+
send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') do
|
434
|
+
properties job[:config][:predefined_build_parameters]
|
435
|
+
end
|
436
|
+
end
|
437
|
+
if job[:config].key? :properties_file
|
438
|
+
send('hudson.plugins.parameterizedtrigger.FileBuildParameters') do
|
439
|
+
propertiesFile job[:config][:properties_file][:file]
|
440
|
+
failTriggerOnMissing job[:config][:properties_file][:skip_if_missing] || 'false'
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
killPhaseOnJobResultCondition job[:kill_phase_on] || 'FAILURE'
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
continuationCondition content[:continue_condition] || 'SUCCESSFUL'
|
450
|
+
end
|
404
451
|
end
|
452
|
+
runner('class' => 'org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail', 'plugin' => 'run-condition@1.0')
|
405
453
|
end
|
406
454
|
end
|
407
455
|
end
|
@@ -100,6 +100,33 @@ describe 'builders' do
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
context 'sonar_standalone' do
|
104
|
+
before :each do
|
105
|
+
allow(JenkinsPipelineBuilder.client).to receive(:plugin).and_return double(
|
106
|
+
list_installed: { 'sonar' => '2.1' }
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'generates a configuration' do
|
111
|
+
params = { builders: { sonar_standalone: { pathToProjectProperties: 'sonar-project.properties' } } }
|
112
|
+
|
113
|
+
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
114
|
+
|
115
|
+
builder = @n_xml.root.children.first
|
116
|
+
expect(builder.name).to match 'hudson.plugins.sonar.SonarRunnerBuilder'
|
117
|
+
expect(@n_xml.root.css('project').first.text).to eq 'sonar-project.properties'
|
118
|
+
expect(@n_xml.root.css('jdk').first.text).to eq '(Inherit From Job)'
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'allows the JDK default to be overriden' do
|
122
|
+
params = { builders: { sonar_standalone: { jdk: '9', pathToProjectProperties: 'sonar-project.properties' } } }
|
123
|
+
|
124
|
+
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
125
|
+
|
126
|
+
expect(@n_xml.root.css('jdk').first.text).to eq '9'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
103
130
|
context 'blocking_downstream' do
|
104
131
|
before :each do
|
105
132
|
allow(JenkinsPipelineBuilder.client).to receive(:plugin).and_return double(
|
@@ -209,4 +236,80 @@ describe 'builders' do
|
|
209
236
|
end
|
210
237
|
end
|
211
238
|
end
|
239
|
+
|
240
|
+
context 'conditional_multijob_step' do
|
241
|
+
let(:default_params) do
|
242
|
+
{
|
243
|
+
builders: {
|
244
|
+
conditional_multijob_step: {
|
245
|
+
conditional_shell: 'echo',
|
246
|
+
phases: {
|
247
|
+
myphase1: {
|
248
|
+
jobs: [
|
249
|
+
{
|
250
|
+
name: 'myjob1',
|
251
|
+
config: {
|
252
|
+
predefined_build_parameters: 'X=Y\nR=Z'
|
253
|
+
}
|
254
|
+
}
|
255
|
+
]
|
256
|
+
}
|
257
|
+
}
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
end
|
262
|
+
let(:base_x_path) do
|
263
|
+
'//org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder'
|
264
|
+
end
|
265
|
+
let(:build_step_x_path) do
|
266
|
+
"#{base_x_path}/buildStep"
|
267
|
+
end
|
268
|
+
let(:phase_jobs_x_path) do
|
269
|
+
"#{build_step_x_path}/phaseJobs/com.tikal.jenkins.plugins.multijob.PhaseJobsConfig"
|
270
|
+
end
|
271
|
+
|
272
|
+
before :each do
|
273
|
+
allow(JenkinsPipelineBuilder.client).to receive(:plugin).and_return double(
|
274
|
+
list_installed: { 'conditional-buildstep' => '1.3.3' }
|
275
|
+
)
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'generates a configuration' do
|
279
|
+
params = default_params
|
280
|
+
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
281
|
+
builder = @n_xml.root.children.first
|
282
|
+
expect(builder.name).to match 'org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder'
|
283
|
+
command = @n_xml.xpath base_x_path
|
284
|
+
expect(command.first.content).to match 'echo'
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'creates a phase' do
|
288
|
+
params = default_params
|
289
|
+
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
290
|
+
phase_name = @n_xml.xpath "#{build_step_x_path}/phaseName"
|
291
|
+
expect(phase_name.first.content).to match 'myphase1'
|
292
|
+
phase_continue = @n_xml.xpath "#{build_step_x_path}/continuationCondition"
|
293
|
+
expect(phase_continue.first.content).to match 'SUCCESSFUL'
|
294
|
+
end
|
295
|
+
|
296
|
+
it 'creates a job' do
|
297
|
+
params = default_params
|
298
|
+
|
299
|
+
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
300
|
+
job_name = @n_xml.xpath "#{phase_jobs_x_path}/jobName"
|
301
|
+
expect(job_name.first.content).to match 'myjob1'
|
302
|
+
curr_params = @n_xml.xpath "#{phase_jobs_x_path}/currParams"
|
303
|
+
expect(curr_params.first.content).to match 'false'
|
304
|
+
exposed_scm = @n_xml.xpath "#{phase_jobs_x_path}/exposedSCM"
|
305
|
+
expect(exposed_scm.first.content).to match 'false'
|
306
|
+
predefined_params = @n_xml.xpath "#{phase_jobs_x_path}/"\
|
307
|
+
'configs/hudson.plugins.parameterizedtrigger.PredefinedBuildParameters'
|
308
|
+
expect(predefined_params.first.content).to match 'X=Y\nR=Z'
|
309
|
+
kill_phase_cond = @n_xml.xpath "#{phase_jobs_x_path}/killPhaseOnJobResultCondition"
|
310
|
+
expect(kill_phase_cond.first.content).to match 'FAILURE'
|
311
|
+
end
|
312
|
+
|
313
|
+
# TODO: More tests
|
314
|
+
end
|
212
315
|
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: 0.16.
|
4
|
+
version: 0.16.2
|
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: 2016-
|
12
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|