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
@@ -1,28 +1,28 @@
1
- require 'test/unit'
2
- require 'nokogiri'
3
- require 'fileutils'
4
-
5
- require_relative '../lib/rubyjobbuilderdsl'
6
-
7
- module JenkinsJob
8
- class Builder
9
- def tmpdir
10
- ::File.join(File.dirname(__FILE__), '..', 'tmp')
11
- end
12
-
13
- def debug
14
- ::File.exist?(tmpdir)
15
- end
16
-
17
- def config_as_xml_node(jobname)
18
- generate_xml do |name, xml|
19
- if name == jobname
20
- File.open(::File.join(tmpdir, "#{name}.xml"), 'w+') do |f|
21
- f.write(xml)
22
- end if debug
23
- return Nokogiri::XML.parse(xml)
24
- end
25
- end
26
- end
27
- end
28
- end
1
+ require 'test/unit'
2
+ require 'nokogiri'
3
+ require 'fileutils'
4
+
5
+ require_relative '../lib/rubyjobbuilderdsl'
6
+
7
+ module JenkinsJob
8
+ class Builder
9
+ def tmpdir
10
+ ::File.join(File.dirname(__FILE__), '..', 'tmp')
11
+ end
12
+
13
+ def debug
14
+ ::File.exist?(tmpdir)
15
+ end
16
+
17
+ def config_as_xml_node(jobname)
18
+ generate_xml do |name, xml|
19
+ if name == jobname
20
+ File.open(::File.join(tmpdir, "#{name}.xml"), 'w+') do |f|
21
+ f.write(xml)
22
+ end if debug
23
+ return Nokogiri::XML.parse(xml)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,22 +1,22 @@
1
- require_relative './test_xml_generator'
2
-
3
- class TestXmlXUnitPublisher < Test::Unit::TestCase
4
- def test_postbuild_xunit_publisher
5
- builder = JenkinsJob::Builder.new
6
-
7
- builder.freestyle 'foo' do
8
- postbuild do
9
- publish_xunit_report 'a\\b' do
10
- failed_threshold :total_failed_tests => 0
11
- unstable_threshold :total_skipped_tests => 0
12
- end
13
- end
14
- end
15
-
16
- actual = builder.config_as_xml_node('foo')
17
-
18
- assert 'a\\b', actual.xpath('./project/publishers/xunit/types/NUnitJunitHudsonTestType/pattern').text
19
- assert '0', actual.xpath('./project/publishers/xunit/thresholds/org.jenkinsci.plugins.xunit.threshold.FailedThreshold/failureThreshold').text
20
- assert '0', actual.xpath('./project/publishers/xunit/thresholds/org.jenkinsci.plugins.xunit.threshold.SkippedThreshold/unstableThreshold').text
21
- end
22
- end
1
+ require_relative './test_xml_generator'
2
+
3
+ class TestXmlXUnitPublisher < Test::Unit::TestCase
4
+ def test_postbuild_xunit_publisher
5
+ builder = JenkinsJob::Builder.new
6
+
7
+ builder.freestyle 'foo' do
8
+ postbuild do
9
+ publish_xunit_report 'a\\b' do
10
+ failed_threshold :total_failed_tests => 0
11
+ unstable_threshold :total_skipped_tests => 0
12
+ end
13
+ end
14
+ end
15
+
16
+ actual = builder.config_as_xml_node('foo')
17
+
18
+ assert 'a\\b', actual.xpath('./project/publishers/xunit/types/NUnitJunitHudsonTestType/pattern').text
19
+ assert '0', actual.xpath('./project/publishers/xunit/thresholds/org.jenkinsci.plugins.xunit.threshold.FailedThreshold/failureThreshold').text
20
+ assert '0', actual.xpath('./project/publishers/xunit/thresholds/org.jenkinsci.plugins.xunit.threshold.SkippedThreshold/unstableThreshold').text
21
+ end
22
+ end
data/test/test_xvfb.rb CHANGED
@@ -1,35 +1,35 @@
1
- require_relative './test_xml_generator'
2
-
3
- class TestXvfb < Test::Unit::TestCase
4
- def test_enable_xvfb
5
- install_name = 'Xvfb'
6
- screen_resolution = '1024x768x24'
7
- debug = 'false'
8
- timeout = '0'
9
- display_name_offset = '1'
10
- shutdown_with_build = 'false'
11
- auto_display_name = 'true'
12
- parallel_build = 'false'
13
-
14
- builder = JenkinsJob::Builder.new
15
-
16
- builder.freestyle 'foo' do
17
- xvfb do
18
- install_name(install_name)
19
- end
20
- end
21
-
22
- actual = builder.config_as_xml_node('foo')
23
-
24
- base_xpath = './project/buildWrappers/org.jenkinsci.plugins.xvfb.XvfbBuildWrapper/'
25
-
26
- assert_equal install_name, actual.xpath("#{base_xpath}installationName").text, "installation name was not #{install_name}"
27
- assert_equal debug, actual.xpath("#{base_xpath}debug").text, "debug property was not #{debug}"
28
- assert_equal timeout, actual.xpath("#{base_xpath}timeout").text, "timeout property was not #{timeout}"
29
- assert_equal display_name_offset, actual.xpath("#{base_xpath}displayNameOffset").text, "displayNameOffset was not #{display_name_offset}"
30
- assert_equal shutdown_with_build, actual.xpath("#{base_xpath}shutdownWithBuild").text, "shutdown_with_build was not #{shutdown_with_build}"
31
- assert_equal auto_display_name, actual.xpath("#{base_xpath}autoDisplayName").text, "autoDisplayName was not #{auto_display_name}"
32
- assert_equal screen_resolution, actual.xpath("#{base_xpath}screen").text, "screen resolution was not #{screen_resolution}"
33
- assert_equal parallel_build, actual.xpath("#{base_xpath}parallelBuild").text, "parallelBuild was not #{parallel_build}"
34
- end
35
- end
1
+ require_relative './test_xml_generator'
2
+
3
+ class TestXvfb < Test::Unit::TestCase
4
+ def test_enable_xvfb
5
+ install_name = 'Xvfb'
6
+ screen_resolution = '1024x768x24'
7
+ debug = 'false'
8
+ timeout = '0'
9
+ display_name_offset = '1'
10
+ shutdown_with_build = 'false'
11
+ auto_display_name = 'true'
12
+ parallel_build = 'false'
13
+
14
+ builder = JenkinsJob::Builder.new
15
+
16
+ builder.freestyle 'foo' do
17
+ xvfb do
18
+ install_name(install_name)
19
+ end
20
+ end
21
+
22
+ actual = builder.config_as_xml_node('foo')
23
+
24
+ base_xpath = './project/buildWrappers/org.jenkinsci.plugins.xvfb.XvfbBuildWrapper/'
25
+
26
+ assert_equal install_name, actual.xpath("#{base_xpath}installationName").text, "installation name was not #{install_name}"
27
+ assert_equal debug, actual.xpath("#{base_xpath}debug").text, "debug property was not #{debug}"
28
+ assert_equal timeout, actual.xpath("#{base_xpath}timeout").text, "timeout property was not #{timeout}"
29
+ assert_equal display_name_offset, actual.xpath("#{base_xpath}displayNameOffset").text, "displayNameOffset was not #{display_name_offset}"
30
+ assert_equal shutdown_with_build, actual.xpath("#{base_xpath}shutdownWithBuild").text, "shutdown_with_build was not #{shutdown_with_build}"
31
+ assert_equal auto_display_name, actual.xpath("#{base_xpath}autoDisplayName").text, "autoDisplayName was not #{auto_display_name}"
32
+ assert_equal screen_resolution, actual.xpath("#{base_xpath}screen").text, "screen resolution was not #{screen_resolution}"
33
+ assert_equal parallel_build, actual.xpath("#{base_xpath}parallelBuild").text, "parallelBuild was not #{parallel_build}"
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyjobbuilderdsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huy Le
@@ -14,28 +14,28 @@ dependencies:
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Ruby Internal DSL for creating Jenkins jobs
@@ -110,16 +110,14 @@ files:
110
110
  - lib/rubyjobbuilderdsl/postbuild/xunit_publisher.rb
111
111
  - lib/rubyjobbuilderdsl/view.rb
112
112
  - lib/rubyjobbuilderdsl/xml_generator.rb
113
+ - rubyjobbuilderdsl-0.0.3.gem
113
114
  - rubyjobbuilderdsl.gemspec
114
115
  - rubyjobbuilderdsl.sublime-project
115
116
  - run_tests.sh
117
+ - sample/Schedule-sample-pipeline.xml
116
118
  - sample/hello_mars.rb
117
- - sample/hello_mars.xml
118
- - sample/hello_world-post.xml
119
119
  - sample/local.ini
120
- - sample/sample_flow.rb
121
120
  - sample/sample_slack_postbuild.rb
122
- - sample/test.xml
123
121
  - test/test_ant.rb
124
122
  - test/test_archive.rb
125
123
  - test/test_artifactory.rb
@@ -169,12 +167,12 @@ require_paths:
169
167
  - lib
170
168
  required_ruby_version: !ruby/object:Gem::Requirement
171
169
  requirements:
172
- - - ! '>='
170
+ - - ">="
173
171
  - !ruby/object:Gem::Version
174
172
  version: '0'
175
173
  required_rubygems_version: !ruby/object:Gem::Requirement
176
174
  requirements:
177
- - - ! '>='
175
+ - - ">="
178
176
  - !ruby/object:Gem::Version
179
177
  version: '0'
180
178
  requirements: []
@@ -1,18 +0,0 @@
1
- <project>
2
- <actions/>
3
- <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
4
- <keepDependencies>false</keepDependencies>
5
- <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
6
- <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
7
- <concurrentBuild>false</concurrentBuild>
8
- <canRoam>true</canRoam>
9
- <properties/>
10
- <scm class="hudson.scm.NullSCM"/>
11
- <publishers/>
12
- <buildWrappers/>
13
- <builders>
14
- <hudson.tasks.Shell>
15
- <command>echo hello mars &gt; hello_mars-1.0.$BUILD_NUMBER.txt &amp;&amp; gzip hello_mars-1.0.$BUILD_NUMBER.txt</command>
16
- </hudson.tasks.Shell>
17
- </builders>
18
- </project>
@@ -1,40 +0,0 @@
1
- <flow-definition plugin="workflow-job@2.11">
2
- <actions/>
3
- <description/>
4
- <keepDependencies>false</keepDependencies>
5
- <properties>
6
- <org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
7
- <triggers/>
8
- </org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
9
- </properties>
10
- <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.32">
11
- <script>build("hello_world",
12
- SOME_PARAM: "A_param_value")
13
- </script>
14
- </definition>
15
- <disabled>false</disabled>
16
- <publishers>
17
- <jenkins.plugins.slack.SlackNotifier plugin="slack@2.3">
18
- <baseUrl>This is base url</baseUrl>
19
- <teamDomain/>
20
- <authToken>This is an auth_token</authToken>
21
- <authTokenCredentialId/>
22
- <botUser>false</botUser>
23
- <room/>
24
- <startNotification>true</startNotification>
25
- <notifySuccess>true</notifySuccess>
26
- <notifyAborted>true</notifyAborted>
27
- <notifyNotBuilt>false</notifyNotBuilt>
28
- <notifyUnstable>false</notifyUnstable>
29
- <notifyRegression>false</notifyRegression>
30
- <notifyFailure>true</notifyFailure>
31
- <notifyBackToNormal>false</notifyBackToNormal>
32
- <notifyRepeatedFailure>false</notifyRepeatedFailure>
33
- <includeTestSummary>false</includeTestSummary>
34
- <includeFailedTests>false</includeFailedTests>
35
- <commitInfoChoice>NONE</commitInfoChoice>
36
- <includeCustomMessage>false</includeCustomMessage>
37
- <CustomMessage/>
38
- </jenkins.plugins.slack.SlackNotifier>
39
- </publishers>
40
- </flow-definition>
@@ -1,15 +0,0 @@
1
- require_relative '../lib/rubyjobbuilderdsl'
2
-
3
- builder = JenkinsJob::Builder.new
4
-
5
- builder.pipeline 'hello_world-post' do
6
- #timed '0 4 * * 1-5'
7
- # definition <<EOS
8
- #build("hello_worl-" + params["GERRIT_BRANCH"],
9
- # GERRIT_REFSPEC: "refs/heads/${params["GERRIT_BRANCH"]}",
10
- # GERRIT_BRANCH: params["GERRIT_BRANCH"])
11
- #EOS
12
-
13
- end
14
-
15
- JenkinsJob::Deployer.new(builder).run
data/sample/test.xml DELETED
@@ -1,21 +0,0 @@
1
- <hudson.model.ListView>
2
- <name>test</name>
3
- <filterExecutors>false</filterExecutors>
4
- <filterQueue>false</filterQueue>
5
- <properties class="hudson.model.View$PropertyList"/>
6
- <jobNames>
7
- <comparator class="hudson.util.CaseInsensitiveComparator"/>
8
- </jobNames>
9
- <jobFilters/>
10
- <columns>
11
- <hudson.views.StatusColumn/>
12
- <hudson.views.WeatherColumn/>
13
- <hudson.views.JobColumn/>
14
- <hudson.views.LastSuccessColumn/>
15
- <hudson.views.LastFailureColumn/>
16
- <hudson.views.LastDurationColumn/>
17
- <hudson.views.BuildButtonColumn/>
18
- </columns>
19
- <includeRegex>test-.*</includeRegex>
20
- <recurse>false</recurse>
21
- </hudson.model.ListView>