jenkins_pipeline_builder 1.5.0 → 1.5.1
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 +4 -4
- data/lib/jenkins_pipeline_builder/extensions/job_attributes.rb +21 -14
- data/lib/jenkins_pipeline_builder/extensions/publishers.rb +58 -57
- data/lib/jenkins_pipeline_builder/module_registry.rb +0 -1
- data/lib/jenkins_pipeline_builder/version.rb +1 -1
- data/spec/lib/jenkins_pipeline_builder/extensions/publishers_spec.rb +54 -9
- data/spec/lib/jenkins_pipeline_builder/extensions/registered_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a578698f30c71e6c28107103857b4be73e8dfa4f
|
4
|
+
data.tar.gz: 57ea00034bf5cebd16d3ced5a886c027456e2c0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7512de621f5099fcfd7b1324fc99f3deab84f6cd52d8add4b6bd9e65f1bf3fcabd02f98157a0afa1372047b84493e3a2d78ba7ecb77008d2228e012501e48805
|
7
|
+
data.tar.gz: 790629f860d9db07c16a8a158ecad15e6b9378c6e8b8e05c69c3a20ea7f28a96b61f7671877da8f0d399dfc51147282503a932f78a1d8d020a5e8763b490f958
|
@@ -19,7 +19,6 @@
|
|
19
19
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
20
|
# THE SOFTWARE.
|
21
21
|
#
|
22
|
-
|
23
22
|
# Promotion specific job attributes
|
24
23
|
job_attribute do
|
25
24
|
name :promotion_description
|
@@ -272,19 +271,27 @@ job_attribute do
|
|
272
271
|
jenkins_name 'HipChat Notifications'
|
273
272
|
announced false
|
274
273
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
274
|
+
version '0' do
|
275
|
+
xml path: '//properties' do |params|
|
276
|
+
raise 'No HipChat room specified' unless params[:room]
|
277
|
+
|
278
|
+
send('jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty') do
|
279
|
+
room params[:room]
|
280
|
+
# :'start-notify' is legacy and evil, but I don't want anyone complaining
|
281
|
+
startNotification params[:start_notify] || params[:'start-notify'] || false
|
282
|
+
notifySuccess params[:success_notify] || true
|
283
|
+
notifyFailure params[:failure_notify] || true
|
284
|
+
notifyBackToNormal params[:normal_notify] || true
|
285
|
+
notifyAborted params[:aborted_notify] || true
|
286
|
+
notifyNotBuilt params[:notbuilt_notify] || false
|
287
|
+
notifyUnstable params[:unstable_notify] || true
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
# The xml laid down for previous versions of the hipchat notifier require the above xml format
|
292
|
+
# However, version 2.0.0 specifically needs that xml to not be there.
|
293
|
+
version '2.0.0' do
|
294
|
+
xml path: '//properties' do |_params|
|
288
295
|
end
|
289
296
|
end
|
290
297
|
end
|
@@ -18,7 +18,6 @@
|
|
18
18
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
19
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
20
|
# THE SOFTWARE.
|
21
|
-
|
22
21
|
publisher do
|
23
22
|
name :description_setter
|
24
23
|
plugin_id 'description-setter'
|
@@ -114,68 +113,70 @@ publisher do
|
|
114
113
|
send('jenkins.plugins.hipchat.HipChatNotifier') do
|
115
114
|
credentialId params[:credential_id] || ''
|
116
115
|
room params[:room] || ''
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
116
|
+
if params[:notifications]
|
117
|
+
send('notifications') do
|
118
|
+
if params[:notifications][:start_notify]
|
119
|
+
send('jenkins.plugins.hipchat.model.NotificationConfig') do
|
120
|
+
notifyEnabled params[:notifications][:start_notify][:enabled_notify] || false
|
121
|
+
textFormat params[:notifications][:start_notify][:text_format] || false
|
122
|
+
notificationType params[:notifications][:start_notify][:notification_type] || 'STARTED'
|
123
|
+
color params[:notifications][:start_notify][:color] || ''
|
124
|
+
messageTemplate params[:notifications][:start_notify][:message_template] || ''
|
125
|
+
end
|
125
126
|
end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
127
|
+
if params[:notifications][:success_notify]
|
128
|
+
send('jenkins.plugins.hipchat.model.NotificationConfig') do
|
129
|
+
notifyEnabled params[:notifications][:success_notify][:enabled_notify] || false
|
130
|
+
textFormat params[:notifications][:success_notify][:text_format] || false
|
131
|
+
notificationType params[:notifications][:success_notify][:notification_type] || 'SUCCESS'
|
132
|
+
color params[:notifications][:success_notify][:color] || ''
|
133
|
+
messageTemplate params[:notifications][:success_notify][:message_template] || ''
|
134
|
+
end
|
134
135
|
end
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
136
|
+
if params[:notifications][:failure_notify]
|
137
|
+
send('jenkins.plugins.hipchat.model.NotificationConfig') do
|
138
|
+
notifyEnabled params[:notifications][:failure_notify][:enabled_notify] || false
|
139
|
+
textFormat params[:notifications][:failure_notify][:text_format] || false
|
140
|
+
notificationType params[:notifications][:failure_notify][:notification_type] || 'FAILURE'
|
141
|
+
color params[:notifications][:failure_notify][:color] || ''
|
142
|
+
messageTemplate params[:notifications][:failure_notify][:message_template] || ''
|
143
|
+
end
|
143
144
|
end
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
145
|
+
if params[:notifications][:normal_notify]
|
146
|
+
send('jenkins.plugins.hipchat.model.NotificationConfig') do
|
147
|
+
notifyEnabled params[:notifications][:normal_notify][:enabled_notify] || false
|
148
|
+
textFormat params[:notifications][:normal_notify][:text_format] || false
|
149
|
+
notificationType params[:notifications][:normal_notify][:notification_type] || 'BACK_TO_NORMAL'
|
150
|
+
color params[:notifications][:normal_notify][:color] || ''
|
151
|
+
messageTemplate params[:notifications][:normal_notify][:message_template] || ''
|
152
|
+
end
|
152
153
|
end
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
154
|
+
if params[:notifications][:aborted_notify]
|
155
|
+
send('jenkins.plugins.hipchat.model.NotificationConfig') do
|
156
|
+
notifyEnabled params[:notifications][:aborted_notify][:enabled_notify] || false
|
157
|
+
textFormat params[:notifications][:aborted_notify][:text_format] || false
|
158
|
+
notificationType params[:notifications][:aborted_notify][:notification_type] || 'ABORTED'
|
159
|
+
color params[:notifications][:aborted_notify][:color] || ''
|
160
|
+
messageTemplate params[:notifications][:aborted_notify][:message_template] || ''
|
161
|
+
end
|
161
162
|
end
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
163
|
+
if params[:notifications][:notbuilt_notify]
|
164
|
+
send('jenkins.plugins.hipchat.model.NotificationConfig') do
|
165
|
+
notifyEnabled params[:notifications][:notbuilt_notify][:notifications][:notbuilt_notify][:enabled_notify] || false
|
166
|
+
textFormat params[:notifications][:notbuilt_notify][:notifications][:notbuilt_notify][:text_format] || false
|
167
|
+
notificationType params[:notifications][:notbuilt_notify][:notification_type] || 'NOT_BUILT'
|
168
|
+
color params[:notifications][:notbuilt_notify][:color] || ''
|
169
|
+
messageTemplate params[:notifications][:notbuilt_notify][:message_template] || ''
|
170
|
+
end
|
170
171
|
end
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
172
|
+
if params[:notifications][:unstable_notify]
|
173
|
+
send('jenkins.plugins.hipchat.model.NotificationConfig') do
|
174
|
+
notifyEnabled params[:notifications][:unstable_notify][:enabled_notify] || false
|
175
|
+
textFormat params[:notifications][:unstable_notify][:text_format] || false
|
176
|
+
notificationType params[:notifications][:unstable_notify][:notification_type] || 'UNSTABLE'
|
177
|
+
color params[:notifications][:unstable_notify][:color] || ''
|
178
|
+
messageTemplate params[:notifications][:unstable_notify][:message_template] || ''
|
179
|
+
end
|
179
180
|
end
|
180
181
|
end
|
181
182
|
end
|
@@ -188,25 +188,55 @@ describe 'publishers' do
|
|
188
188
|
publisher = @n_xml.root.children.first
|
189
189
|
expect(publisher.name).to match 'jenkins.plugins.hipchat.HipChatNotifier'
|
190
190
|
children = publisher.children.map(&:name)
|
191
|
+
expect(children).not_to include 'notifySuccess'
|
191
192
|
expect(children).to include 'credentialId'
|
192
193
|
expect(children).to include 'room'
|
193
|
-
expect(children).to include 'notifications'
|
194
194
|
expect(children).to include 'startJobMessage'
|
195
195
|
expect(children).to include 'completeJobMessage'
|
196
196
|
end
|
197
197
|
|
198
198
|
it 'instantiates notification parameters' do
|
199
|
-
params = { publishers: { hipchat: {
|
199
|
+
params = { publishers: { hipchat: { notifications: {
|
200
|
+
start_notify: {
|
201
|
+
enabled_notify: true,
|
202
|
+
text_format: false,
|
203
|
+
notification_type: 'STARTED',
|
204
|
+
color: 'GREEN',
|
205
|
+
message_template: ''
|
206
|
+
},
|
207
|
+
failure_notify: {
|
208
|
+
enabled_notify: true,
|
209
|
+
text_format: true,
|
210
|
+
notification_type: 'FAILURE',
|
211
|
+
color: 'RED',
|
212
|
+
message_template: ''
|
213
|
+
}
|
214
|
+
} } } }
|
200
215
|
JenkinsPipelineBuilder.registry.traverse_registry_path('job', params, @n_xml)
|
201
216
|
|
202
217
|
publisher = @n_xml.root.children.first
|
203
218
|
expect(publisher.name).to match 'jenkins.plugins.hipchat.HipChatNotifier'
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
219
|
+
|
220
|
+
start_notify_config = @n_xml.root.children.children[2].children[0]
|
221
|
+
puts start_notify_config
|
222
|
+
failure_notify_config = @n_xml.root.children.children[2].children[1]
|
223
|
+
start_notify_children = start_notify_config.children.map(&:name)
|
224
|
+
start_color = start_notify_config.children[3].children.map(&:text)
|
225
|
+
failure_color = failure_notify_config.children[3].children.map(&:text)
|
226
|
+
expect(start_notify_children).to include 'notifyEnabled'
|
227
|
+
expect(start_notify_children).to include 'textFormat'
|
228
|
+
expect(start_notify_children).to include 'notificationType'
|
229
|
+
expect(start_notify_children).to include 'color'
|
230
|
+
expect(start_notify_children).to include 'messageTemplate'
|
231
|
+
expect(start_color).to include 'GREEN'
|
232
|
+
|
233
|
+
failure_notify_children = failure_notify_config.children.map(&:name)
|
234
|
+
expect(failure_notify_children).to include 'notifyEnabled'
|
235
|
+
expect(failure_notify_children).to include 'textFormat'
|
236
|
+
expect(failure_notify_children).to include 'notificationType'
|
237
|
+
expect(failure_notify_children).to include 'color'
|
238
|
+
expect(failure_color).to include 'RED'
|
239
|
+
expect(failure_notify_children).to include 'messageTemplate'
|
210
240
|
end
|
211
241
|
end
|
212
242
|
|
@@ -217,7 +247,22 @@ describe 'publishers' do
|
|
217
247
|
)
|
218
248
|
end
|
219
249
|
it 'generates a configuration' do
|
220
|
-
params = { publishers: { hipchat: {
|
250
|
+
params = { publishers: { hipchat: { notifications: {
|
251
|
+
start_notify: {
|
252
|
+
enabled_notify: true,
|
253
|
+
text_format: false,
|
254
|
+
notification_type: 'STARTED',
|
255
|
+
color: 'GREEN',
|
256
|
+
message_template: ''
|
257
|
+
},
|
258
|
+
failure_notify: {
|
259
|
+
enabled_notify: true,
|
260
|
+
text_format: true,
|
261
|
+
notification_type: 'FAILURE',
|
262
|
+
color: 'RED',
|
263
|
+
message_template: ''
|
264
|
+
}
|
265
|
+
} } } }
|
221
266
|
hipchat = JenkinsPipelineBuilder.registry.registry[:job][:publishers][:hipchat]
|
222
267
|
expect(hipchat.extension.min_version).to eq '0.1.9'
|
223
268
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins_pipeline_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Moochnick
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -484,7 +484,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
484
484
|
version: '0'
|
485
485
|
requirements: []
|
486
486
|
rubyforge_project:
|
487
|
-
rubygems_version: 2.6.
|
487
|
+
rubygems_version: 2.6.14
|
488
488
|
signing_key:
|
489
489
|
specification_version: 4
|
490
490
|
summary: This gem is will boostrap your Jenkins pipelines
|