jenkins_pipeline_builder 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +65 -0
- data/LICENSE +1 -1
- data/README.md +64 -2
- data/Rakefile +13 -11
- data/bin/generate +2 -4
- data/jenkins_pipeline_builder.gemspec +14 -11
- data/lib/jenkins_pipeline_builder.rb +2 -1
- data/lib/jenkins_pipeline_builder/builders.rb +89 -33
- data/lib/jenkins_pipeline_builder/cli/base.rb +21 -29
- data/lib/jenkins_pipeline_builder/cli/helper.rb +12 -15
- data/lib/jenkins_pipeline_builder/cli/pipeline.rb +6 -1
- data/lib/jenkins_pipeline_builder/cli/view.rb +2 -2
- data/lib/jenkins_pipeline_builder/compiler.rb +58 -56
- data/lib/jenkins_pipeline_builder/generator.rb +362 -172
- data/lib/jenkins_pipeline_builder/job_builder.rb +48 -45
- data/lib/jenkins_pipeline_builder/module_registry.rb +4 -6
- data/lib/jenkins_pipeline_builder/publishers.rb +53 -38
- data/lib/jenkins_pipeline_builder/pull_request.rb +156 -0
- data/lib/jenkins_pipeline_builder/triggers.rb +24 -25
- data/lib/jenkins_pipeline_builder/utils.rb +13 -7
- data/lib/jenkins_pipeline_builder/version.rb +2 -2
- data/lib/jenkins_pipeline_builder/view.rb +120 -98
- data/lib/jenkins_pipeline_builder/wrappers.rb +44 -44
- data/lib/jenkins_pipeline_builder/xml_helper.rb +4 -4
- data/spec/func_tests/spec_helper.rb +2 -2
- data/spec/func_tests/view_spec.rb +6 -6
- data/spec/unit_tests/compiler_spec.rb +7 -7
- data/spec/unit_tests/fixtures/files/Job-Gem-Build.xml +2 -2
- data/spec/unit_tests/fixtures/files/Job-Gem-Build.yaml +1 -0
- data/spec/unit_tests/fixtures/files/concurrent_build.xml +17 -0
- data/spec/unit_tests/fixtures/files/concurrent_build.yaml +4 -0
- data/spec/unit_tests/fixtures/files/downstream_blocking.xml +19 -0
- data/spec/unit_tests/fixtures/files/downstream_blocking.yaml +15 -0
- data/spec/unit_tests/fixtures/files/groovy_postbuild.xml +29 -0
- data/spec/unit_tests/fixtures/files/groovy_postbuild.yaml +9 -0
- data/spec/unit_tests/generator_spec.rb +30 -25
- data/spec/unit_tests/module_registry_spec.rb +9 -9
- data/spec/unit_tests/resolve_dependencies_spec.rb +108 -89
- data/spec/unit_tests/spec_helper.rb +1 -1
- metadata +62 -4
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2014
|
2
|
+
# Copyright (c) 2014 Constant Contact
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -22,51 +22,50 @@
|
|
22
22
|
|
23
23
|
module JenkinsPipelineBuilder
|
24
24
|
class Triggers
|
25
|
-
def self.enable_git_push(
|
26
|
-
xml.send('com.cloudbees.jenkins.GitHubPushTrigger')
|
25
|
+
def self.enable_git_push(_, xml)
|
26
|
+
xml.send('com.cloudbees.jenkins.GitHubPushTrigger') do
|
27
27
|
xml.spec
|
28
|
-
|
28
|
+
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.enable_scm_polling(scm_polling, xml)
|
32
|
-
xml.send('hudson.triggers.SCMTrigger')
|
32
|
+
xml.send('hudson.triggers.SCMTrigger') do
|
33
33
|
xml.spec scm_polling
|
34
34
|
xml.ignorePostCommitHooks false
|
35
|
-
|
35
|
+
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.enable_periodic_build(periodic_build, xml)
|
39
|
-
xml.send('hudson.triggers.TimerTrigger')
|
39
|
+
xml.send('hudson.triggers.TimerTrigger') do
|
40
40
|
xml.spec periodic_build
|
41
|
-
|
41
|
+
end
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.enable_upstream_check(params, xml)
|
45
45
|
case params[:status]
|
46
|
-
when
|
47
|
-
name =
|
48
|
-
ordinal =
|
49
|
-
color =
|
50
|
-
when
|
51
|
-
name =
|
52
|
-
ordinal =
|
53
|
-
color =
|
46
|
+
when 'unstable'
|
47
|
+
name = 'UNSTABLE'
|
48
|
+
ordinal = '1'
|
49
|
+
color = 'yellow'
|
50
|
+
when 'failed'
|
51
|
+
name = 'FAILURE'
|
52
|
+
ordinal = '2'
|
53
|
+
color = 'RED'
|
54
54
|
else
|
55
|
-
name =
|
56
|
-
ordinal =
|
57
|
-
color =
|
55
|
+
name = 'SUCCESS'
|
56
|
+
ordinal = '0'
|
57
|
+
color = 'BLUE'
|
58
58
|
end
|
59
|
-
xml.send('jenkins.triggers.ReverseBuildTrigger')
|
59
|
+
xml.send('jenkins.triggers.ReverseBuildTrigger') do
|
60
60
|
xml.spec
|
61
61
|
xml.upstreamProjects params[:projects]
|
62
|
-
xml.send('threshold')
|
62
|
+
xml.send('threshold') do
|
63
63
|
xml.name name
|
64
64
|
xml.ordinal ordinal
|
65
65
|
xml.color color
|
66
66
|
xml.completeBuild true
|
67
|
-
|
68
|
-
|
67
|
+
end
|
68
|
+
end
|
69
69
|
end
|
70
|
-
|
71
70
|
end
|
72
|
-
end
|
71
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2014
|
2
|
+
# Copyright (c) 2014 Constant Contact
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -23,8 +23,8 @@
|
|
23
23
|
module JenkinsPipelineBuilder
|
24
24
|
class ::Hash
|
25
25
|
def deep_merge(second)
|
26
|
-
merger = proc { |
|
27
|
-
|
26
|
+
merger = proc { |_key, v1, v2| v1.is_a?(Hash) && v2.is_a?(Hash) ? v1.merge(v2, &merger) : v2 }
|
27
|
+
merge(second, &merger)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -36,11 +36,17 @@ module JenkinsPipelineBuilder
|
|
36
36
|
ks = k.respond_to?(:to_sym) ? k.to_sym : k
|
37
37
|
h[ks] = h.delete k # Preserve order even when k == ks
|
38
38
|
symbolize_keys_deep! h[ks] if h[ks].kind_of? Hash
|
39
|
-
if h[ks].
|
40
|
-
|
41
|
-
|
39
|
+
h[ks].each { |item| symbolize_keys_deep!(item) } if h[ks].is_a?(Array)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
def self.hash_merge!(old, new)
|
43
|
+
old.merge!(new) do |_key, old, new|
|
44
|
+
if old.is_a?(Hash) && new.is_a?(Hash)
|
45
|
+
hash_merge!(old, new)
|
46
|
+
else
|
47
|
+
new
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
45
51
|
end
|
46
|
-
end
|
52
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2014
|
2
|
+
# Copyright (c) 2014 Constant Contact
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -21,5 +21,5 @@
|
|
21
21
|
#
|
22
22
|
|
23
23
|
module JenkinsPipelineBuilder
|
24
|
-
VERSION =
|
24
|
+
VERSION = '0.5.0'
|
25
25
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2014
|
2
|
+
# Copyright (c) 2014 Constant Contact
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -45,20 +45,20 @@ module JenkinsPipelineBuilder
|
|
45
45
|
|
46
46
|
def get_mode(type)
|
47
47
|
case type
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
48
|
+
when 'listview'
|
49
|
+
'hudson.model.ListView'
|
50
|
+
when 'myview'
|
51
|
+
'hudson.model.MyView'
|
52
|
+
when 'nestedView'
|
53
|
+
'hudson.plugins.nested_view.NestedView'
|
54
|
+
when 'categorizedView'
|
55
|
+
'org.jenkinsci.plugins.categorizedview.CategorizedJobsView'
|
56
|
+
when 'dashboardView'
|
57
|
+
'hudson.plugins.view.dashboard.Dashboard'
|
58
|
+
when 'multijobView'
|
59
|
+
'com.tikal.jenkins.plugins.multijob.views.MultiJobView'
|
60
|
+
else
|
61
|
+
fail "Type #{type} is not supported by Jenkins."
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -72,12 +72,12 @@ module JenkinsPipelineBuilder
|
|
72
72
|
@logger.info "Creating a view '#{view_name}' of type '#{type}'"
|
73
73
|
mode = get_mode(type)
|
74
74
|
initial_post_params = {
|
75
|
+
'name' => view_name,
|
76
|
+
'mode' => mode,
|
77
|
+
'json' => {
|
75
78
|
'name' => view_name,
|
76
|
-
'mode' => mode
|
77
|
-
|
78
|
-
'name' => view_name,
|
79
|
-
'mode' => mode
|
80
|
-
}.to_json
|
79
|
+
'mode' => mode
|
80
|
+
}.to_json
|
81
81
|
}
|
82
82
|
|
83
83
|
if @generator.debug
|
@@ -110,46 +110,57 @@ module JenkinsPipelineBuilder
|
|
110
110
|
#
|
111
111
|
def create(params)
|
112
112
|
# Name is a required parameter. Raise an error if not specified
|
113
|
-
|
114
|
-
unless params.is_a?(Hash) && params[:name]
|
113
|
+
fail ArgumentError, 'Name is required for creating view' unless params.is_a?(Hash) && params[:name]
|
115
114
|
unless @generator.debug
|
116
|
-
|
117
|
-
|
115
|
+
# If we have a parent view, we need to do some additional checks
|
116
|
+
if params[:parent_view]
|
117
|
+
# If there is no current parent view, create it
|
118
|
+
unless @client.view.exists?(params[:parent_view])
|
119
|
+
create_base_view(params[:parent_view], 'nestedView')
|
120
|
+
end
|
121
|
+
# If the view currently exists, delete it
|
122
|
+
if exists?(params[:name], params[:parent_view])
|
123
|
+
delete(params[:name], params[:parent_view])
|
124
|
+
end
|
125
|
+
else
|
126
|
+
if @client.view.exists?(params[:name])
|
127
|
+
@client.view.delete(params[:name])
|
128
|
+
end
|
118
129
|
end
|
119
130
|
end
|
120
131
|
params[:type] = 'listview' unless params[:type]
|
121
132
|
create_base_view(params[:name], params[:type], params[:parent_view])
|
122
133
|
@logger.debug "Creating a #{params[:type]} view with params: #{params.inspect}"
|
123
134
|
status_filter = case params[:status_filter]
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
135
|
+
when 'all_selected_jobs'
|
136
|
+
''
|
137
|
+
when 'enabled_jobs_only'
|
138
|
+
'1'
|
139
|
+
when 'disabled_jobs_only'
|
140
|
+
'2'
|
141
|
+
else
|
142
|
+
''
|
132
143
|
end
|
133
144
|
|
134
145
|
json = {
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
146
|
+
'name' => params[:name],
|
147
|
+
'description' => params[:description],
|
148
|
+
'mode' => get_mode(params[:type]),
|
149
|
+
'statusFilter' => '',
|
150
|
+
'columns' => get_columns(params[:type])
|
140
151
|
}
|
141
|
-
json.merge!(
|
152
|
+
json.merge!('groupingRules' => params[:groupingRules]) if params[:groupingRules]
|
142
153
|
post_params = {
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
154
|
+
'name' => params[:name],
|
155
|
+
'mode' => get_mode(params[:type]),
|
156
|
+
'description' => params[:description],
|
157
|
+
'statusFilter' => status_filter,
|
158
|
+
'json' => json.to_json
|
148
159
|
}
|
149
|
-
post_params.merge!(
|
150
|
-
post_params.merge!(
|
151
|
-
post_params.merge!(
|
152
|
-
|
160
|
+
post_params.merge!('filterQueue' => 'on') if params[:filter_queue]
|
161
|
+
post_params.merge!('filterExecutors' => 'on') if params[:filter_executors]
|
162
|
+
post_params.merge!('useincluderegex' => 'on',
|
163
|
+
'includeRegex' => params[:regex]) if params[:regex]
|
153
164
|
|
154
165
|
if @generator.debug
|
155
166
|
pp post_params
|
@@ -164,60 +175,60 @@ module JenkinsPipelineBuilder
|
|
164
175
|
|
165
176
|
def get_columns(type)
|
166
177
|
columns_repository = {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
178
|
+
'Status' =>
|
179
|
+
{
|
180
|
+
'stapler-class' => 'hudson.views.StatusColumn',
|
181
|
+
'kind' => 'hudson.views.StatusColumn'
|
182
|
+
},
|
183
|
+
'Weather' =>
|
184
|
+
{
|
185
|
+
'stapler-class' => 'hudson.views.WeatherColumn',
|
186
|
+
'kind' => 'hudson.views.WeatherColumn'
|
187
|
+
},
|
188
|
+
'Name' =>
|
189
|
+
{
|
190
|
+
'stapler-class' => 'hudson.views.JobColumn',
|
191
|
+
'kind' => 'hudson.views.JobColumn'
|
192
|
+
},
|
193
|
+
'Last Success' =>
|
194
|
+
{
|
195
|
+
'stapler-class' => 'hudson.views.LastSuccessColumn',
|
196
|
+
'kind' => 'hudson.views.LastSuccessColumn'
|
197
|
+
},
|
198
|
+
'Last Failure' =>
|
199
|
+
{
|
200
|
+
'stapler-class' => 'hudson.views.LastFailureColumn',
|
201
|
+
'kind' => 'hudson.views.LastFailureColumn'
|
202
|
+
},
|
203
|
+
'Last Duration' =>
|
204
|
+
{
|
205
|
+
'stapler-class' => 'hudson.views.LastDurationColumn',
|
206
|
+
'kind' => 'hudson.views.LastDurationColumn'
|
207
|
+
},
|
208
|
+
'Build Button' =>
|
209
|
+
{
|
210
|
+
'stapler-class' => 'hudson.views.BuildButtonColumn',
|
211
|
+
'kind' => 'hudson.views.BuildButtonColumn'
|
212
|
+
},
|
213
|
+
'Categorized - Job' =>
|
214
|
+
{
|
215
|
+
'stapler-class' => 'org.jenkinsci.plugins.categorizedview.IndentedJobColumn',
|
216
|
+
'kind' => 'org.jenkinsci.plugins.categorizedview.IndentedJobColumn'
|
217
|
+
}
|
207
218
|
}
|
208
219
|
|
209
220
|
column_names = case type
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
221
|
+
when 'categorizedView'
|
222
|
+
['Status', 'Weather', 'Categorized - Job', 'Last Success', 'Last Failure', 'Last Duration', 'Build Button']
|
223
|
+
else
|
224
|
+
['Status', 'Weather', 'Name', 'Last Success', 'Last Failure', 'Last Duration', 'Build Button']
|
214
225
|
end
|
215
226
|
|
216
227
|
result = []
|
217
228
|
column_names.each do |name|
|
218
229
|
result << columns_repository[name]
|
219
230
|
end
|
220
|
-
|
231
|
+
result
|
221
232
|
end
|
222
233
|
|
223
234
|
def path_encode(path)
|
@@ -230,18 +241,18 @@ module JenkinsPipelineBuilder
|
|
230
241
|
# @param [String] filter a regex to filter view names
|
231
242
|
# @param [Bool] ignorecase whether to be case sensitive or not
|
232
243
|
#
|
233
|
-
def list_children(parent_view = nil, filter =
|
244
|
+
def list_children(parent_view = nil, filter = '', ignorecase = true)
|
234
245
|
@logger.info "Obtaining children views of parent #{parent_view} based on filter '#{filter}'"
|
235
246
|
view_names = []
|
236
247
|
path = parent_view.nil? ? '' : "/view/#{parent_view}"
|
237
248
|
response_json = @client.api_get_request(path)
|
238
|
-
response_json[
|
249
|
+
response_json['views'].each do |view|
|
239
250
|
if ignorecase
|
240
|
-
view_names << view[
|
251
|
+
view_names << view['name'] if view['name'] =~ /#{filter}/i
|
241
252
|
else
|
242
|
-
view_names << view[
|
253
|
+
view_names << view['name'] if view['name'] =~ /#{filter}/
|
243
254
|
end
|
244
|
-
|
255
|
+
end
|
245
256
|
view_names
|
246
257
|
end
|
247
258
|
|
@@ -255,5 +266,16 @@ module JenkinsPipelineBuilder
|
|
255
266
|
path += "/view/#{view_name}/doDelete"
|
256
267
|
@client.api_post_request(path)
|
257
268
|
end
|
269
|
+
# Checks if the given view exists in Jenkins
|
270
|
+
#
|
271
|
+
# @param [String] view_name
|
272
|
+
#
|
273
|
+
def exists?(view_name, parent_view = nil)
|
274
|
+
if parent_view
|
275
|
+
list_children(parent_view, view_name).include?(view_name)
|
276
|
+
else
|
277
|
+
list(view_name).include?(view_name)
|
278
|
+
end
|
279
|
+
end
|
258
280
|
end
|
259
|
-
end
|
281
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2014
|
2
|
+
# Copyright (c) 2014 Constant Contact
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -22,102 +22,102 @@
|
|
22
22
|
|
23
23
|
module JenkinsPipelineBuilder
|
24
24
|
class Wrappers
|
25
|
-
def self.ansicolor(
|
26
|
-
xml.send('hudson.plugins.ansicolor.AnsiColorBuildWrapper')
|
25
|
+
def self.ansicolor(_, xml)
|
26
|
+
xml.send('hudson.plugins.ansicolor.AnsiColorBuildWrapper') do
|
27
27
|
xml.colorMapName 'xterm'
|
28
|
-
|
28
|
+
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def self.console_timestamp(
|
31
|
+
def self.console_timestamp(_, xml)
|
32
32
|
xml.send('hudson.plugins.timestamper.TimestamperBuildWrapper', 'plugin' => 'timestamper')
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.run_with_rvm05(wrapper, xml)
|
36
|
-
xml.send('ruby-proxy-object')
|
37
|
-
xml.send('ruby-object', 'ruby-class' => 'Jenkins::Tasks::BuildWrapperProxy', 'pluginid' => 'rvm')
|
38
|
-
xml.object('ruby-class' => 'RvmWrapper', 'pluginid' => 'rvm')
|
39
|
-
xml.impl('pluginid' =>
|
40
|
-
|
36
|
+
xml.send('ruby-proxy-object') do
|
37
|
+
xml.send('ruby-object', 'ruby-class' => 'Jenkins::Tasks::BuildWrapperProxy', 'pluginid' => 'rvm') do
|
38
|
+
xml.object('ruby-class' => 'RvmWrapper', 'pluginid' => 'rvm') do
|
39
|
+
xml.impl('pluginid' => 'rvm', 'ruby-class' => 'String') { xml.text wrapper }
|
40
|
+
end
|
41
41
|
xml.pluginid(:pluginid => 'rvm', 'ruby-class' => 'String') { xml.text 'rvm' }
|
42
|
-
|
43
|
-
|
42
|
+
end
|
43
|
+
end
|
44
44
|
end
|
45
45
|
def self.run_with_rvm(wrapper, xml)
|
46
|
-
xml.send('ruby-proxy-object')
|
47
|
-
xml.send('ruby-object', 'ruby-class' => 'Jenkins::Plugin::Proxies::BuildWrapper', 'pluginid' => 'rvm')
|
48
|
-
xml.object('ruby-class' => 'RvmWrapper', 'pluginid' => 'rvm')
|
49
|
-
xml.impl('pluginid' =>
|
50
|
-
|
46
|
+
xml.send('ruby-proxy-object') do
|
47
|
+
xml.send('ruby-object', 'ruby-class' => 'Jenkins::Plugin::Proxies::BuildWrapper', 'pluginid' => 'rvm') do
|
48
|
+
xml.object('ruby-class' => 'RvmWrapper', 'pluginid' => 'rvm') do
|
49
|
+
xml.impl('pluginid' => 'rvm', 'ruby-class' => 'String') { xml.text wrapper }
|
50
|
+
end
|
51
51
|
xml.pluginid(:pluginid => 'rvm', 'ruby-class' => 'String') { xml.text 'rvm' }
|
52
|
-
|
53
|
-
|
52
|
+
end
|
53
|
+
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def self.inject_passwords(passwords, xml)
|
57
|
-
xml.EnvInjectPasswordWrapper
|
57
|
+
xml.EnvInjectPasswordWrapper do
|
58
58
|
xml.injectGlobalPasswords false
|
59
|
-
xml.passwordEntries
|
59
|
+
xml.passwordEntries do
|
60
60
|
passwords.each do |password|
|
61
|
-
xml.EnvInjectPasswordEntry
|
61
|
+
xml.EnvInjectPasswordEntry do
|
62
62
|
xml.name password[:name]
|
63
63
|
xml.value password[:value]
|
64
|
-
|
64
|
+
end
|
65
65
|
end
|
66
|
-
|
67
|
-
|
66
|
+
end
|
67
|
+
end
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.inject_env_vars(params, xml)
|
71
|
-
xml.EnvInjectBuildWrapper
|
72
|
-
xml.info
|
71
|
+
xml.EnvInjectBuildWrapper do
|
72
|
+
xml.info do
|
73
73
|
xml.propertiesFilePath params[:file] if params[:file]
|
74
74
|
xml.propertiesContent params[:content] if params[:content]
|
75
75
|
xml.loadFilesFromMaster false
|
76
|
-
|
77
|
-
|
76
|
+
end
|
77
|
+
end
|
78
78
|
end
|
79
79
|
|
80
80
|
def self.publish_to_artifactory(wrapper, xml)
|
81
|
-
xml.send('org.jfrog.hudson.generic.ArtifactoryGenericConfigurator')
|
82
|
-
xml.details
|
81
|
+
xml.send('org.jfrog.hudson.generic.ArtifactoryGenericConfigurator') do
|
82
|
+
xml.details do
|
83
83
|
xml.artifactoryUrl wrapper[:url]
|
84
84
|
xml.artifactoryName wrapper[:'artifactory-name']
|
85
85
|
xml.repositoryKey wrapper[:'release-repo']
|
86
86
|
xml.snapshotsRepositoryKey wrapper.fetch(:'snapshot-repo', wrapper[:'release-repo'])
|
87
|
-
|
87
|
+
end
|
88
88
|
xml.deployPattern wrapper[:publish]
|
89
89
|
xml.resolvePattern
|
90
|
-
xml.matrixParams
|
90
|
+
xml.matrixParams wrapper[:properties]
|
91
91
|
xml.deployBuildInfo wrapper[:'publish-build-info']
|
92
92
|
xml.includeEnvVars false
|
93
|
-
xml.envVarsPatterns
|
93
|
+
xml.envVarsPatterns do
|
94
94
|
xml.includePatterns
|
95
95
|
xml.excludePatterns '*password*,*secret*'
|
96
|
-
|
96
|
+
end
|
97
97
|
xml.discardOldBuilds false
|
98
98
|
xml.discardBuildArtifacts true
|
99
|
-
|
99
|
+
end
|
100
100
|
end
|
101
101
|
|
102
102
|
def self.artifactory_maven3_configurator(wrapper, xml)
|
103
|
-
xml.send('org.jfrog.hudson.maven3.ArtifactoryMaven3Configurator')
|
104
|
-
xml.details
|
103
|
+
xml.send('org.jfrog.hudson.maven3.ArtifactoryMaven3Configurator') do # plugin='artifactory@2.2.1'
|
104
|
+
xml.details do
|
105
105
|
xml.artifactoryUrl wrapper[:url]
|
106
106
|
xml.artifactoryName wrapper[:'artifactory-name']
|
107
107
|
xml.repositoryKey wrapper[:'release-repo']
|
108
108
|
xml.snapshotsRepositoryKey wrapper.fetch(:'snapshot-repo', wrapper[:'release-repo'])
|
109
|
-
|
109
|
+
end
|
110
110
|
xml.deployArtifacts wrapper.fetch(:'deploy', true)
|
111
|
-
xml.artifactDeploymentPatterns
|
111
|
+
xml.artifactDeploymentPatterns do
|
112
112
|
xml.includePatterns
|
113
113
|
xml.excludePatterns
|
114
|
-
|
114
|
+
end
|
115
115
|
xml.includeEnvVars false
|
116
116
|
xml.deployBuildInfo wrapper.fetch(:'publish-build-info', true)
|
117
|
-
xml.envVarsPatterns
|
117
|
+
xml.envVarsPatterns do
|
118
118
|
xml.includePatterns
|
119
119
|
xml.excludePatterns '*password*,*secret*'
|
120
|
-
|
120
|
+
end
|
121
121
|
xml.runChecks false
|
122
122
|
xml.violationRecipients
|
123
123
|
xml.includePublishArtifacts false
|
@@ -138,7 +138,7 @@ module JenkinsPipelineBuilder
|
|
138
138
|
xml.autoCreateMissingComponentRequests true
|
139
139
|
xml.autoDiscardStaleComponentRequests true
|
140
140
|
xml.filterExcludedArtifactsFromBuild false
|
141
|
-
|
141
|
+
end
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|