puppet_webhook 1.6.2 → 1.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ed278f549c585151ba3bbb7b57e3e04ad14790d
4
- data.tar.gz: a6d0eb7a04bb324c23b21b56badb309214206d45
3
+ metadata.gz: 1cdcbe080e4194ca1c71141582598485ad0034fb
4
+ data.tar.gz: cb970f5f9ca4e30cd45adb0ea2e20bfe8204fae2
5
5
  SHA512:
6
- metadata.gz: 37d39b4ee20fd892843b639300114f908f4ab3187c5cc79b19c6f5a192dca6fa74aa32fe315ccc250d8510ac78d00a0430ccf7d2aeb2eaa1eb13e0537d367812
7
- data.tar.gz: 26dd12e232e6ef9879163cafd67183f6f6b7fb1f8337a17b980ea9abc451a3c8b73240d070e79487c9f3f4cc11a5be8bdafeae9ea93dbf27cf7d02cc34ea7e69
6
+ metadata.gz: 44a02e6abe9bb252501ec8d03688d846165c1f2e0d38518ff552fde01dd28264bb30c951aef9680d54078472356b094f8cb881480c0e5f316f471714647ab65c
7
+ data.tar.gz: c0b25a2c51b5c59066b59fb457933ec8249715b4ae64185a8712e9e140aed15e60ac7c70eef129fdcfb7687d92115211e6de2da4478ec73607f39110dfc4b19b
@@ -1,11 +1,16 @@
1
1
  # Changelog
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
- Each new release typically also includes the latest modulesync defaults.
5
- These should not affect the functionality of the module.
6
4
 
7
- ## [v1.6.1](https://github.com/voxpupuli/puppet_webhook/tree/v1.6.1) (2019-01-15)
8
- [Full Changelog](https://github.com/voxpupuli/puppet_webhook/compare/v1.6.1...v1.6.1)
5
+ ## [v1.7.0](https://github.com/voxpupuli/puppet_webhook/tree/v1.7.0) (2019-02-18)
6
+ [Full Changelog](https://github.com/voxpupuli/puppet_webhook/compare/v1.6.2...v1.7.0)
7
+
8
+ **Merged pull requests:**
9
+
10
+ - Re-enable `stash` \(post receive hook plugin\) support [\#90](https://github.com/voxpupuli/puppet_webhook/pull/90) ([alexjfisher](https://github.com/alexjfisher))
11
+
12
+ ## [v1.6.2](https://github.com/voxpupuli/puppet_webhook/tree/v1.6.2) (2019-01-15)
13
+ [Full Changelog](https://github.com/voxpupuli/puppet_webhook/compare/v1.6.1...v1.6.2)
9
14
 
10
15
  **Fixed bugs:**
11
16
 
@@ -166,4 +171,4 @@ These should not affect the functionality of the module.
166
171
 
167
172
 
168
173
 
169
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
174
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -19,11 +19,12 @@ module Sinatra
19
19
  end
20
20
 
21
21
  def detect_vcs
22
- return 'github' if github_webhook?
23
- return 'gitlab' if gitlab_webhook?
24
- return 'stash' if stash_webhook?
25
- return 'bitbucket' if bitbucket_webhook?
26
- return 'tfs' if tfs_webhook?
22
+ return 'github' if github_webhook?
23
+ return 'gitlab' if gitlab_webhook?
24
+ return 'bitbucket-server' if bitbucket_server_webhook?
25
+ return 'bitbucket' if bitbucket_webhook?
26
+ return 'stash' if stash_webhook?
27
+ return 'tfs' if tfs_webhook?
27
28
 
28
29
  raise StandardError, 'payload not recognised'
29
30
  end
@@ -38,8 +39,8 @@ module Sinatra
38
39
  env.key?('HTTP_X_GITLAB_EVENT')
39
40
  end
40
41
 
41
- # stash/bitbucket server
42
- def stash_webhook?
42
+ # bitbucket server
43
+ def bitbucket_server_webhook?
43
44
  # https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html
44
45
  env.key?('HTTP_X_EVENT_KEY') && env.key?('HTTP_X_REQUEST_ID')
45
46
  end
@@ -49,6 +50,11 @@ module Sinatra
49
50
  env.key?('HTTP_X_EVENT_KEY') && env.key?('HTTP_X_HOOK_UUID')
50
51
  end
51
52
 
53
+ def stash_webhook?
54
+ # https://confluence.atlassian.com/bitbucketserver/post-service-webhook-for-bitbucket-server-776640367.html
55
+ env.key?('HTTP_X_ATLASSIAN_TOKEN')
56
+ end
57
+
52
58
  def tfs_webhook?
53
59
  # https://docs.microsoft.com/en-us/vsts/service-hooks/services/webhooks
54
60
  return false unless @data.key? 'resource'
@@ -67,12 +73,14 @@ module Sinatra
67
73
  end
68
74
  when 'gitlab'
69
75
  @data['ref'].sub('refs/heads/', '')
70
- when 'stash'
76
+ when 'bitbucket-server'
71
77
  @data['changes'][0]['refId'].sub('refs/heads/', '')
72
78
  when 'bitbucket'
73
79
  return @data['push']['changes'][0]['new']['name'] unless deleted?
74
80
 
75
81
  @data['push']['changes'][0]['old']['name']
82
+ when 'stash'
83
+ @data['refChanges'][0]['refId'].sub('refs/heads/', '')
76
84
  when 'tfs'
77
85
  @data['resource']['refUpdates'][0]['name'].sub('refs/heads/', '')
78
86
  end
@@ -84,10 +92,12 @@ module Sinatra
84
92
  @data['deleted']
85
93
  when 'gitlab'
86
94
  @data['after'] == '0000000000000000000000000000000000000000'
87
- when 'stash'
95
+ when 'bitbucket-server'
88
96
  @data['changes'][0]['type'] == 'DELETE'
89
97
  when 'bitbucket'
90
98
  @data['push']['changes'][0]['closed']
99
+ when 'stash'
100
+ @data['refChanges'][0]['type'] == 'DELETE'
91
101
  when 'tfs'
92
102
  @data['resource']['refUpdates'][0]['newObjectId'] == '0000000000000000000000000000000000000000'
93
103
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet_webhook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-15 00:00:00.000000000 Z
11
+ date: 2019-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json