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.
Files changed (112) hide show
  1. checksums.yaml +5 -13
  2. data/Gemfile +6 -6
  3. data/Gemfile.lock +41 -41
  4. data/LICENSE +18 -18
  5. data/Rakefile +12 -12
  6. data/docs/common.md +313 -313
  7. data/docs/flow.md +17 -17
  8. data/docs/freestyle.md +100 -100
  9. data/docs/gerrit.md +70 -70
  10. data/docs/git.md +88 -88
  11. data/docs/multi.md +26 -26
  12. data/docs/overview.md +74 -74
  13. data/docs/postbuild.md +266 -266
  14. data/docs/view.md +13 -13
  15. data/lib/rubyjobbuilderdsl/buildstep/ant.rb +29 -29
  16. data/lib/rubyjobbuilderdsl/buildstep/copyartifact.rb +23 -23
  17. data/lib/rubyjobbuilderdsl/buildstep/inject_env.rb +18 -18
  18. data/lib/rubyjobbuilderdsl/buildstep/phase.rb +19 -19
  19. data/lib/rubyjobbuilderdsl/buildstep/phase_job.rb +26 -26
  20. data/lib/rubyjobbuilderdsl/buildstep/shell.rb +24 -24
  21. data/lib/rubyjobbuilderdsl/buildstep/xvfb.rb +46 -46
  22. data/lib/rubyjobbuilderdsl/common/artifactory.rb +33 -33
  23. data/lib/rubyjobbuilderdsl/common/blocking_job.rb +11 -11
  24. data/lib/rubyjobbuilderdsl/common/build_timeout.rb +23 -23
  25. data/lib/rubyjobbuilderdsl/common/gerrit.rb +53 -53
  26. data/lib/rubyjobbuilderdsl/common/git.rb +76 -76
  27. data/lib/rubyjobbuilderdsl/common/logrotate.rb +24 -24
  28. data/lib/rubyjobbuilderdsl/common/parameter.rb +22 -22
  29. data/lib/rubyjobbuilderdsl/common/password.rb +12 -12
  30. data/lib/rubyjobbuilderdsl/common/pollscm.rb +10 -10
  31. data/lib/rubyjobbuilderdsl/common/scms.rb +18 -18
  32. data/lib/rubyjobbuilderdsl/common/throttle.rb +24 -24
  33. data/lib/rubyjobbuilderdsl/common/timed.rb +10 -10
  34. data/lib/rubyjobbuilderdsl/common/timestamps.rb +6 -6
  35. data/lib/rubyjobbuilderdsl/common.rb +140 -140
  36. data/lib/rubyjobbuilderdsl/deployer.rb +95 -95
  37. data/lib/rubyjobbuilderdsl/flow.rb +14 -14
  38. data/lib/rubyjobbuilderdsl/freestyle.rb +65 -65
  39. data/lib/rubyjobbuilderdsl/jenkins_client.rb +203 -203
  40. data/lib/rubyjobbuilderdsl/multijob.rb +24 -24
  41. data/lib/rubyjobbuilderdsl/postbuild/archive.rb +23 -23
  42. data/lib/rubyjobbuilderdsl/postbuild/chucknorris_publisher.rb +6 -6
  43. data/lib/rubyjobbuilderdsl/postbuild/claim_publisher.rb +6 -6
  44. data/lib/rubyjobbuilderdsl/postbuild/cloverphp_publisher.rb +36 -36
  45. data/lib/rubyjobbuilderdsl/postbuild/cucumber_json_publisher.rb +20 -20
  46. data/lib/rubyjobbuilderdsl/postbuild/email_publisher.rb +23 -23
  47. data/lib/rubyjobbuilderdsl/postbuild/game_publisher.rb +6 -6
  48. data/lib/rubyjobbuilderdsl/postbuild/groovy.rb +10 -10
  49. data/lib/rubyjobbuilderdsl/postbuild/html_publisher.rb +27 -27
  50. data/lib/rubyjobbuilderdsl/postbuild/javadoc_publisher.rb +19 -19
  51. data/lib/rubyjobbuilderdsl/postbuild/logparser.rb +21 -21
  52. data/lib/rubyjobbuilderdsl/postbuild/nunit_publisher.rb +21 -21
  53. data/lib/rubyjobbuilderdsl/postbuild/pmd_publisher.rb +19 -19
  54. data/lib/rubyjobbuilderdsl/postbuild/script.rb +14 -14
  55. data/lib/rubyjobbuilderdsl/postbuild/tap_publisher.rb +44 -44
  56. data/lib/rubyjobbuilderdsl/postbuild/trigger.rb +38 -38
  57. data/lib/rubyjobbuilderdsl/postbuild/xunit_publisher.rb +35 -35
  58. data/lib/rubyjobbuilderdsl/postbuild.rb +160 -160
  59. data/lib/rubyjobbuilderdsl/view.rb +14 -14
  60. data/lib/rubyjobbuilderdsl/xml_generator.rb +1 -1
  61. data/lib/rubyjobbuilderdsl.rb +2 -2
  62. data/rubyjobbuilderdsl-0.0.3.gem +0 -0
  63. data/rubyjobbuilderdsl.gemspec +13 -13
  64. data/rubyjobbuilderdsl.sublime-project +14 -14
  65. data/run_tests.sh +7 -7
  66. data/sample/Schedule-sample-pipeline.xml +32 -0
  67. data/sample/hello_mars.rb +27 -27
  68. data/sample/local.ini +4 -4
  69. data/test/test_ant.rb +38 -38
  70. data/test/test_archive.rb +24 -24
  71. data/test/test_artifactory.rb +26 -26
  72. data/test/test_blocking_job.rb +18 -18
  73. data/test/test_chucknorris_publisher.rb +17 -17
  74. data/test/test_claim_publisher.rb +17 -17
  75. data/test/test_cloverphp.rb +33 -33
  76. data/test/test_concurrent.rb +44 -44
  77. data/test/test_copyartifact.rb +45 -45
  78. data/test/test_cucumber_json_publisher.rb +30 -30
  79. data/test/test_default_setting.rb +29 -29
  80. data/test/test_email_publisher.rb +44 -44
  81. data/test/test_flow.rb +19 -19
  82. data/test/test_freestyle.rb +52 -52
  83. data/test/test_game_publisher.rb +17 -17
  84. data/test/test_gerrit.rb +117 -117
  85. data/test/test_git.rb +80 -80
  86. data/test/test_html_publisher.rb +57 -57
  87. data/test/test_inject.rb +23 -23
  88. data/test/test_javadoc.rb +22 -22
  89. data/test/test_logparser.rb +24 -24
  90. data/test/test_logrotate.rb +22 -22
  91. data/test/test_multijob.rb +50 -50
  92. data/test/test_nunit_publisher.rb +20 -20
  93. data/test/test_parameter.rb +44 -44
  94. data/test/test_password.rb +17 -17
  95. data/test/test_pmd.rb +22 -22
  96. data/test/test_pollscm.rb +15 -15
  97. data/test/test_postbuild_groovy.rb +21 -21
  98. data/test/test_postbuild_script.rb +24 -24
  99. data/test/test_postbuild_trigger.rb +170 -170
  100. data/test/test_scms.rb +31 -31
  101. data/test/test_tap_publisher.rb +25 -25
  102. data/test/test_timed.rb +15 -15
  103. data/test/test_timeout.rb +20 -20
  104. data/test/test_timestamps.rb +14 -14
  105. data/test/test_xml_generator.rb +28 -28
  106. data/test/test_xunit_publisher.rb +22 -22
  107. data/test/test_xvfb.rb +35 -35
  108. metadata +9 -11
  109. data/sample/hello_mars.xml +0 -18
  110. data/sample/hello_world-post.xml +0 -40
  111. data/sample/sample_flow.rb +0 -15
  112. data/sample/test.xml +0 -21
data/docs/common.md CHANGED
@@ -1,313 +1,313 @@
1
- ## Common vocabulary
2
-
3
- Common keywords are applicable for both freestyle job and flow job.
4
-
5
- **artifactory**
6
-
7
- Description: Deploy artifacts to jfrog artifactory server
8
-
9
- Multiple: Override
10
-
11
- Example
12
-
13
- builder.freestyle 'hello_world-build' do
14
- artifactory do
15
- server 'artifactory.acme.com'
16
- repository 'dev'
17
- deploy 'hello_world-1.0.$BUILD_NUMBER.zip'
18
- end
19
- end
20
-
21
- **blocked_by**
22
-
23
- Description: Block build if certain specified jobs are running
24
-
25
- Multiple: Add
26
-
27
- Example
28
-
29
- builder.freestyle 'hello_world-deploy' do
30
- blocked_by 'hello_world-sevicetest'
31
- end
32
-
33
- **Builder**
34
-
35
- Description: We create builder instance that will be used later to build jobs
36
-
37
- Multiple: N/A
38
-
39
- Example
40
-
41
- require 'rubyjobbuilderdsl'
42
- builder = JenkinsJob::Builder.new
43
-
44
- **concurrent**
45
-
46
- Description: Specify condition for multiple builds of the same job to run concurrently across all nodes of the same category
47
-
48
- Multiple: Override
49
-
50
- Example
51
-
52
- builder.freestyle 'hello_world-servicetest' do
53
- concurrent do
54
- max_per_node 1
55
- max_total 0
56
- category 'servicetest'
57
- end
58
- end
59
-
60
- **concurrent**
61
-
62
- Description: Specify condition for multiple builds of the same job to run concurrently across all nodes of the same project
63
-
64
- Multiple: Override
65
-
66
- Example
67
-
68
- builder.freestyle 'hello_world-build' do
69
- concurrent do
70
- max_per_node 2
71
- max_total 0
72
- end
73
- end
74
-
75
- **Deployer**
76
-
77
- Description: We create deployer instance that will be used to generate/deploy jobs config
78
-
79
- Multiple: N/A
80
-
81
- Example
82
-
83
- require 'rubyjobbuilderdsl'
84
- check_builder = JenkinsJob::Builder.new
85
- worker_builder = JenkinsJob::Builder.new
86
- JenkinsJob::Deployer.new(check_builder, worker_builder).run
87
-
88
-
89
- **Desc**
90
-
91
- Description: Specify project's description
92
-
93
- Multiple: Override
94
-
95
- Example
96
-
97
- builder.freestyle 'hello_world-build' do
98
- desc 'this is a hello world project'
99
- end
100
-
101
- **flow**
102
-
103
- Description: Add Create a flow job
104
-
105
- Multiple: Add
106
-
107
- Example
108
-
109
- builder.flow 'hello_world-check' do
110
- end
111
-
112
- **freestyle**
113
-
114
- Description: Add Create a freestyle job
115
-
116
- Multiple: Add
117
-
118
- Example
119
-
120
- builder.freestyle 'hello_world-build' do
121
- end
122
-
123
- **gerrit**
124
-
125
- Description: trigger the job on Gerrit event
126
-
127
- Multiple: Override
128
-
129
- Example
130
-
131
- builder.flow 'hello_world-post' do
132
- gerrit do
133
- end
134
- end
135
-
136
-
137
- **git**
138
-
139
- Description: Configure Git version as SCM
140
-
141
- Multiple: Override
142
-
143
- Example:
144
-
145
- builder.freestyle 'hello_world-master' do
146
- git do
147
- end
148
- end
149
-
150
- **logrotate**
151
-
152
- Description: Rotate/discard old builds
153
-
154
- Multiple: Override
155
-
156
- Example:
157
-
158
- builder.freestyle 'hello_world-master' do
159
- logrotate do
160
- days_to_keep 14
161
- num_to_keep -1
162
- artifact_days_to_keep 2
163
- artifact_num_to_keep -1
164
- end
165
- end
166
-
167
- **node**
168
-
169
- Description: Run a job on specific node or kind of nodes
170
-
171
- Multiple: Override
172
-
173
- Example:
174
-
175
- builder.freestyle 'hello_world-build' do
176
- node 'windows'
177
- end
178
-
179
- **parameter**
180
-
181
- Description: Create parameter for a job
182
-
183
- Multiple: Add
184
-
185
- Example:
186
-
187
- builder.freestyle 'hello_world-check' do
188
- parameter 'GERRIT_BRANCH' do
189
- default 'master'
190
- end
191
- parameter 'GERRIT_REFSPEC' do
192
- default 'refs/heads/${GERRIT_BRANCH}'
193
- end
194
- end
195
-
196
- **password**
197
-
198
- Description: Specify password encrypted by jenkins, that is decrypted when being retrieved via environment variable
199
-
200
- Multiple: Override
201
-
202
- Example:
203
-
204
- builder.freestyle 'hello_world-deploy' do
205
- password 'ADMIN', 'PhxHFCjgSiXR2umXhALLq+RzqJBxODDJT4t9Tw5JXbI='
206
- end
207
-
208
- **password_parameter**
209
-
210
- Description: Create a parameter for password for a job
211
-
212
- Multiple: Add
213
-
214
- Example:
215
-
216
- builder.freestyle 'hello_world-check' do
217
- password_parameter 'PASS' do
218
- default 'xyz#'
219
- end
220
- end
221
-
222
- **pollscm**
223
-
224
- Description: Specify SCM polling frequency in crontab format
225
-
226
- Multiple: Override
227
-
228
- Example:
229
-
230
- builder.freestyle 'hello_world-master' do
231
- pollscm '*/5 * * * *'
232
- end
233
-
234
- **postbuild**
235
-
236
- Description: Create post build actions freestyle/flow
237
-
238
- Multiple: Merged
239
-
240
- Example:
241
-
242
- builder.freestyle 'hello_world-master' do
243
- postbuild do
244
- end
245
- end
246
-
247
- **quiet_period**
248
-
249
- Description: Wait a specified period in seconds before running freestyle/flow
250
-
251
- Multiple: Override
252
-
253
- Example:
254
-
255
- builder.freestyle 'hello_world-build' do
256
- quiet_period 5
257
- end
258
-
259
- **scms**
260
-
261
- Description: Configure multiple SCM's
262
-
263
- Multiple: Override
264
-
265
- Example:
266
-
267
- builder.freestyle 'hello_world-master' do
268
- scms do
269
- git do
270
- end
271
- git do
272
- end
273
- end
274
- end
275
-
276
- **timed**
277
-
278
- Description: Specify frequency to run a build in crontab format freestyle/flow
279
-
280
- Multiple: Override
281
-
282
- Example:
283
-
284
- builder.freestyle 'hello_world-master' do
285
- timed '*/5 * * * *'
286
- end
287
-
288
- **timeout**
289
-
290
- Description: Specify elastic timeout as percentage of last 3 successful builds or absolute value in minutes if they are not available
291
-
292
- Multiple: Override
293
-
294
- Example:
295
-
296
- builder.freestyle 'hello_world-build' do
297
- timeout 'elastic' do
298
- elastic_percentage 200
299
- elastic_default_timeout 30
300
- end
301
- end
302
-
303
- **timestamps**
304
-
305
- Description: Show time stamp for build's console log
306
-
307
- Multiple: Override
308
-
309
- Example:
310
-
311
- builder.freestyle 'hello_world-build' do
312
- timestamps
313
- end
1
+ ## Common vocabulary
2
+
3
+ Common keywords are applicable for both freestyle job and flow job.
4
+
5
+ **artifactory**
6
+
7
+ Description: Deploy artifacts to jfrog artifactory server
8
+
9
+ Multiple: Override
10
+
11
+ Example
12
+
13
+ builder.freestyle 'hello_world-build' do
14
+ artifactory do
15
+ server 'artifactory.acme.com'
16
+ repository 'dev'
17
+ deploy 'hello_world-1.0.$BUILD_NUMBER.zip'
18
+ end
19
+ end
20
+
21
+ **blocked_by**
22
+
23
+ Description: Block build if certain specified jobs are running
24
+
25
+ Multiple: Add
26
+
27
+ Example
28
+
29
+ builder.freestyle 'hello_world-deploy' do
30
+ blocked_by 'hello_world-sevicetest'
31
+ end
32
+
33
+ **Builder**
34
+
35
+ Description: We create builder instance that will be used later to build jobs
36
+
37
+ Multiple: N/A
38
+
39
+ Example
40
+
41
+ require 'rubyjobbuilderdsl'
42
+ builder = JenkinsJob::Builder.new
43
+
44
+ **concurrent**
45
+
46
+ Description: Specify condition for multiple builds of the same job to run concurrently across all nodes of the same category
47
+
48
+ Multiple: Override
49
+
50
+ Example
51
+
52
+ builder.freestyle 'hello_world-servicetest' do
53
+ concurrent do
54
+ max_per_node 1
55
+ max_total 0
56
+ category 'servicetest'
57
+ end
58
+ end
59
+
60
+ **concurrent**
61
+
62
+ Description: Specify condition for multiple builds of the same job to run concurrently across all nodes of the same project
63
+
64
+ Multiple: Override
65
+
66
+ Example
67
+
68
+ builder.freestyle 'hello_world-build' do
69
+ concurrent do
70
+ max_per_node 2
71
+ max_total 0
72
+ end
73
+ end
74
+
75
+ **Deployer**
76
+
77
+ Description: We create deployer instance that will be used to generate/deploy jobs config
78
+
79
+ Multiple: N/A
80
+
81
+ Example
82
+
83
+ require 'rubyjobbuilderdsl'
84
+ check_builder = JenkinsJob::Builder.new
85
+ worker_builder = JenkinsJob::Builder.new
86
+ JenkinsJob::Deployer.new(check_builder, worker_builder).run
87
+
88
+
89
+ **Desc**
90
+
91
+ Description: Specify project's description
92
+
93
+ Multiple: Override
94
+
95
+ Example
96
+
97
+ builder.freestyle 'hello_world-build' do
98
+ desc 'this is a hello world project'
99
+ end
100
+
101
+ **flow**
102
+
103
+ Description: Add Create a flow job
104
+
105
+ Multiple: Add
106
+
107
+ Example
108
+
109
+ builder.flow 'hello_world-check' do
110
+ end
111
+
112
+ **freestyle**
113
+
114
+ Description: Add Create a freestyle job
115
+
116
+ Multiple: Add
117
+
118
+ Example
119
+
120
+ builder.freestyle 'hello_world-build' do
121
+ end
122
+
123
+ **gerrit**
124
+
125
+ Description: trigger the job on Gerrit event
126
+
127
+ Multiple: Override
128
+
129
+ Example
130
+
131
+ builder.flow 'hello_world-post' do
132
+ gerrit do
133
+ end
134
+ end
135
+
136
+
137
+ **git**
138
+
139
+ Description: Configure Git version as SCM
140
+
141
+ Multiple: Override
142
+
143
+ Example:
144
+
145
+ builder.freestyle 'hello_world-master' do
146
+ git do
147
+ end
148
+ end
149
+
150
+ **logrotate**
151
+
152
+ Description: Rotate/discard old builds
153
+
154
+ Multiple: Override
155
+
156
+ Example:
157
+
158
+ builder.freestyle 'hello_world-master' do
159
+ logrotate do
160
+ days_to_keep 14
161
+ num_to_keep -1
162
+ artifact_days_to_keep 2
163
+ artifact_num_to_keep -1
164
+ end
165
+ end
166
+
167
+ **node**
168
+
169
+ Description: Run a job on specific node or kind of nodes
170
+
171
+ Multiple: Override
172
+
173
+ Example:
174
+
175
+ builder.freestyle 'hello_world-build' do
176
+ node 'windows'
177
+ end
178
+
179
+ **parameter**
180
+
181
+ Description: Create parameter for a job
182
+
183
+ Multiple: Add
184
+
185
+ Example:
186
+
187
+ builder.freestyle 'hello_world-check' do
188
+ parameter 'GERRIT_BRANCH' do
189
+ default 'master'
190
+ end
191
+ parameter 'GERRIT_REFSPEC' do
192
+ default 'refs/heads/${GERRIT_BRANCH}'
193
+ end
194
+ end
195
+
196
+ **password**
197
+
198
+ Description: Specify password encrypted by jenkins, that is decrypted when being retrieved via environment variable
199
+
200
+ Multiple: Override
201
+
202
+ Example:
203
+
204
+ builder.freestyle 'hello_world-deploy' do
205
+ password 'ADMIN', 'PhxHFCjgSiXR2umXhALLq+RzqJBxODDJT4t9Tw5JXbI='
206
+ end
207
+
208
+ **password_parameter**
209
+
210
+ Description: Create a parameter for password for a job
211
+
212
+ Multiple: Add
213
+
214
+ Example:
215
+
216
+ builder.freestyle 'hello_world-check' do
217
+ password_parameter 'PASS' do
218
+ default 'xyz#'
219
+ end
220
+ end
221
+
222
+ **pollscm**
223
+
224
+ Description: Specify SCM polling frequency in crontab format
225
+
226
+ Multiple: Override
227
+
228
+ Example:
229
+
230
+ builder.freestyle 'hello_world-master' do
231
+ pollscm '*/5 * * * *'
232
+ end
233
+
234
+ **postbuild**
235
+
236
+ Description: Create post build actions freestyle/flow
237
+
238
+ Multiple: Merged
239
+
240
+ Example:
241
+
242
+ builder.freestyle 'hello_world-master' do
243
+ postbuild do
244
+ end
245
+ end
246
+
247
+ **quiet_period**
248
+
249
+ Description: Wait a specified period in seconds before running freestyle/flow
250
+
251
+ Multiple: Override
252
+
253
+ Example:
254
+
255
+ builder.freestyle 'hello_world-build' do
256
+ quiet_period 5
257
+ end
258
+
259
+ **scms**
260
+
261
+ Description: Configure multiple SCM's
262
+
263
+ Multiple: Override
264
+
265
+ Example:
266
+
267
+ builder.freestyle 'hello_world-master' do
268
+ scms do
269
+ git do
270
+ end
271
+ git do
272
+ end
273
+ end
274
+ end
275
+
276
+ **timed**
277
+
278
+ Description: Specify frequency to run a build in crontab format freestyle/flow
279
+
280
+ Multiple: Override
281
+
282
+ Example:
283
+
284
+ builder.freestyle 'hello_world-master' do
285
+ timed '*/5 * * * *'
286
+ end
287
+
288
+ **timeout**
289
+
290
+ Description: Specify elastic timeout as percentage of last 3 successful builds or absolute value in minutes if they are not available
291
+
292
+ Multiple: Override
293
+
294
+ Example:
295
+
296
+ builder.freestyle 'hello_world-build' do
297
+ timeout 'elastic' do
298
+ elastic_percentage 200
299
+ elastic_default_timeout 30
300
+ end
301
+ end
302
+
303
+ **timestamps**
304
+
305
+ Description: Show time stamp for build's console log
306
+
307
+ Multiple: Override
308
+
309
+ Example:
310
+
311
+ builder.freestyle 'hello_world-build' do
312
+ timestamps
313
+ end
data/docs/flow.md CHANGED
@@ -1,18 +1,18 @@
1
- ## Create build flow style project
2
-
3
- **dsl**
4
-
5
- Description: Specify groovy DSL for a flow job
6
-
7
- Multiple: Override
8
-
9
- Example
10
-
11
- builder.flow 'hello_world-post' do
12
- dsl <<EOS
13
- build("hello_worl-" + params["GERRIT_BRANCH"],
14
- GERRIT_REFSPEC: "refs/heads/${params["GERRIT_BRANCH"]}",
15
- GERRIT_BRANCH: params["GERRIT_BRANCH"])
16
- EOS
17
-
1
+ ## Create build flow style project
2
+
3
+ **dsl**
4
+
5
+ Description: Specify groovy DSL for a flow job
6
+
7
+ Multiple: Override
8
+
9
+ Example
10
+
11
+ builder.flow 'hello_world-post' do
12
+ dsl <<EOS
13
+ build("hello_worl-" + params["GERRIT_BRANCH"],
14
+ GERRIT_REFSPEC: "refs/heads/${params["GERRIT_BRANCH"]}",
15
+ GERRIT_BRANCH: params["GERRIT_BRANCH"])
16
+ EOS
17
+
18
18
  end