rubyjobbuilderdsl 0.0.6 → 0.0.8
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/CONTRIBUTING.md +5 -0
- data/{Readme.md → README.md} +0 -0
- data/docs/index.md +12 -12
- data/docs/pipeline.md +25 -25
- data/docs/postbuild.md +18 -0
- data/lib/rubyjobbuilderdsl/builder.rb +80 -80
- data/lib/rubyjobbuilderdsl/pipeline.rb +18 -19
- data/lib/rubyjobbuilderdsl/postbuild.rb +9 -1
- data/lib/rubyjobbuilderdsl/postbuild/hipchat_notifications.rb +68 -0
- data/lib/rubyjobbuilderdsl/postbuild/slack.rb +76 -77
- data/lib/rubyjobbuilderdsl/xml_generator.rb +940 -923
- data/rubyjobbuilderdsl-0.0.7.gem +0 -0
- data/rubyjobbuilderdsl.gemspec +13 -13
- data/sample/sample_slack_postbuild.rb +23 -23
- data/test/test_hipchat_notifications.rb +39 -0
- data/test/test_timeout.rb +1 -1
- metadata +14 -13
- data/sample/hello_mars.xml +0 -18
- data/sample/hello_world-post.xml +0 -40
- data/sample/test.xml +0 -21
|
Binary file
|
data/rubyjobbuilderdsl.gemspec
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Gem::Specification.new do |s|
|
|
2
|
-
s.name = 'rubyjobbuilderdsl'
|
|
3
|
-
s.version = '0.0.
|
|
4
|
-
s.date = '
|
|
5
|
-
s.summary = 'Ruby Internal DSL for creating Jenkins jobs'
|
|
6
|
-
s.description = 'Ruby Internal DSL for creating Jenkins jobs'
|
|
7
|
-
s.authors = ['Huy Le']
|
|
8
|
-
s.email = 'lehuy20@gmail.com'
|
|
9
|
-
s.files = Dir['**/*']
|
|
10
|
-
s.license = 'MIT'
|
|
11
|
-
s.add_runtime_dependency 'nokogiri'
|
|
12
|
-
s.add_runtime_dependency 'builder'
|
|
13
|
-
end
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = 'rubyjobbuilderdsl'
|
|
3
|
+
s.version = '0.0.8'
|
|
4
|
+
s.date = '2018-01-24'
|
|
5
|
+
s.summary = 'Ruby Internal DSL for creating Jenkins jobs'
|
|
6
|
+
s.description = 'Ruby Internal DSL for creating Jenkins jobs'
|
|
7
|
+
s.authors = ['Huy Le']
|
|
8
|
+
s.email = 'lehuy20@gmail.com'
|
|
9
|
+
s.files = Dir['**/*']
|
|
10
|
+
s.license = 'MIT'
|
|
11
|
+
s.add_runtime_dependency 'nokogiri'
|
|
12
|
+
s.add_runtime_dependency 'builder'
|
|
13
|
+
end
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
require_relative '../lib/rubyjobbuilderdsl'
|
|
2
|
-
|
|
3
|
-
builder = JenkinsJob::Builder.new
|
|
4
|
-
|
|
5
|
-
builder.pipeline 'hello_world-post' do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
build("hello_world",
|
|
19
|
-
SOME_PARAM: "A_param_value")
|
|
20
|
-
EOS
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
JenkinsJob::Deployer.new(builder).run
|
|
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
|
+
postbuild do
|
|
8
|
+
publish_slack do
|
|
9
|
+
base_url 'This is base url'
|
|
10
|
+
auth_token 'This is an auth_token'
|
|
11
|
+
start_notification true
|
|
12
|
+
notify_success true
|
|
13
|
+
notify_aborted true
|
|
14
|
+
notify_failure true
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
groovy <<EOS
|
|
18
|
+
build("hello_world",
|
|
19
|
+
SOME_PARAM: "A_param_value")
|
|
20
|
+
EOS
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
JenkinsJob::Deployer.new(builder).run
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestHipchatNotifications < Test::Unit::TestCase
|
|
4
|
+
def test_hipchat_notifications
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
hipchat_notifications do
|
|
10
|
+
token 'some token'
|
|
11
|
+
room 'room1'
|
|
12
|
+
notify_start true
|
|
13
|
+
notify_success true
|
|
14
|
+
notify_aborted true
|
|
15
|
+
notify_not_built true
|
|
16
|
+
notify_unstable true
|
|
17
|
+
notify_failure true
|
|
18
|
+
notify_back_to_normal true
|
|
19
|
+
start_message 'start message'
|
|
20
|
+
complete_message 'complete message'
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
actual = builder.config_as_xml_node('foo')
|
|
26
|
+
|
|
27
|
+
assert_equal 'some token', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/token').text
|
|
28
|
+
assert_equal 'room1', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/room').text
|
|
29
|
+
assert_equal 'true', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/startNotification').text
|
|
30
|
+
assert_equal 'true', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/notifyAborted').text
|
|
31
|
+
assert_equal 'true', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/notifyFailure').text
|
|
32
|
+
assert_equal 'true', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/notifyNotBuilt').text
|
|
33
|
+
assert_equal 'true', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/notifySuccess').text
|
|
34
|
+
assert_equal 'true', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/notifyUnstable').text
|
|
35
|
+
assert_equal 'true', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/notifyBackToNormal').text
|
|
36
|
+
assert_equal 'start message', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/startJobMessage').text
|
|
37
|
+
assert_equal 'complete message', actual.xpath('./project/publishers/jenkins.plugins.hipchat.HipChatNotifier/completeJobMessage').text
|
|
38
|
+
end
|
|
39
|
+
end
|
data/test/test_timeout.rb
CHANGED
|
@@ -12,7 +12,7 @@ class TestXmlTimeout < Test::Unit::TestCase
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
actual = builder.config_as_xml_node('foo')
|
|
15
|
-
{ 'timeoutMinutes' => '
|
|
15
|
+
{ 'timeoutMinutes' => '15', 'failBuild' => 'false', 'writingDescription' => 'false', 'timeoutPercentage' => '200',
|
|
16
16
|
'timeoutMinutesElasticDefault' => '30', 'timeoutType' => 'elastic' }.each do |k, v|
|
|
17
17
|
assert_equal v, actual.xpath("./project/buildWrappers/hudson.plugins.build__timeout.BuildTimeoutWrapper/#{k}").text, k
|
|
18
18
|
end
|
metadata
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubyjobbuilderdsl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Huy Le
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-01-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
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
|
|
@@ -44,11 +44,12 @@ executables: []
|
|
|
44
44
|
extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
|
46
46
|
files:
|
|
47
|
+
- CONTRIBUTING.md
|
|
47
48
|
- Gemfile
|
|
48
49
|
- Gemfile.lock
|
|
49
50
|
- LICENSE
|
|
51
|
+
- README.md
|
|
50
52
|
- Rakefile
|
|
51
|
-
- Readme.md
|
|
52
53
|
- docs/common.md
|
|
53
54
|
- docs/flow.md
|
|
54
55
|
- docs/freestyle.md
|
|
@@ -98,6 +99,7 @@ files:
|
|
|
98
99
|
- lib/rubyjobbuilderdsl/postbuild/email_publisher.rb
|
|
99
100
|
- lib/rubyjobbuilderdsl/postbuild/game_publisher.rb
|
|
100
101
|
- lib/rubyjobbuilderdsl/postbuild/groovy.rb
|
|
102
|
+
- lib/rubyjobbuilderdsl/postbuild/hipchat_notifications.rb
|
|
101
103
|
- lib/rubyjobbuilderdsl/postbuild/html_publisher.rb
|
|
102
104
|
- lib/rubyjobbuilderdsl/postbuild/javadoc_publisher.rb
|
|
103
105
|
- lib/rubyjobbuilderdsl/postbuild/logparser.rb
|
|
@@ -110,15 +112,13 @@ files:
|
|
|
110
112
|
- lib/rubyjobbuilderdsl/postbuild/xunit_publisher.rb
|
|
111
113
|
- lib/rubyjobbuilderdsl/view.rb
|
|
112
114
|
- lib/rubyjobbuilderdsl/xml_generator.rb
|
|
115
|
+
- rubyjobbuilderdsl-0.0.7.gem
|
|
113
116
|
- rubyjobbuilderdsl.gemspec
|
|
114
117
|
- rubyjobbuilderdsl.sublime-project
|
|
115
118
|
- run_tests.sh
|
|
116
119
|
- sample/hello_mars.rb
|
|
117
|
-
- sample/hello_mars.xml
|
|
118
|
-
- sample/hello_world-post.xml
|
|
119
120
|
- sample/local.ini
|
|
120
121
|
- sample/sample_slack_postbuild.rb
|
|
121
|
-
- sample/test.xml
|
|
122
122
|
- test/test_ant.rb
|
|
123
123
|
- test/test_archive.rb
|
|
124
124
|
- test/test_artifactory.rb
|
|
@@ -136,6 +136,7 @@ files:
|
|
|
136
136
|
- test/test_game_publisher.rb
|
|
137
137
|
- test/test_gerrit.rb
|
|
138
138
|
- test/test_git.rb
|
|
139
|
+
- test/test_hipchat_notifications.rb
|
|
139
140
|
- test/test_html_publisher.rb
|
|
140
141
|
- test/test_inject.rb
|
|
141
142
|
- test/test_javadoc.rb
|
|
@@ -168,17 +169,17 @@ require_paths:
|
|
|
168
169
|
- lib
|
|
169
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
171
|
requirements:
|
|
171
|
-
- -
|
|
172
|
+
- - ">="
|
|
172
173
|
- !ruby/object:Gem::Version
|
|
173
174
|
version: '0'
|
|
174
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
176
|
requirements:
|
|
176
|
-
- -
|
|
177
|
+
- - ">="
|
|
177
178
|
- !ruby/object:Gem::Version
|
|
178
179
|
version: '0'
|
|
179
180
|
requirements: []
|
|
180
181
|
rubyforge_project:
|
|
181
|
-
rubygems_version: 2.
|
|
182
|
+
rubygems_version: 2.5.2.1
|
|
182
183
|
signing_key:
|
|
183
184
|
specification_version: 4
|
|
184
185
|
summary: Ruby Internal DSL for creating Jenkins jobs
|
data/sample/hello_mars.xml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<project>
|
|
2
|
-
<actions/>
|
|
3
|
-
<description><!-- Managed by Jenkins Job Builder --></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 > hello_mars-1.0.$BUILD_NUMBER.txt && gzip hello_mars-1.0.$BUILD_NUMBER.txt</command>
|
|
16
|
-
</hudson.tasks.Shell>
|
|
17
|
-
</builders>
|
|
18
|
-
</project>
|
data/sample/hello_world-post.xml
DELETED
|
@@ -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>
|
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>
|