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/freestyle.md CHANGED
@@ -1,100 +1,100 @@
1
- ## Create free style project
2
-
3
- **ant**
4
-
5
- Description: Run ant task
6
-
7
- Multiple: Add
8
-
9
- Example
10
-
11
- builder.freestyle 'hello_world-build' do
12
- ant do
13
- target 'clean', 'lint'
14
- buildfile 'nightly.xml'
15
- java_opts '-Xmx512m', '-Xms512m'
16
- property 'skipTest' => 'false'
17
- end
18
- end
19
-
20
- **batch**
21
-
22
- Description: Run batch command
23
-
24
- Multiple: Add
25
-
26
- Example
27
-
28
- builder.freestyle 'hello_world-master' do
29
- batch 'sc.exe query'
30
- end
31
-
32
- **copyartifact**
33
-
34
- Description: Copy artifact from other build
35
-
36
- Multiple: Add
37
-
38
- Example
39
-
40
- builder.freestyle 'hello_world-servicetest' do
41
- copyartifact '$ARTIFACT_JOB' do
42
- build_number '$ARTIFACT_BUILD_NUMBER'
43
- file 'package/**',
44
- 'output/**'
45
- to '$BUILD_NUMBER'
46
- end
47
- end
48
-
49
- **inject_env**
50
-
51
- Description: Create environment variable that persists in the build
52
-
53
- Multiple: Add
54
-
55
- Example
56
-
57
- builder.freestyle 'hello_world-build' do
58
- inject_env do
59
- properties_content 'EXAMPLE=foo'
60
- properties_file 'env.prop'
61
- end
62
- end
63
-
64
- **powershell**
65
-
66
- Description: Run Powershell command
67
-
68
- Multiple: Add
69
-
70
- Example
71
-
72
- builder.freestyle 'hello_world-master' do
73
- powershell 'Get-Service MSQL* | foreach { sc.exe stop $_.Name }'
74
- end
75
-
76
- **shell**
77
-
78
- Description: Run shell command
79
-
80
- Multiple: Add
81
-
82
- Example
83
-
84
- builder.freestyle 'ops-master' do
85
- shell 'rm -rf * || true'
86
- end
87
-
88
- **workspace**
89
-
90
- Description: Set custom workspace for job
91
-
92
- Multiple: Override
93
-
94
- Example
95
-
96
- builder.freestyle 'ops-master' do
97
- workspace 'ops-m'
98
- end
99
-
100
-
1
+ ## Create free style project
2
+
3
+ **ant**
4
+
5
+ Description: Run ant task
6
+
7
+ Multiple: Add
8
+
9
+ Example
10
+
11
+ builder.freestyle 'hello_world-build' do
12
+ ant do
13
+ target 'clean', 'lint'
14
+ buildfile 'nightly.xml'
15
+ java_opts '-Xmx512m', '-Xms512m'
16
+ property 'skipTest' => 'false'
17
+ end
18
+ end
19
+
20
+ **batch**
21
+
22
+ Description: Run batch command
23
+
24
+ Multiple: Add
25
+
26
+ Example
27
+
28
+ builder.freestyle 'hello_world-master' do
29
+ batch 'sc.exe query'
30
+ end
31
+
32
+ **copyartifact**
33
+
34
+ Description: Copy artifact from other build
35
+
36
+ Multiple: Add
37
+
38
+ Example
39
+
40
+ builder.freestyle 'hello_world-servicetest' do
41
+ copyartifact '$ARTIFACT_JOB' do
42
+ build_number '$ARTIFACT_BUILD_NUMBER'
43
+ file 'package/**',
44
+ 'output/**'
45
+ to '$BUILD_NUMBER'
46
+ end
47
+ end
48
+
49
+ **inject_env**
50
+
51
+ Description: Create environment variable that persists in the build
52
+
53
+ Multiple: Add
54
+
55
+ Example
56
+
57
+ builder.freestyle 'hello_world-build' do
58
+ inject_env do
59
+ properties_content 'EXAMPLE=foo'
60
+ properties_file 'env.prop'
61
+ end
62
+ end
63
+
64
+ **powershell**
65
+
66
+ Description: Run Powershell command
67
+
68
+ Multiple: Add
69
+
70
+ Example
71
+
72
+ builder.freestyle 'hello_world-master' do
73
+ powershell 'Get-Service MSQL* | foreach { sc.exe stop $_.Name }'
74
+ end
75
+
76
+ **shell**
77
+
78
+ Description: Run shell command
79
+
80
+ Multiple: Add
81
+
82
+ Example
83
+
84
+ builder.freestyle 'ops-master' do
85
+ shell 'rm -rf * || true'
86
+ end
87
+
88
+ **workspace**
89
+
90
+ Description: Set custom workspace for job
91
+
92
+ Multiple: Override
93
+
94
+ Example
95
+
96
+ builder.freestyle 'ops-master' do
97
+ workspace 'ops-m'
98
+ end
99
+
100
+
data/docs/gerrit.md CHANGED
@@ -1,70 +1,70 @@
1
- ## Configure job to act on gerrit event
2
-
3
- **change_merged**
4
-
5
- Description: trigger the job on Gerrit change_merged event
6
-
7
- Multiple: Override
8
-
9
- Example
10
-
11
- builder.flow 'hello_world-post' do
12
- gerrit do
13
- change_merged
14
- project 'hello_world' do
15
- branch 'master','release'
16
- end
17
- end
18
- end
19
-
20
- **comment_added**
21
-
22
- Description: trigger the job on Gerrit comment_added event
23
-
24
- Multiple: Override
25
-
26
- Example
27
-
28
- builder.flow 'hello_world-gate' do
29
- gerrit do
30
- comment_added 'Code-Review' => '2'
31
- project 'hello_world' do
32
- branch 'master','release'
33
- end
34
- end
35
- end
36
-
37
- **patchset_uploaded**
38
-
39
- Description: trigger the job on Gerrit patchset_uploaded event
40
-
41
- Multiple: Override
42
-
43
- Example
44
-
45
- builder.flow 'hello_world-build' do
46
- gerrit do
47
- patchset_uploaded
48
- project 'hello_world' do
49
- branch 'master','release'
50
- end
51
- end
52
- end
53
-
54
- **project**
55
-
56
- Description: Specify a Gerrit event filter that trigger the job
57
-
58
- Multiple: Override
59
-
60
- Example
61
-
62
- builder.flow 'salesforce-post' do
63
- gerrit do
64
- project 'poland/technicalcomponents' do
65
- branch 'master','release'
66
- file 'src/Salesforce/**',
67
- 'src/Db/Salesforce/**'
68
- end
69
- end
70
- end
1
+ ## Configure job to act on gerrit event
2
+
3
+ **change_merged**
4
+
5
+ Description: trigger the job on Gerrit change_merged event
6
+
7
+ Multiple: Override
8
+
9
+ Example
10
+
11
+ builder.flow 'hello_world-post' do
12
+ gerrit do
13
+ change_merged
14
+ project 'hello_world' do
15
+ branch 'master','release'
16
+ end
17
+ end
18
+ end
19
+
20
+ **comment_added**
21
+
22
+ Description: trigger the job on Gerrit comment_added event
23
+
24
+ Multiple: Override
25
+
26
+ Example
27
+
28
+ builder.flow 'hello_world-gate' do
29
+ gerrit do
30
+ comment_added 'Code-Review' => '2'
31
+ project 'hello_world' do
32
+ branch 'master','release'
33
+ end
34
+ end
35
+ end
36
+
37
+ **patchset_uploaded**
38
+
39
+ Description: trigger the job on Gerrit patchset_uploaded event
40
+
41
+ Multiple: Override
42
+
43
+ Example
44
+
45
+ builder.flow 'hello_world-build' do
46
+ gerrit do
47
+ patchset_uploaded
48
+ project 'hello_world' do
49
+ branch 'master','release'
50
+ end
51
+ end
52
+ end
53
+
54
+ **project**
55
+
56
+ Description: Specify a Gerrit event filter that trigger the job
57
+
58
+ Multiple: Override
59
+
60
+ Example
61
+
62
+ builder.flow 'salesforce-post' do
63
+ gerrit do
64
+ project 'poland/technicalcomponents' do
65
+ branch 'master','release'
66
+ file 'src/Salesforce/**',
67
+ 'src/Db/Salesforce/**'
68
+ end
69
+ end
70
+ end
data/docs/git.md CHANGED
@@ -1,88 +1,88 @@
1
- ## Configure Git SCM
2
-
3
- **git**
4
-
5
- Description: Configure Git version as SCM
6
-
7
- Multiple: Override
8
-
9
- Example
10
-
11
- builder.freestyle 'hello_world-master' do
12
- git do
13
- url 'ssh://builduser@gerrit.acme.com:29418/hello_world'
14
- basedir 'hello_world'
15
- reference_repo '$HOME/hello_world.git'
16
- branches '$GERRIT_BRANCH'
17
- refspec '$GERRIT_REFSPEC'
18
- choosing_strategy 'gerrit'
19
- git_config_name 'foo'
20
- git_config_email 'foo@acme.com'
21
- end
22
- end
23
-
24
- **jgit**
25
-
26
- Description: Configure Git version as SCM using jgit. Credentials must be created with the specified id using groovy script
27
-
28
- Multiple: Override
29
-
30
- Example
31
-
32
- builder.freestyle 'hello_world-master' do
33
- git do
34
- url 'ssh://builduser@gerrit.acme.com:29418/hello_world'
35
- basedir 'hello_world'
36
- reference_repo '$HOME/hello_world.git'
37
- branches '$GERRIT_BRANCH'
38
- refspec '$GERRIT_REFSPEC'
39
- choosing_strategy 'gerrit'
40
- git_config_name 'foo'
41
- git_config_email 'foo@acme.com'
42
- jgit
43
- credentials 'foo'
44
- end
45
- end
46
-
47
- Example of creating credentials
48
-
49
- import jenkins.model.*
50
- import hudson.plugins.sshslaves.*
51
- import com.cloudbees.plugins.credentials.*
52
- import com.cloudbees.plugins.credentials.common.*
53
- import com.cloudbees.plugins.credentials.domains.*
54
- import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
55
-
56
- domain = Domain.global()
57
- store = Jenkins.instance.getExtensionList(
58
- 'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
59
- )[0].getStore()
60
-
61
- username = credentialsId = 'foo'
62
- passphrase = description = null
63
-
64
- privateKey = """
65
- -----BEGIN RSA PRIVATE KEY-----
66
- MIIEoQIBAAKCAQEAyTsKNPUc4GkfZjNlLmLpuS+wecpCQOJs7MubPoNGk5F0cK4Q
67
- ...
68
- -----END RSA PRIVATE KEY-----
69
- """
70
-
71
- credentials = new BasicSSHUserPrivateKey(
72
- CredentialsScope.GLOBAL,
73
- credentialsId,
74
- username,
75
- new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(privateKey),
76
- passphrase,
77
- description
78
- )
79
-
80
- existing = store.getCredentials(domain).find { it.id == credentialsId }
81
- if (existing) {
82
- println "removing ${credentialsId}"
83
- store.removeCredentials(domain, existing)
84
- }
85
-
86
- println "adding ${credentialsId}"
87
- store.addCredentials(domain, credentials)
88
-
1
+ ## Configure Git SCM
2
+
3
+ **git**
4
+
5
+ Description: Configure Git version as SCM
6
+
7
+ Multiple: Override
8
+
9
+ Example
10
+
11
+ builder.freestyle 'hello_world-master' do
12
+ git do
13
+ url 'ssh://builduser@gerrit.acme.com:29418/hello_world'
14
+ basedir 'hello_world'
15
+ reference_repo '$HOME/hello_world.git'
16
+ branches '$GERRIT_BRANCH'
17
+ refspec '$GERRIT_REFSPEC'
18
+ choosing_strategy 'gerrit'
19
+ git_config_name 'foo'
20
+ git_config_email 'foo@acme.com'
21
+ end
22
+ end
23
+
24
+ **jgit**
25
+
26
+ Description: Configure Git version as SCM using jgit. Credentials must be created with the specified id using groovy script
27
+
28
+ Multiple: Override
29
+
30
+ Example
31
+
32
+ builder.freestyle 'hello_world-master' do
33
+ git do
34
+ url 'ssh://builduser@gerrit.acme.com:29418/hello_world'
35
+ basedir 'hello_world'
36
+ reference_repo '$HOME/hello_world.git'
37
+ branches '$GERRIT_BRANCH'
38
+ refspec '$GERRIT_REFSPEC'
39
+ choosing_strategy 'gerrit'
40
+ git_config_name 'foo'
41
+ git_config_email 'foo@acme.com'
42
+ jgit
43
+ credentials 'foo'
44
+ end
45
+ end
46
+
47
+ Example of creating credentials
48
+
49
+ import jenkins.model.*
50
+ import hudson.plugins.sshslaves.*
51
+ import com.cloudbees.plugins.credentials.*
52
+ import com.cloudbees.plugins.credentials.common.*
53
+ import com.cloudbees.plugins.credentials.domains.*
54
+ import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
55
+
56
+ domain = Domain.global()
57
+ store = Jenkins.instance.getExtensionList(
58
+ 'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
59
+ )[0].getStore()
60
+
61
+ username = credentialsId = 'foo'
62
+ passphrase = description = null
63
+
64
+ privateKey = """
65
+ -----BEGIN RSA PRIVATE KEY-----
66
+ MIIEoQIBAAKCAQEAyTsKNPUc4GkfZjNlLmLpuS+wecpCQOJs7MubPoNGk5F0cK4Q
67
+ ...
68
+ -----END RSA PRIVATE KEY-----
69
+ """
70
+
71
+ credentials = new BasicSSHUserPrivateKey(
72
+ CredentialsScope.GLOBAL,
73
+ credentialsId,
74
+ username,
75
+ new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(privateKey),
76
+ passphrase,
77
+ description
78
+ )
79
+
80
+ existing = store.getCredentials(domain).find { it.id == credentialsId }
81
+ if (existing) {
82
+ println "removing ${credentialsId}"
83
+ store.removeCredentials(domain, existing)
84
+ }
85
+
86
+ println "adding ${credentialsId}"
87
+ store.addCredentials(domain, credentials)
88
+
data/docs/multi.md CHANGED
@@ -1,27 +1,27 @@
1
- ## Create multi job project
2
-
3
- **phase**
4
-
5
- Description: Run a job phase. Phases are executed sequentially, however jobs within a phase run in parallel.
6
-
7
- Multiple: Add
8
-
9
- Example
10
-
11
- builder.multi 'hello_world-deploy' do
12
- phase 'hello_world-db-deploy' do
13
- job 'foo-db'
14
-
15
- job 'bar-db' do
16
- ignore_result true
17
- end
18
- end
19
-
20
- phase 'hello_world-service-deploy' do
21
- job 'foo-service' do
22
- retries 1
23
- abort_others false
24
- end
25
- job 'bar-service'
26
- end
1
+ ## Create multi job project
2
+
3
+ **phase**
4
+
5
+ Description: Run a job phase. Phases are executed sequentially, however jobs within a phase run in parallel.
6
+
7
+ Multiple: Add
8
+
9
+ Example
10
+
11
+ builder.multi 'hello_world-deploy' do
12
+ phase 'hello_world-db-deploy' do
13
+ job 'foo-db'
14
+
15
+ job 'bar-db' do
16
+ ignore_result true
17
+ end
18
+ end
19
+
20
+ phase 'hello_world-service-deploy' do
21
+ job 'foo-service' do
22
+ retries 1
23
+ abort_others false
24
+ end
25
+ job 'bar-service'
26
+ end
27
27
  end