rubyjobbuilderdsl 0.0.4 → 0.0.5
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 +5 -13
- data/Gemfile +6 -6
- data/Gemfile.lock +41 -41
- data/LICENSE +18 -18
- data/Rakefile +12 -12
- data/docs/common.md +313 -313
- data/docs/flow.md +17 -17
- data/docs/freestyle.md +100 -100
- data/docs/gerrit.md +70 -70
- data/docs/git.md +88 -88
- data/docs/multi.md +26 -26
- data/docs/overview.md +74 -74
- data/docs/postbuild.md +266 -266
- data/docs/view.md +13 -13
- data/lib/rubyjobbuilderdsl/buildstep/ant.rb +29 -29
- data/lib/rubyjobbuilderdsl/buildstep/copyartifact.rb +23 -23
- data/lib/rubyjobbuilderdsl/buildstep/inject_env.rb +18 -18
- data/lib/rubyjobbuilderdsl/buildstep/phase.rb +19 -19
- data/lib/rubyjobbuilderdsl/buildstep/phase_job.rb +26 -26
- data/lib/rubyjobbuilderdsl/buildstep/shell.rb +24 -24
- data/lib/rubyjobbuilderdsl/buildstep/xvfb.rb +46 -46
- data/lib/rubyjobbuilderdsl/common/artifactory.rb +33 -33
- data/lib/rubyjobbuilderdsl/common/blocking_job.rb +11 -11
- data/lib/rubyjobbuilderdsl/common/build_timeout.rb +23 -23
- data/lib/rubyjobbuilderdsl/common/gerrit.rb +53 -53
- data/lib/rubyjobbuilderdsl/common/git.rb +76 -76
- data/lib/rubyjobbuilderdsl/common/logrotate.rb +24 -24
- data/lib/rubyjobbuilderdsl/common/parameter.rb +22 -22
- data/lib/rubyjobbuilderdsl/common/password.rb +12 -12
- data/lib/rubyjobbuilderdsl/common/pollscm.rb +10 -10
- data/lib/rubyjobbuilderdsl/common/scms.rb +18 -18
- data/lib/rubyjobbuilderdsl/common/throttle.rb +24 -24
- data/lib/rubyjobbuilderdsl/common/timed.rb +10 -10
- data/lib/rubyjobbuilderdsl/common/timestamps.rb +6 -6
- data/lib/rubyjobbuilderdsl/common.rb +140 -140
- data/lib/rubyjobbuilderdsl/deployer.rb +95 -95
- data/lib/rubyjobbuilderdsl/flow.rb +14 -14
- data/lib/rubyjobbuilderdsl/freestyle.rb +65 -65
- data/lib/rubyjobbuilderdsl/jenkins_client.rb +203 -203
- data/lib/rubyjobbuilderdsl/multijob.rb +24 -24
- data/lib/rubyjobbuilderdsl/postbuild/archive.rb +23 -23
- data/lib/rubyjobbuilderdsl/postbuild/chucknorris_publisher.rb +6 -6
- data/lib/rubyjobbuilderdsl/postbuild/claim_publisher.rb +6 -6
- data/lib/rubyjobbuilderdsl/postbuild/cloverphp_publisher.rb +36 -36
- data/lib/rubyjobbuilderdsl/postbuild/cucumber_json_publisher.rb +20 -20
- data/lib/rubyjobbuilderdsl/postbuild/email_publisher.rb +23 -23
- data/lib/rubyjobbuilderdsl/postbuild/game_publisher.rb +6 -6
- data/lib/rubyjobbuilderdsl/postbuild/groovy.rb +10 -10
- data/lib/rubyjobbuilderdsl/postbuild/html_publisher.rb +27 -27
- data/lib/rubyjobbuilderdsl/postbuild/javadoc_publisher.rb +19 -19
- data/lib/rubyjobbuilderdsl/postbuild/logparser.rb +21 -21
- data/lib/rubyjobbuilderdsl/postbuild/nunit_publisher.rb +21 -21
- data/lib/rubyjobbuilderdsl/postbuild/pmd_publisher.rb +19 -19
- data/lib/rubyjobbuilderdsl/postbuild/script.rb +14 -14
- data/lib/rubyjobbuilderdsl/postbuild/tap_publisher.rb +44 -44
- data/lib/rubyjobbuilderdsl/postbuild/trigger.rb +38 -38
- data/lib/rubyjobbuilderdsl/postbuild/xunit_publisher.rb +35 -35
- data/lib/rubyjobbuilderdsl/postbuild.rb +160 -160
- data/lib/rubyjobbuilderdsl/view.rb +14 -14
- data/lib/rubyjobbuilderdsl/xml_generator.rb +1 -1
- data/lib/rubyjobbuilderdsl.rb +2 -2
- data/rubyjobbuilderdsl-0.0.3.gem +0 -0
- data/rubyjobbuilderdsl.gemspec +13 -13
- data/rubyjobbuilderdsl.sublime-project +14 -14
- data/run_tests.sh +7 -7
- data/sample/Schedule-sample-pipeline.xml +32 -0
- data/sample/hello_mars.rb +27 -27
- data/sample/local.ini +4 -4
- data/test/test_ant.rb +38 -38
- data/test/test_archive.rb +24 -24
- data/test/test_artifactory.rb +26 -26
- data/test/test_blocking_job.rb +18 -18
- data/test/test_chucknorris_publisher.rb +17 -17
- data/test/test_claim_publisher.rb +17 -17
- data/test/test_cloverphp.rb +33 -33
- data/test/test_concurrent.rb +44 -44
- data/test/test_copyartifact.rb +45 -45
- data/test/test_cucumber_json_publisher.rb +30 -30
- data/test/test_default_setting.rb +29 -29
- data/test/test_email_publisher.rb +44 -44
- data/test/test_flow.rb +19 -19
- data/test/test_freestyle.rb +52 -52
- data/test/test_game_publisher.rb +17 -17
- data/test/test_gerrit.rb +117 -117
- data/test/test_git.rb +80 -80
- data/test/test_html_publisher.rb +57 -57
- data/test/test_inject.rb +23 -23
- data/test/test_javadoc.rb +22 -22
- data/test/test_logparser.rb +24 -24
- data/test/test_logrotate.rb +22 -22
- data/test/test_multijob.rb +50 -50
- data/test/test_nunit_publisher.rb +20 -20
- data/test/test_parameter.rb +44 -44
- data/test/test_password.rb +17 -17
- data/test/test_pmd.rb +22 -22
- data/test/test_pollscm.rb +15 -15
- data/test/test_postbuild_groovy.rb +21 -21
- data/test/test_postbuild_script.rb +24 -24
- data/test/test_postbuild_trigger.rb +170 -170
- data/test/test_scms.rb +31 -31
- data/test/test_tap_publisher.rb +25 -25
- data/test/test_timed.rb +15 -15
- data/test/test_timeout.rb +20 -20
- data/test/test_timestamps.rb +14 -14
- data/test/test_xml_generator.rb +28 -28
- data/test/test_xunit_publisher.rb +22 -22
- data/test/test_xvfb.rb +35 -35
- metadata +9 -11
- data/sample/hello_mars.xml +0 -18
- data/sample/hello_world-post.xml +0 -40
- data/sample/sample_flow.rb +0 -15
- data/sample/test.xml +0 -21
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlPostbuildGroovy < Test::Unit::TestCase
|
|
4
|
-
def test_postbuild_groovy
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
postbuild do
|
|
9
|
-
groovy 'manager.buildFailure()'
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
actual = builder.config_as_xml_node('foo')
|
|
14
|
-
|
|
15
|
-
assert_equal 'manager.buildFailure()', actual.xpath('./project/publishers/' \
|
|
16
|
-
'org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder/groovyScript').text
|
|
17
|
-
|
|
18
|
-
assert_equal '0', actual.xpath('./project/publishers/' \
|
|
19
|
-
'org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder/behavior').text
|
|
20
|
-
end
|
|
21
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlPostbuildGroovy < Test::Unit::TestCase
|
|
4
|
+
def test_postbuild_groovy
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
groovy 'manager.buildFailure()'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
actual = builder.config_as_xml_node('foo')
|
|
14
|
+
|
|
15
|
+
assert_equal 'manager.buildFailure()', actual.xpath('./project/publishers/' \
|
|
16
|
+
'org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder/groovyScript').text
|
|
17
|
+
|
|
18
|
+
assert_equal '0', actual.xpath('./project/publishers/' \
|
|
19
|
+
'org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder/behavior').text
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlPostbuildScript < Test::Unit::TestCase
|
|
4
|
-
def test_postbuild_shell
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
postbuild do
|
|
9
|
-
shell 'cd Reports && mv $(ls *.xml) merge.xml'
|
|
10
|
-
batch 'hostname'
|
|
11
|
-
powershell 'Write-Host "hello world"'
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
actual = builder.config_as_xml_node('foo')
|
|
16
|
-
{ 'hudson.tasks.Shell/command' => 'cd Reports && mv $(ls *.xml) merge.xml',
|
|
17
|
-
'hudson.tasks.BatchFile/command' => 'hostname',
|
|
18
|
-
'hudson.plugins.powershell.PowerShell/command' => 'Write-Host "hello world"',
|
|
19
|
-
}.each do |k, v|
|
|
20
|
-
assert_equal v, actual.xpath('./project/publishers/' \
|
|
21
|
-
"org.jenkinsci.plugins.postbuildscript.PostBuildScript/buildSteps/#{k}").text, k
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlPostbuildScript < Test::Unit::TestCase
|
|
4
|
+
def test_postbuild_shell
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
shell 'cd Reports && mv $(ls *.xml) merge.xml'
|
|
10
|
+
batch 'hostname'
|
|
11
|
+
powershell 'Write-Host "hello world"'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
actual = builder.config_as_xml_node('foo')
|
|
16
|
+
{ 'hudson.tasks.Shell/command' => 'cd Reports && mv $(ls *.xml) merge.xml',
|
|
17
|
+
'hudson.tasks.BatchFile/command' => 'hostname',
|
|
18
|
+
'hudson.plugins.powershell.PowerShell/command' => 'Write-Host "hello world"',
|
|
19
|
+
}.each do |k, v|
|
|
20
|
+
assert_equal v, actual.xpath('./project/publishers/' \
|
|
21
|
+
"org.jenkinsci.plugins.postbuildscript.PostBuildScript/buildSteps/#{k}").text, k
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlPostbuildTrigger < Test::Unit::TestCase
|
|
4
|
-
ROOT = './project/publishers/hudson.plugins.parameterizedtrigger.BuildTrigger/configs'
|
|
5
|
-
TRIGGER_CONFIG = 'hudson.plugins.parameterizedtrigger.BuildTriggerConfig'
|
|
6
|
-
|
|
7
|
-
def test_postbuild_trigger
|
|
8
|
-
builder = JenkinsJob::Builder.new
|
|
9
|
-
|
|
10
|
-
builder.freestyle 'foo' do
|
|
11
|
-
postbuild do
|
|
12
|
-
trigger 'bar' do
|
|
13
|
-
trigger_with_no_parameters true
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
actual = builder.config_as_xml_node('foo')
|
|
19
|
-
|
|
20
|
-
expected_trigger_configuration = {
|
|
21
|
-
'projects' => 'bar',
|
|
22
|
-
'condition' => 'SUCCESS',
|
|
23
|
-
'triggerWithNoParameters' => 'true'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
expected_trigger_configuration.each do |key, expected_value|
|
|
27
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
28
|
-
assert_equal expected_value, given_value, key
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def test_postbuild_trigger_multiple_projects
|
|
33
|
-
builder = JenkinsJob::Builder.new
|
|
34
|
-
|
|
35
|
-
builder.freestyle 'foo' do
|
|
36
|
-
postbuild do
|
|
37
|
-
trigger 'bar1', 'bar2' do
|
|
38
|
-
trigger_with_no_parameters true
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
actual = builder.config_as_xml_node('foo')
|
|
44
|
-
|
|
45
|
-
expected_trigger_configuration = {
|
|
46
|
-
'projects' => 'bar1,bar2',
|
|
47
|
-
'condition' => 'SUCCESS',
|
|
48
|
-
'triggerWithNoParameters' => 'true'
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
expected_trigger_configuration.each do |key, expected_value|
|
|
52
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
53
|
-
assert_equal expected_value, given_value, key
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def test_trigger_paramaterized_with_file
|
|
58
|
-
expected_file_build_tag = 'hudson.plugins.parameterizedtrigger.FileBuildParameters'
|
|
59
|
-
builder = JenkinsJob::Builder.new
|
|
60
|
-
|
|
61
|
-
builder.freestyle 'foo' do
|
|
62
|
-
postbuild do
|
|
63
|
-
trigger 'bar' do
|
|
64
|
-
file 'env.properties'
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
expected_file_parameters = {
|
|
70
|
-
'propertiesFile' => 'env.properties',
|
|
71
|
-
'failTriggerOnMissing' => 'false',
|
|
72
|
-
'useMatrixChild' => 'false',
|
|
73
|
-
'onlyExactRuns' => 'false'
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
expected_trigger_configuration = {
|
|
77
|
-
'projects' => 'bar',
|
|
78
|
-
'condition' => 'SUCCESS',
|
|
79
|
-
'triggerWithNoParameters' => 'false'
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
actual = builder.config_as_xml_node('foo')
|
|
83
|
-
|
|
84
|
-
expected_trigger_configuration.each do |key, expected_value|
|
|
85
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
86
|
-
assert_equal expected_value, given_value, key
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
expected_file_parameters.each do |key, expected_value|
|
|
90
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs/#{expected_file_build_tag}/#{key}").text
|
|
91
|
-
assert_equal expected_value, given_value, key
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def test_trigger_paramaterized_with_current_parameters
|
|
96
|
-
builder = JenkinsJob::Builder.new
|
|
97
|
-
|
|
98
|
-
builder.freestyle 'foo' do
|
|
99
|
-
postbuild do
|
|
100
|
-
trigger 'bar' do
|
|
101
|
-
current_parameters true
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
actual = builder.config_as_xml_node('foo')
|
|
107
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs").children.to_s.strip
|
|
108
|
-
expected_config = '<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>'
|
|
109
|
-
assert_equal expected_config, given_value, 'config'
|
|
110
|
-
|
|
111
|
-
expected_trigger_configuration = {
|
|
112
|
-
'projects' => 'bar',
|
|
113
|
-
'condition' => 'SUCCESS',
|
|
114
|
-
'triggerWithNoParameters' => 'false'
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
expected_trigger_configuration.each do |key, expected_value|
|
|
118
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
119
|
-
assert_equal expected_value, given_value, key
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def test_trigger_paramaterized_with_predefined_parameters
|
|
124
|
-
expected_predefined_build_tag = 'hudson.plugins.parameterizedtrigger.PredefinedBuildParameters'
|
|
125
|
-
builder = JenkinsJob::Builder.new
|
|
126
|
-
builder.freestyle 'foo' do
|
|
127
|
-
postbuild do
|
|
128
|
-
trigger 'bar' do
|
|
129
|
-
predefined_parameters 'BUILD_NUM' => '${BUILD_NUMBER}',
|
|
130
|
-
'PACKAGE_VERSION' => '${PACKAGE_VERSION}'
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
actual = builder.config_as_xml_node('foo')
|
|
136
|
-
|
|
137
|
-
expected_predefined_parameters = { 'properties' => "BUILD_NUM=${BUILD_NUMBER}\nPACKAGE_VERSION=${PACKAGE_VERSION}" }
|
|
138
|
-
expected_predefined_parameters.each do |key, expected_value|
|
|
139
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs/#{expected_predefined_build_tag}/#{key}").text
|
|
140
|
-
assert_equal expected_value, given_value, key
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
expected_trigger_configuration = {
|
|
144
|
-
'projects' => 'bar',
|
|
145
|
-
'condition' => 'SUCCESS',
|
|
146
|
-
'triggerWithNoParameters' => 'false'
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
expected_trigger_configuration.each do |key, expected_value|
|
|
150
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
151
|
-
assert_equal expected_value, given_value, key
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
def test_trigger_paramaterized_with_pass_through_git_commit
|
|
156
|
-
builder = JenkinsJob::Builder.new
|
|
157
|
-
builder.freestyle 'foo' do
|
|
158
|
-
postbuild do
|
|
159
|
-
trigger 'bar' do
|
|
160
|
-
pass_through_git_commit
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
actual = builder.config_as_xml_node('foo')
|
|
166
|
-
|
|
167
|
-
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs/hudson.plugins.git.GitRevisionBuildParameters/combineQueuedCommits").text
|
|
168
|
-
assert_equal 'true', given_value
|
|
169
|
-
end
|
|
170
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlPostbuildTrigger < Test::Unit::TestCase
|
|
4
|
+
ROOT = './project/publishers/hudson.plugins.parameterizedtrigger.BuildTrigger/configs'
|
|
5
|
+
TRIGGER_CONFIG = 'hudson.plugins.parameterizedtrigger.BuildTriggerConfig'
|
|
6
|
+
|
|
7
|
+
def test_postbuild_trigger
|
|
8
|
+
builder = JenkinsJob::Builder.new
|
|
9
|
+
|
|
10
|
+
builder.freestyle 'foo' do
|
|
11
|
+
postbuild do
|
|
12
|
+
trigger 'bar' do
|
|
13
|
+
trigger_with_no_parameters true
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
actual = builder.config_as_xml_node('foo')
|
|
19
|
+
|
|
20
|
+
expected_trigger_configuration = {
|
|
21
|
+
'projects' => 'bar',
|
|
22
|
+
'condition' => 'SUCCESS',
|
|
23
|
+
'triggerWithNoParameters' => 'true'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
expected_trigger_configuration.each do |key, expected_value|
|
|
27
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
28
|
+
assert_equal expected_value, given_value, key
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_postbuild_trigger_multiple_projects
|
|
33
|
+
builder = JenkinsJob::Builder.new
|
|
34
|
+
|
|
35
|
+
builder.freestyle 'foo' do
|
|
36
|
+
postbuild do
|
|
37
|
+
trigger 'bar1', 'bar2' do
|
|
38
|
+
trigger_with_no_parameters true
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
actual = builder.config_as_xml_node('foo')
|
|
44
|
+
|
|
45
|
+
expected_trigger_configuration = {
|
|
46
|
+
'projects' => 'bar1,bar2',
|
|
47
|
+
'condition' => 'SUCCESS',
|
|
48
|
+
'triggerWithNoParameters' => 'true'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
expected_trigger_configuration.each do |key, expected_value|
|
|
52
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
53
|
+
assert_equal expected_value, given_value, key
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_trigger_paramaterized_with_file
|
|
58
|
+
expected_file_build_tag = 'hudson.plugins.parameterizedtrigger.FileBuildParameters'
|
|
59
|
+
builder = JenkinsJob::Builder.new
|
|
60
|
+
|
|
61
|
+
builder.freestyle 'foo' do
|
|
62
|
+
postbuild do
|
|
63
|
+
trigger 'bar' do
|
|
64
|
+
file 'env.properties'
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
expected_file_parameters = {
|
|
70
|
+
'propertiesFile' => 'env.properties',
|
|
71
|
+
'failTriggerOnMissing' => 'false',
|
|
72
|
+
'useMatrixChild' => 'false',
|
|
73
|
+
'onlyExactRuns' => 'false'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
expected_trigger_configuration = {
|
|
77
|
+
'projects' => 'bar',
|
|
78
|
+
'condition' => 'SUCCESS',
|
|
79
|
+
'triggerWithNoParameters' => 'false'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
actual = builder.config_as_xml_node('foo')
|
|
83
|
+
|
|
84
|
+
expected_trigger_configuration.each do |key, expected_value|
|
|
85
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
86
|
+
assert_equal expected_value, given_value, key
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
expected_file_parameters.each do |key, expected_value|
|
|
90
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs/#{expected_file_build_tag}/#{key}").text
|
|
91
|
+
assert_equal expected_value, given_value, key
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test_trigger_paramaterized_with_current_parameters
|
|
96
|
+
builder = JenkinsJob::Builder.new
|
|
97
|
+
|
|
98
|
+
builder.freestyle 'foo' do
|
|
99
|
+
postbuild do
|
|
100
|
+
trigger 'bar' do
|
|
101
|
+
current_parameters true
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
actual = builder.config_as_xml_node('foo')
|
|
107
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs").children.to_s.strip
|
|
108
|
+
expected_config = '<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>'
|
|
109
|
+
assert_equal expected_config, given_value, 'config'
|
|
110
|
+
|
|
111
|
+
expected_trigger_configuration = {
|
|
112
|
+
'projects' => 'bar',
|
|
113
|
+
'condition' => 'SUCCESS',
|
|
114
|
+
'triggerWithNoParameters' => 'false'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
expected_trigger_configuration.each do |key, expected_value|
|
|
118
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
119
|
+
assert_equal expected_value, given_value, key
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def test_trigger_paramaterized_with_predefined_parameters
|
|
124
|
+
expected_predefined_build_tag = 'hudson.plugins.parameterizedtrigger.PredefinedBuildParameters'
|
|
125
|
+
builder = JenkinsJob::Builder.new
|
|
126
|
+
builder.freestyle 'foo' do
|
|
127
|
+
postbuild do
|
|
128
|
+
trigger 'bar' do
|
|
129
|
+
predefined_parameters 'BUILD_NUM' => '${BUILD_NUMBER}',
|
|
130
|
+
'PACKAGE_VERSION' => '${PACKAGE_VERSION}'
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
actual = builder.config_as_xml_node('foo')
|
|
136
|
+
|
|
137
|
+
expected_predefined_parameters = { 'properties' => "BUILD_NUM=${BUILD_NUMBER}\nPACKAGE_VERSION=${PACKAGE_VERSION}" }
|
|
138
|
+
expected_predefined_parameters.each do |key, expected_value|
|
|
139
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs/#{expected_predefined_build_tag}/#{key}").text
|
|
140
|
+
assert_equal expected_value, given_value, key
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
expected_trigger_configuration = {
|
|
144
|
+
'projects' => 'bar',
|
|
145
|
+
'condition' => 'SUCCESS',
|
|
146
|
+
'triggerWithNoParameters' => 'false'
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
expected_trigger_configuration.each do |key, expected_value|
|
|
150
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/#{key}").text
|
|
151
|
+
assert_equal expected_value, given_value, key
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def test_trigger_paramaterized_with_pass_through_git_commit
|
|
156
|
+
builder = JenkinsJob::Builder.new
|
|
157
|
+
builder.freestyle 'foo' do
|
|
158
|
+
postbuild do
|
|
159
|
+
trigger 'bar' do
|
|
160
|
+
pass_through_git_commit
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
actual = builder.config_as_xml_node('foo')
|
|
166
|
+
|
|
167
|
+
given_value = actual.xpath("#{ROOT}/#{TRIGGER_CONFIG}/configs/hudson.plugins.git.GitRevisionBuildParameters/combineQueuedCommits").text
|
|
168
|
+
assert_equal 'true', given_value
|
|
169
|
+
end
|
|
170
|
+
end
|
data/test/test_scms.rb
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlScms < Test::Unit::TestCase
|
|
4
|
-
def test_git
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
scms do
|
|
9
|
-
git do
|
|
10
|
-
url 'ssh://bar@gerrit.mycompany.com:29418/a'
|
|
11
|
-
basedir 'a'
|
|
12
|
-
branches '*/master'
|
|
13
|
-
clean true
|
|
14
|
-
end
|
|
15
|
-
git do
|
|
16
|
-
url 'ssh://bar@gerrit.mycompany.com:29418/b'
|
|
17
|
-
basedir 'b'
|
|
18
|
-
branches '*/master'
|
|
19
|
-
clean true
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
actual = builder.config_as_xml_node('foo')
|
|
25
|
-
|
|
26
|
-
expected_class = 'org.jenkinsci.plugins.multiplescms.MultiSCM'
|
|
27
|
-
expected_scm = 'scm'
|
|
28
|
-
scm_nodes = "./project/scm[contains(@class,'#{expected_class}') and @plugin='multiple-scms@0.3']/scms/#{expected_scm}"
|
|
29
|
-
assert_equal 2, actual.xpath("count(#{scm_nodes})").to_i
|
|
30
|
-
end
|
|
31
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlScms < Test::Unit::TestCase
|
|
4
|
+
def test_git
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
scms do
|
|
9
|
+
git do
|
|
10
|
+
url 'ssh://bar@gerrit.mycompany.com:29418/a'
|
|
11
|
+
basedir 'a'
|
|
12
|
+
branches '*/master'
|
|
13
|
+
clean true
|
|
14
|
+
end
|
|
15
|
+
git do
|
|
16
|
+
url 'ssh://bar@gerrit.mycompany.com:29418/b'
|
|
17
|
+
basedir 'b'
|
|
18
|
+
branches '*/master'
|
|
19
|
+
clean true
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
actual = builder.config_as_xml_node('foo')
|
|
25
|
+
|
|
26
|
+
expected_class = 'org.jenkinsci.plugins.multiplescms.MultiSCM'
|
|
27
|
+
expected_scm = 'scm'
|
|
28
|
+
scm_nodes = "./project/scm[contains(@class,'#{expected_class}') and @plugin='multiple-scms@0.3']/scms/#{expected_scm}"
|
|
29
|
+
assert_equal 2, actual.xpath("count(#{scm_nodes})").to_i
|
|
30
|
+
end
|
|
31
|
+
end
|
data/test/test_tap_publisher.rb
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlXTapPublisher < Test::Unit::TestCase
|
|
4
|
-
def test_postbuild_tap_publisher
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
postbuild do
|
|
9
|
-
publish_tap 'TestResultsInTapFormat.tap' do
|
|
10
|
-
verbose true
|
|
11
|
-
require_plan true
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
actual = builder.config_as_xml_node('foo')
|
|
17
|
-
|
|
18
|
-
{ 'testResults' => 'TestResultsInTapFormat.tap',
|
|
19
|
-
'verbose' => 'true',
|
|
20
|
-
'require_plan' => 'true'
|
|
21
|
-
}.each do |k, v|
|
|
22
|
-
assert v, actual.xpath("./project/publishers/org.tap4j.plugin.TapPublisher/#{k}").text
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlXTapPublisher < Test::Unit::TestCase
|
|
4
|
+
def test_postbuild_tap_publisher
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
publish_tap 'TestResultsInTapFormat.tap' do
|
|
10
|
+
verbose true
|
|
11
|
+
require_plan true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
actual = builder.config_as_xml_node('foo')
|
|
17
|
+
|
|
18
|
+
{ 'testResults' => 'TestResultsInTapFormat.tap',
|
|
19
|
+
'verbose' => 'true',
|
|
20
|
+
'require_plan' => 'true'
|
|
21
|
+
}.each do |k, v|
|
|
22
|
+
assert v, actual.xpath("./project/publishers/org.tap4j.plugin.TapPublisher/#{k}").text
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/test/test_timed.rb
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlTimed < Test::Unit::TestCase
|
|
4
|
-
def test_timed
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
timed '*/5 * * * *'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
actual = builder.config_as_xml_node('foo')
|
|
12
|
-
|
|
13
|
-
assert_equal '*/5 * * * *', actual.xpath('./project/triggers/hudson.triggers.TimerTrigger/spec').text
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlTimed < Test::Unit::TestCase
|
|
4
|
+
def test_timed
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
timed '*/5 * * * *'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
actual = builder.config_as_xml_node('foo')
|
|
12
|
+
|
|
13
|
+
assert_equal '*/5 * * * *', actual.xpath('./project/triggers/hudson.triggers.TimerTrigger/spec').text
|
|
14
|
+
end
|
|
15
|
+
end
|
data/test/test_timeout.rb
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlTimeout < Test::Unit::TestCase
|
|
4
|
-
def test_timeout
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
timeout 'elastic' do
|
|
9
|
-
elastic_percentage 200
|
|
10
|
-
elastic_default_timeout 30
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
actual = builder.config_as_xml_node('foo')
|
|
15
|
-
{ 'timeoutMinutes' => '3', 'failBuild' => 'false', 'writingDescription' => 'false', 'timeoutPercentage' => '200',
|
|
16
|
-
'timeoutMinutesElasticDefault' => '30', 'timeoutType' => 'elastic' }.each do |k, v|
|
|
17
|
-
assert_equal v, actual.xpath("./project/buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/#{k}").text, k
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlTimeout < Test::Unit::TestCase
|
|
4
|
+
def test_timeout
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
timeout 'elastic' do
|
|
9
|
+
elastic_percentage 200
|
|
10
|
+
elastic_default_timeout 30
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
actual = builder.config_as_xml_node('foo')
|
|
15
|
+
{ 'timeoutMinutes' => '3', 'failBuild' => 'false', 'writingDescription' => 'false', 'timeoutPercentage' => '200',
|
|
16
|
+
'timeoutMinutesElasticDefault' => '30', 'timeoutType' => 'elastic' }.each do |k, v|
|
|
17
|
+
assert_equal v, actual.xpath("./project/buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/#{k}").text, k
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/test/test_timestamps.rb
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlTimestamps < Test::Unit::TestCase
|
|
4
|
-
def test_timestamps
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
timestamps
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
actual = builder.config_as_xml_node('foo')
|
|
12
|
-
assert actual.at('./project/buildWrappers/hudson.plugins.timestamper.TimestamperBuildWrapper')
|
|
13
|
-
end
|
|
14
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlTimestamps < Test::Unit::TestCase
|
|
4
|
+
def test_timestamps
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
timestamps
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
actual = builder.config_as_xml_node('foo')
|
|
12
|
+
assert actual.at('./project/buildWrappers/hudson.plugins.timestamper.TimestamperBuildWrapper')
|
|
13
|
+
end
|
|
14
|
+
end
|