jenkins_pipeline_builder 0.7.0 → 0.7.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 294473072fd747d1bd02d377b9ddfd17c2c46c38
|
4
|
+
data.tar.gz: a7a28bae727b44af5402760d465e5e643e55ba16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad2144de19201c8702bfc73c46958a00306c294ce716f0307a6532cc2be0d11b5baeef30d4101ae46a0e4bfff904d92185ac45127f1cebf7769157513d810e4
|
7
|
+
data.tar.gz: c0d8d748642d6a417e3d022d4cbf6c3fbcc6e1093dc433473e0b3791002048b264af90cc29c3aabc5f6c397abee3764fcbb41b2a2adca6cf1e1f955d6b181c24
|
data/README.md
CHANGED
@@ -256,6 +256,9 @@ Here's a high level overview of what's available:
|
|
256
256
|
recipients: 'test@example.com' # Whitepace-delimited list of recipients
|
257
257
|
send_if_unstable: false # Optional, default to true
|
258
258
|
send_to_individuals: true # Optional, default to false
|
259
|
+
- sonar_result:
|
260
|
+
branch: 'sonar-results-branch-name'
|
261
|
+
maven_installation_name: 'name'
|
259
262
|
triggers:
|
260
263
|
- git_push: true
|
261
264
|
- scm_polling: 'H/5 * * * *'
|
@@ -54,7 +54,11 @@ job_attribute do
|
|
54
54
|
xpath('//scm/recursiveSubmodules').remove if params[:recursive_update]
|
55
55
|
xpath('//scm/wipeOutWorkspace').remove if params[:wipe_workspace]
|
56
56
|
xpath('//scm/excludedUsers').remove if params[:excluded_users]
|
57
|
-
|
57
|
+
if params[:remote_name] || params[:refspec]
|
58
|
+
remote_url = xpath('//scm/userRemoteConfigs/hudson.plugins.git.UserRemoteConfig/url').first
|
59
|
+
params[:remote_url] = remote_url.content if remote_url
|
60
|
+
xpath('//scm/userRemoteConfigs').remove
|
61
|
+
end
|
58
62
|
xpath('//scm/skipTag').remove if params[:skip_tag]
|
59
63
|
xpath('//scm/excludedRegions').remove if params[:excluded_regions]
|
60
64
|
xpath('//scm/includedRegions').remove if params[:included_regions]
|
@@ -66,21 +70,16 @@ job_attribute do
|
|
66
70
|
recursiveSubmodules params[:recursive_update] if params[:recursive_update]
|
67
71
|
wipeOutWorkspace params[:wipe_workspace] if params[:wipe_workspace]
|
68
72
|
excludedUsers params[:excluded_users] if params[:excluded_users]
|
69
|
-
if params[:remote_name]
|
73
|
+
if params[:remote_name] || params[:refspec]
|
70
74
|
userRemoteConfigs do
|
71
75
|
send('hudson.plugins.git.UserRemoteConfig') do
|
72
|
-
name params[:remote_name]
|
76
|
+
name params[:remote_name] if params[:remote_name]
|
77
|
+
refspec params[:refspec] if params[:refspec]
|
78
|
+
url params[:remote_url] if params[:remote_url]
|
73
79
|
end
|
74
80
|
end
|
75
81
|
end
|
76
82
|
skipTag params[:skip_tag] if params[:skip_tag]
|
77
|
-
if params[:refspec]
|
78
|
-
userRemoteConfigs do
|
79
|
-
send 'hudson.plugins.git.UserRemoteConfig' do
|
80
|
-
refspec params[:refspec]
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
83
|
excludedRegions params[:excluded_regions] if params[:excluded_regions]
|
85
84
|
includedRegions params[:included_regions] if params[:included_regions]
|
86
85
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'job_attributes' do
|
4
|
+
after :each do
|
5
|
+
JenkinsPipelineBuilder.registry.clear_versions
|
6
|
+
end
|
7
|
+
|
8
|
+
before :all do
|
9
|
+
JenkinsPipelineBuilder.credentials = {
|
10
|
+
server_ip: '127.0.0.1',
|
11
|
+
server_port: 8080,
|
12
|
+
username: 'username',
|
13
|
+
password: 'password',
|
14
|
+
log_location: '/dev/null'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
after :each do |example|
|
19
|
+
name = example.description.gsub ' ', '_'
|
20
|
+
File.open("./out/xml/job_attribute_#{name}.xml", 'w') { |f| @n_xml.write_xml_to f }
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'scm params' do
|
24
|
+
before :each do
|
25
|
+
allow(JenkinsPipelineBuilder.client).to receive(:plugin).and_return double(
|
26
|
+
list_installed: { 'git' => '20.0' })
|
27
|
+
|
28
|
+
builder = Nokogiri::XML::Builder.new { |xml| xml.scm }
|
29
|
+
@n_xml = builder.doc
|
30
|
+
|
31
|
+
Nokogiri::XML::Builder.with(@n_xml.xpath('//scm').first) do |xml|
|
32
|
+
xml.userRemoteConfigs do
|
33
|
+
xml.send('hudson.plugins.git.UserRemoteConfig') do
|
34
|
+
xml.url 'http://foo.com'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'writes one block when both refspec and remote_name' do
|
41
|
+
params = { scm_params: { refspec: :bar, remote_name: :foo }, scm_url: 'http://foo.com' }
|
42
|
+
|
43
|
+
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
44
|
+
|
45
|
+
remote_config = @n_xml.root.children.first.children.first
|
46
|
+
|
47
|
+
expect(remote_config.name).to match 'hudson.plugins.git.UserRemoteConfig'
|
48
|
+
|
49
|
+
expect(remote_config.css('name').first).to be_truthy
|
50
|
+
expect(remote_config.css('refspec').first).to be_truthy
|
51
|
+
|
52
|
+
expect(remote_config.css('name').first.content).to eq 'foo'
|
53
|
+
expect(remote_config.css('refspec').first.content).to eq 'bar'
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'using remote_name does not remove the remote url' do
|
57
|
+
params = { scm_params: { remote_name: :foo }, scm_url: 'http://foo.com' }
|
58
|
+
|
59
|
+
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
60
|
+
|
61
|
+
remote_config = @n_xml.root.children.first.children.first
|
62
|
+
|
63
|
+
expect(remote_config.name).to match 'hudson.plugins.git.UserRemoteConfig'
|
64
|
+
|
65
|
+
expect(remote_config.css('name').first).to be_truthy
|
66
|
+
expect(remote_config.css('url').first).to be_truthy
|
67
|
+
|
68
|
+
expect(remote_config.css('name').first.content).to eq 'foo'
|
69
|
+
expect(remote_config.css('url').first.content).to eq 'http://foo.com'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
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.7.
|
4
|
+
version: 0.7.1
|
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: 2014-
|
12
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -357,6 +357,7 @@ files:
|
|
357
357
|
- pipeline/project.yaml
|
358
358
|
- spec/lib/jenkins_pipeline_builder/compiler_spec.rb
|
359
359
|
- spec/lib/jenkins_pipeline_builder/extensions/builders_spec.rb
|
360
|
+
- spec/lib/jenkins_pipeline_builder/extensions/job_attributes_spec.rb
|
360
361
|
- spec/lib/jenkins_pipeline_builder/extensions/publishers_spec.rb
|
361
362
|
- spec/lib/jenkins_pipeline_builder/extensions_spec.rb
|
362
363
|
- spec/lib/jenkins_pipeline_builder/fixtures/generator_tests/pullrequest_pipeline/PullRequest-10-SampleJob.yaml
|
@@ -407,6 +408,7 @@ summary: This gem is will boostrap your Jenkins pipelines
|
|
407
408
|
test_files:
|
408
409
|
- spec/lib/jenkins_pipeline_builder/compiler_spec.rb
|
409
410
|
- spec/lib/jenkins_pipeline_builder/extensions/builders_spec.rb
|
411
|
+
- spec/lib/jenkins_pipeline_builder/extensions/job_attributes_spec.rb
|
410
412
|
- spec/lib/jenkins_pipeline_builder/extensions/publishers_spec.rb
|
411
413
|
- spec/lib/jenkins_pipeline_builder/extensions_spec.rb
|
412
414
|
- spec/lib/jenkins_pipeline_builder/fixtures/generator_tests/pullrequest_pipeline/PullRequest-10-SampleJob.yaml
|