jenkins_pipeline_builder 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c9eaa60f562aa024ee5a9b44bdb38a5449e9a41
4
- data.tar.gz: a3e1a81c570cfa3fefa4d81aa5e03e6182a0073f
3
+ metadata.gz: a578698f30c71e6c28107103857b4be73e8dfa4f
4
+ data.tar.gz: 57ea00034bf5cebd16d3ced5a886c027456e2c0a
5
5
  SHA512:
6
- metadata.gz: e19ef3c9750c89d0aa696a0c252faef6de04177e4c6288fafbd1339cab7a2ceeafd7764055ec25015c81f3afb8edffeeef1d794fe4d8f261c379b10b9d57781a
7
- data.tar.gz: 564e2f4f913f581bb9ac35a5dd7d7874f823ad1051500664d2bc2d1d1cabc5313bfa3b3482a7b29da76f4ce8e06c600d3c7760ad19d4450ddbc0f529f42c941a
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
- 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
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
- send('notifications') do
118
- if startNotification params[:start_notify]
119
- send('jenkins.plugins.hipchat.model.NotificationConfig') do
120
- notifyEnabled params[:enabled_notify] || false
121
- textFormat params[:text_format] || false
122
- notificationType params[:notification_type] || 'STARTED'
123
- color params[:color] || ''
124
- messageTemplate params[:message_template] || ''
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
- end
127
- if notifySuccess params[:success_notify]
128
- send('jenkins.plugins.hipchat.model.NotificationConfig') do
129
- notifyEnabled params[:enabled_notify] || false
130
- textFormat params[:text_format] || false
131
- notificationType params[:notification_type] || 'SUCCESS'
132
- color params[:color] || ''
133
- messageTemplate params[:message_template] || ''
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
- end
136
- if notifyFailure params[:failure_notify]
137
- send('jenkins.plugins.hipchat.model.NotificationConfig') do
138
- notifyEnabled params[:enabled_notify] || false
139
- textFormat params[:text_format] || false
140
- notificationType params[:notification_type] || 'FAILURE'
141
- color params[:color] || ''
142
- messageTemplate params[:message_template] || ''
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
- end
145
- if notifyBackToNormal params[:normal_notify]
146
- send('jenkins.plugins.hipchat.model.NotificationConfig') do
147
- notifyEnabled params[:enabled_notify] || false
148
- textFormat params[:text_format] || false
149
- notificationType params[:notification_type] || 'BACK_TO_NORMAL'
150
- color params[:color] || ''
151
- messageTemplate params[:message_template] || ''
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
- end
154
- if notifyAborted params[:aborted_notify]
155
- send('jenkins.plugins.hipchat.model.NotificationConfig') do
156
- notifyEnabled params[:enabled_notify] || false
157
- textFormat params[:text_format] || false
158
- notificationType params[:notification_type] || 'ABORTED'
159
- color params[:color] || ''
160
- messageTemplate params[:message_template] || ''
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
- end
163
- if notifyNotBuilt params[:notbuilt_notify]
164
- send('jenkins.plugins.hipchat.model.NotificationConfig') do
165
- notifyEnabled params[:enabled_notify] || false
166
- textFormat params[:text_format] || false
167
- notificationType params[:notification_type] || 'NOT_BUILT'
168
- color params[:color] || ''
169
- messageTemplate params[:message_template] || ''
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
- end
172
- if notifyUnstable params[:unstable_notify]
173
- send('jenkins.plugins.hipchat.model.NotificationConfig') do
174
- notifyEnabled params[:enabled_notify] || false
175
- textFormat params[:text_format] || false
176
- notificationType params[:notification_type] || 'UNSTABLE'
177
- color params[:color] || ''
178
- messageTemplate params[:message_template] || ''
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
@@ -62,7 +62,6 @@ module JenkinsPipelineBuilder
62
62
  root = prefix.inject(@registry, :[])
63
63
  root[name] = {} unless root[name]
64
64
  # TODO: Set installed version here
65
-
66
65
  if root[name][set.name]
67
66
  root[name][set.name].merge set
68
67
  else
@@ -21,5 +21,5 @@
21
21
  #
22
22
 
23
23
  module JenkinsPipelineBuilder
24
- VERSION = '1.5.0'.freeze
24
+ VERSION = '1.5.1'.freeze
25
25
  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
- children = publisher.children.children.children.map(&:name)
205
- expect(children).to include 'notifyEnabled'
206
- expect(children).to include 'textFormat'
207
- expect(children).to include 'notificationType'
208
- expect(children).to include 'color'
209
- expect(children).to include 'messageTemplate'
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
 
@@ -65,7 +65,7 @@ JOB_ATTRIBUTES = {
65
65
  jdk: ['0'],
66
66
  disabled: ['0'],
67
67
  discard_old: ['0'],
68
- hipchat: ['0'],
68
+ hipchat: ['0', '2.0.0'],
69
69
  inject_env_vars_pre_scm: ['0'],
70
70
  parameters: ['0'],
71
71
  shared_workspace: ['0'],
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.0
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-09-25 00:00:00.000000000 Z
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.13
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