rubyjobbuilderdsl 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- 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/slack.rb +77 -0
- 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 -153
- data/lib/rubyjobbuilderdsl/view.rb +14 -14
- data/lib/rubyjobbuilderdsl/xml_generator.rb +34 -1
- data/lib/rubyjobbuilderdsl.rb +2 -2
- data/rubyjobbuilderdsl.gemspec +13 -13
- data/rubyjobbuilderdsl.sublime-project +14 -14
- data/run_tests.sh +7 -7
- data/sample/hello_mars.rb +27 -27
- data/sample/hello_mars.xml +18 -0
- data/sample/hello_world-post.xml +40 -0
- data/sample/local.ini +4 -4
- data/sample/sample_flow.rb +15 -0
- data/sample/sample_slack_postbuild.rb +23 -0
- data/sample/test.xml +21 -0
- 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 +15 -10
- data/sample/Schedule-sample-pipeline.xml +0 -28
@@ -1,153 +1,160 @@
|
|
1
|
-
require_relative 'postbuild/archive'
|
2
|
-
require_relative 'postbuild/logparser'
|
3
|
-
require_relative 'postbuild/html_publisher'
|
4
|
-
require_relative 'postbuild/email_publisher'
|
5
|
-
require_relative 'postbuild/nunit_publisher'
|
6
|
-
require_relative 'postbuild/xunit_publisher'
|
7
|
-
require_relative 'postbuild/cloverphp_publisher'
|
8
|
-
require_relative 'postbuild/javadoc_publisher'
|
9
|
-
require_relative 'postbuild/pmd_publisher'
|
10
|
-
require_relative 'postbuild/claim_publisher'
|
11
|
-
require_relative 'postbuild/tap_publisher'
|
12
|
-
require_relative 'postbuild/chucknorris_publisher'
|
13
|
-
require_relative 'postbuild/game_publisher'
|
14
|
-
require_relative 'postbuild/script'
|
15
|
-
require_relative 'postbuild/trigger'
|
16
|
-
require_relative 'postbuild/groovy'
|
17
|
-
require_relative 'postbuild/cucumber_json_publisher'
|
18
|
-
require_relative '
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
archive
|
34
|
-
archive.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
publisher
|
42
|
-
publisher.
|
43
|
-
|
44
|
-
|
45
|
-
@publishers_['publish_html']
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
publisher.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
publisher.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
publisher.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
publisher.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
logparser.
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
@publishers_['postbuildscript'].
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
@publishers_['postbuildscript'].
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
@publishers_['postbuildscript'].
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
trigger.
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
clover
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
def
|
141
|
-
|
142
|
-
|
143
|
-
@publishers_['
|
144
|
-
end
|
145
|
-
alias_method :
|
146
|
-
|
147
|
-
def
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
1
|
+
require_relative 'postbuild/archive'
|
2
|
+
require_relative 'postbuild/logparser'
|
3
|
+
require_relative 'postbuild/html_publisher'
|
4
|
+
require_relative 'postbuild/email_publisher'
|
5
|
+
require_relative 'postbuild/nunit_publisher'
|
6
|
+
require_relative 'postbuild/xunit_publisher'
|
7
|
+
require_relative 'postbuild/cloverphp_publisher'
|
8
|
+
require_relative 'postbuild/javadoc_publisher'
|
9
|
+
require_relative 'postbuild/pmd_publisher'
|
10
|
+
require_relative 'postbuild/claim_publisher'
|
11
|
+
require_relative 'postbuild/tap_publisher'
|
12
|
+
require_relative 'postbuild/chucknorris_publisher'
|
13
|
+
require_relative 'postbuild/game_publisher'
|
14
|
+
require_relative 'postbuild/script'
|
15
|
+
require_relative 'postbuild/trigger'
|
16
|
+
require_relative 'postbuild/groovy'
|
17
|
+
require_relative 'postbuild/cucumber_json_publisher'
|
18
|
+
require_relative 'postbuild/slack'
|
19
|
+
require_relative 'buildstep/shell'
|
20
|
+
|
21
|
+
# dsl methods for job builder
|
22
|
+
module JenkinsJob
|
23
|
+
module Postbuild
|
24
|
+
class Postbuild < BasicObject
|
25
|
+
attr_reader :job, :publishers_
|
26
|
+
|
27
|
+
def initialize(job)
|
28
|
+
@job = job
|
29
|
+
@publishers_ = {}
|
30
|
+
end
|
31
|
+
|
32
|
+
def archive(&block)
|
33
|
+
# sandbox for archive dsl
|
34
|
+
archive = Archive.new
|
35
|
+
archive.instance_eval(&block)
|
36
|
+
|
37
|
+
@publishers_['archive'] = archive
|
38
|
+
end
|
39
|
+
|
40
|
+
def publish_html(name, &block)
|
41
|
+
# sandbox for html publisher dsl
|
42
|
+
publisher = HtmlPublisher.new(name)
|
43
|
+
publisher.instance_eval(&block)
|
44
|
+
|
45
|
+
@publishers_['publish_html'] ||= []
|
46
|
+
@publishers_['publish_html'] << publisher
|
47
|
+
end
|
48
|
+
|
49
|
+
def send_email(recipients, &block)
|
50
|
+
publisher = EmailPublisher.new(recipients)
|
51
|
+
publisher.instance_eval(&block) if block
|
52
|
+
|
53
|
+
@publishers_['send_email'] = publisher
|
54
|
+
end
|
55
|
+
|
56
|
+
def publish_nunit_report(test_results_pattern, &block)
|
57
|
+
publisher = NUnitPublisher.new(test_results_pattern)
|
58
|
+
publisher.instance_eval(&block) if block
|
59
|
+
|
60
|
+
@publishers_['publish_nunit_report'] = publisher
|
61
|
+
end
|
62
|
+
|
63
|
+
def publish_xunit_report(test_results_pattern, &block)
|
64
|
+
publisher = XUnitPublisher.new(test_results_pattern)
|
65
|
+
publisher.instance_eval(&block) if block
|
66
|
+
|
67
|
+
@publishers_['publish_xunit_report'] = publisher
|
68
|
+
end
|
69
|
+
|
70
|
+
def publish_tap(test_results, &block)
|
71
|
+
publisher = TapPublisher.new(test_results)
|
72
|
+
publisher.instance_eval(&block) if block
|
73
|
+
|
74
|
+
@publishers_['publish_tap'] = publisher
|
75
|
+
end
|
76
|
+
|
77
|
+
def logparser(rule_file, &block)
|
78
|
+
# sandbox for html publisher dsl
|
79
|
+
logparser = LogParser.new(rule_file)
|
80
|
+
logparser.instance_eval(&block) if block
|
81
|
+
|
82
|
+
@publishers_['logparser'] = logparser
|
83
|
+
end
|
84
|
+
|
85
|
+
def shell(value)
|
86
|
+
@publishers_['postbuildscript'] ||= PostbuildScript.new
|
87
|
+
@publishers_['postbuildscript'].add(::JenkinsJob::BuildStep::Shell.new(value))
|
88
|
+
end
|
89
|
+
|
90
|
+
def batch(value)
|
91
|
+
@publishers_['postbuildscript'] ||= PostbuildScript.new
|
92
|
+
@publishers_['postbuildscript'].add(::JenkinsJob::BuildStep::Batch.new(value))
|
93
|
+
end
|
94
|
+
|
95
|
+
def powershell(value)
|
96
|
+
@publishers_['postbuildscript'] ||= PostbuildScript.new
|
97
|
+
@publishers_['postbuildscript'].add(::JenkinsJob::BuildStep::Powershell.new(value))
|
98
|
+
end
|
99
|
+
|
100
|
+
def trigger(*project, &block)
|
101
|
+
trigger = PostbuildTrigger.new(project)
|
102
|
+
trigger.instance_eval(&block) if block
|
103
|
+
@publishers_['trigger-parameterized-builds'] = trigger
|
104
|
+
end
|
105
|
+
|
106
|
+
def groovy(value)
|
107
|
+
@publishers_['groovy'] = PostbuildGroovy.new(value)
|
108
|
+
end
|
109
|
+
|
110
|
+
def publish_cloverphp(&block)
|
111
|
+
clover = CloverPhpPublisher.new
|
112
|
+
clover.instance_eval(&block) if block
|
113
|
+
@publishers_['clover-php'] = clover
|
114
|
+
end
|
115
|
+
|
116
|
+
def publish_slack(&block)
|
117
|
+
slack = PostbuildSlack.new
|
118
|
+
slack.instance_eval(&block) if block
|
119
|
+
@publishers_['slack'] = slack
|
120
|
+
end
|
121
|
+
|
122
|
+
def cucumber_json_publisher(&block)
|
123
|
+
cucumber = CucumberJsonPublisher.new
|
124
|
+
cucumber.instance_eval(&block) if block
|
125
|
+
@publishers_['cucumber'] = cucumber
|
126
|
+
end
|
127
|
+
|
128
|
+
def publish_javadoc(&block)
|
129
|
+
doc = JavaDocPublisher.new
|
130
|
+
doc.instance_eval(&block) if block
|
131
|
+
@publishers_['java-doc'] = doc
|
132
|
+
end
|
133
|
+
|
134
|
+
def publish_pmd(&block)
|
135
|
+
pmd = PMDPublisher.new
|
136
|
+
pmd.instance_eval(&block) if block
|
137
|
+
@publishers_['pmd'] = pmd
|
138
|
+
end
|
139
|
+
|
140
|
+
def publish_chucknorris(&block)
|
141
|
+
chucknorris = ChuckNorrisPublisher.new
|
142
|
+
chucknorris.instance_eval(&block) if block
|
143
|
+
@publishers_['chucknorris'] = chucknorris
|
144
|
+
end
|
145
|
+
alias_method :chucknorris, :publish_chucknorris
|
146
|
+
|
147
|
+
def publish_game(&block)
|
148
|
+
game = GamePublisher.new
|
149
|
+
game.instance_eval(&block) if block
|
150
|
+
@publishers_['game'] = game
|
151
|
+
end
|
152
|
+
alias_method :game, :publish_game
|
153
|
+
|
154
|
+
def allow_broken_build_claiming
|
155
|
+
publisher = ClaimPublisher.new
|
156
|
+
@publishers_['claim-publisher'] = publisher
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module JenkinsJob
|
2
|
-
class View
|
3
|
-
attr_reader :name, :jobname_
|
4
|
-
|
5
|
-
def initialize(name, builder)
|
6
|
-
@builder = builder
|
7
|
-
@name = name
|
8
|
-
end
|
9
|
-
|
10
|
-
def job(regex)
|
11
|
-
@jobname_ = regex
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
module JenkinsJob
|
2
|
+
class View
|
3
|
+
attr_reader :name, :jobname_
|
4
|
+
|
5
|
+
def initialize(name, builder)
|
6
|
+
@builder = builder
|
7
|
+
@name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def job(regex)
|
11
|
+
@jobname_ = regex
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -55,6 +55,7 @@ module JenkinsJob
|
|
55
55
|
Postbuild::TapPublisher => lambda { |generator, model, xml_node| generator.generate_tap_publisher(model, xml_node) },
|
56
56
|
Postbuild::GamePublisher => lambda { |generator, model, xml_node| generator.generate_game_publisher(model, xml_node) },
|
57
57
|
Postbuild::ChuckNorrisPublisher => lambda { |generator, model, xml_node| generator.generate_chucknorris_publisher(model, xml_node) },
|
58
|
+
Postbuild::PostbuildSlack => lambda { |generator, model, xml_node| generator.generate_postbuild_slack(model, xml_node) },
|
58
59
|
}
|
59
60
|
|
60
61
|
def generate(model, xml_node = ::Builder::XmlMarkup.new(:indent => 2))
|
@@ -179,7 +180,14 @@ module JenkinsJob
|
|
179
180
|
definition.script(model.groovy_)
|
180
181
|
end
|
181
182
|
project.disabled(false)
|
182
|
-
|
183
|
+
if model.postbuild_
|
184
|
+
project.publishers do |publishers|
|
185
|
+
generate(model.postbuild_, publishers)
|
186
|
+
end
|
187
|
+
else
|
188
|
+
project.publishers
|
189
|
+
end
|
190
|
+
end
|
183
191
|
result
|
184
192
|
end
|
185
193
|
|
@@ -733,6 +741,31 @@ module JenkinsJob
|
|
733
741
|
end
|
734
742
|
end
|
735
743
|
|
744
|
+
def generate_postbuild_slack(model, publishers)
|
745
|
+
publishers.tag!('jenkins.plugins.slack.SlackNotifier', :plugin => 'slack@2.3' ) do |slack|
|
746
|
+
slack.baseUrl(model.base_url_)
|
747
|
+
slack.teamDomain
|
748
|
+
slack.authToken(model.auth_token_)
|
749
|
+
slack.authTokenCredentialId
|
750
|
+
slack.botUser(false)
|
751
|
+
slack.room
|
752
|
+
slack.startNotification(model.start_notification_)
|
753
|
+
slack.notifySuccess(model.notify_success_)
|
754
|
+
slack.notifyAborted(model.notify_aborted_)
|
755
|
+
slack.notifyNotBuilt(model.notify_not_built_)
|
756
|
+
slack.notifyUnstable(model.notify_unstable_)
|
757
|
+
slack.notifyRegression(model.notify_regression_)
|
758
|
+
slack.notifyFailure(model.notify_failure_)
|
759
|
+
slack.notifyBackToNormal(model.notify_back_to_normal_)
|
760
|
+
slack.notifyRepeatedFailure(model.notify_repeated_failure_)
|
761
|
+
slack.includeTestSummary(model.include_test_summary)
|
762
|
+
slack.includeFailedTests(model.include_failed_tests_)
|
763
|
+
slack.commitInfoChoice('NONE')
|
764
|
+
slack.includeCustomMessage(false)
|
765
|
+
slack.CustomMessage
|
766
|
+
end
|
767
|
+
end
|
768
|
+
|
736
769
|
def generate_postbuild_groovy(model, publishers)
|
737
770
|
publishers.tag!('org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder') do |recorder|
|
738
771
|
recorder.groovyScript(model.value_)
|
data/lib/rubyjobbuilderdsl.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require_relative './rubyjobbuilderdsl/builder'
|
2
|
-
require_relative './rubyjobbuilderdsl/deployer'
|
1
|
+
require_relative './rubyjobbuilderdsl/builder'
|
2
|
+
require_relative './rubyjobbuilderdsl/deployer'
|
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 = '2017-10-
|
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.4'
|
4
|
+
s.date = '2017-10-16'
|
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,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"folders":
|
3
|
-
[
|
4
|
-
{
|
5
|
-
"path": ".",
|
6
|
-
"folder_exclude_patterns": [".bundle", "vendor"]
|
7
|
-
}
|
8
|
-
],
|
9
|
-
"settings":
|
10
|
-
{
|
11
|
-
"tab_size": 2,
|
12
|
-
"translate_tabs_to_spaces": true
|
13
|
-
}
|
14
|
-
}
|
1
|
+
{
|
2
|
+
"folders":
|
3
|
+
[
|
4
|
+
{
|
5
|
+
"path": ".",
|
6
|
+
"folder_exclude_patterns": [".bundle", "vendor"]
|
7
|
+
}
|
8
|
+
],
|
9
|
+
"settings":
|
10
|
+
{
|
11
|
+
"tab_size": 2,
|
12
|
+
"translate_tabs_to_spaces": true
|
13
|
+
}
|
14
|
+
}
|
data/run_tests.sh
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
set -ex
|
4
|
-
|
5
|
-
bundle install --deployment
|
6
|
-
|
7
|
-
bundle exec rake
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
bundle install --deployment
|
6
|
+
|
7
|
+
bundle exec rake
|
data/sample/hello_mars.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
require_relative '../lib/rubyjobbuilderdsl'
|
2
|
-
|
3
|
-
builder = JenkinsJob::Builder.new
|
4
|
-
|
5
|
-
builder.freestyle 'hello_mars' do
|
6
|
-
shell 'echo hello mars > hello_mars-1.0.$BUILD_NUMBER.txt && gzip hello_mars-1.0.$BUILD_NUMBER.txt'
|
7
|
-
end
|
8
|
-
|
9
|
-
builder.view 'test' do
|
10
|
-
job 'test-.*'
|
11
|
-
end
|
12
|
-
|
13
|
-
JenkinsJob::Deployer.new(builder).run do
|
14
|
-
disable_job 'hello_mars'
|
15
|
-
wipeout_workspace 'hello_mars'
|
16
|
-
delete_job 'hello_mars'
|
17
|
-
delete_view 'test'
|
18
|
-
|
19
|
-
each do |name, xml, type|
|
20
|
-
upload_view(name, xml) if type == :view
|
21
|
-
upload_job(name, xml) if type == :job
|
22
|
-
end
|
23
|
-
|
24
|
-
groovysh 'println "hello world"'
|
25
|
-
enable_job 'hello_mars'
|
26
|
-
trigger_job 'hello_mars'
|
27
|
-
end
|
1
|
+
require_relative '../lib/rubyjobbuilderdsl'
|
2
|
+
|
3
|
+
builder = JenkinsJob::Builder.new
|
4
|
+
|
5
|
+
builder.freestyle 'hello_mars' do
|
6
|
+
shell 'echo hello mars > hello_mars-1.0.$BUILD_NUMBER.txt && gzip hello_mars-1.0.$BUILD_NUMBER.txt'
|
7
|
+
end
|
8
|
+
|
9
|
+
builder.view 'test' do
|
10
|
+
job 'test-.*'
|
11
|
+
end
|
12
|
+
|
13
|
+
JenkinsJob::Deployer.new(builder).run do
|
14
|
+
disable_job 'hello_mars'
|
15
|
+
wipeout_workspace 'hello_mars'
|
16
|
+
delete_job 'hello_mars'
|
17
|
+
delete_view 'test'
|
18
|
+
|
19
|
+
each do |name, xml, type|
|
20
|
+
upload_view(name, xml) if type == :view
|
21
|
+
upload_job(name, xml) if type == :job
|
22
|
+
end
|
23
|
+
|
24
|
+
groovysh 'println "hello world"'
|
25
|
+
enable_job 'hello_mars'
|
26
|
+
trigger_job 'hello_mars'
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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>
|
@@ -0,0 +1,40 @@
|
|
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/local.ini
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[jenkins]
|
2
|
-
url=http://localhost:8080/
|
3
|
-
user=jenkins-jobs
|
4
|
-
password=7bb352e4f3da683c17247f3abf88f47c
|
1
|
+
[jenkins]
|
2
|
+
url=http://localhost:8080/
|
3
|
+
user=jenkins-jobs
|
4
|
+
password=7bb352e4f3da683c17247f3abf88f47c
|
@@ -0,0 +1,15 @@
|
|
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
|
@@ -0,0 +1,23 @@
|
|
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
|