Skip to content

Commit 885841c

Browse files
committed
Drop Bitbucket support
since only the Bitbucket Server product supports signed payloads, bitbucket.org does not. And we are requiring signed payloads.
1 parent f7396cf commit 885841c

8 files changed

Lines changed: 4 additions & 74 deletions

File tree

awx/api/urls/webhooks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
WebhookKeyView,
55
GithubWebhookReceiver,
66
GitlabWebhookReceiver,
7-
BitbucketWebhookReceiver,
87
)
98

109

1110
urlpatterns = [
1211
url(r'^webhook_key/$', WebhookKeyView.as_view(), name='webhook_key'),
1312
url(r'^github/$', GithubWebhookReceiver.as_view(), name='webhook_receiver_github'),
1413
url(r'^gitlab/$', GitlabWebhookReceiver.as_view(), name='webhook_receiver_gitlab'),
15-
url(r'^bitbucket/$', BitbucketWebhookReceiver.as_view(), name='webhook_receiver_bitbucket'),
1614
]

awx/api/views/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@
154154
WebhookKeyView,
155155
GithubWebhookReceiver,
156156
GitlabWebhookReceiver,
157-
BitbucketWebhookReceiver,
158157
)
159158

160159

awx/api/views/webhooks.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -240,52 +240,3 @@ def check_signature(self, obj):
240240
# analysis by attackers.
241241
if not hmac.compare_digest(force_bytes(obj.webhook_key), self.get_signature()):
242242
raise PermissionDenied
243-
244-
245-
class BitbucketWebhookReceiver(WebhookReceiverBase):
246-
service = 'bitbucket'
247-
248-
ref_keys = {
249-
# Bitbucket Server
250-
'repo:refs_changed': 'changes.0.toHash',
251-
'repo:comment:added': 'commit',
252-
'repo:comment:edited': 'commit',
253-
'repo:comment:deleted': 'commit',
254-
'pr:opened': 'pullRequest.fromRef.latestCommit',
255-
'pr:modified': 'pullRequest.fromRef.latestCommit',
256-
'pr:reviewer:updated': 'pullRequest.fromRef.latestCommit',
257-
'pr:reviewer:approved': 'pullRequest.fromRef.latestCommit',
258-
'pr:reviewer:unapproved': 'pullRequest.fromRef.latestCommit',
259-
'pr:reviewer:needs_work': 'pullRequest.fromRef.latestCommit',
260-
'pr:merged': 'pullRequest.fromRef.latestCommit',
261-
'pr:declined': 'pullRequest.fromRef.latestCommit',
262-
'pr:deleted': 'pullRequest.fromRef.latestCommit',
263-
'pr:comment:added': 'pullRequest.fromRef.latestCommit',
264-
'pr:comment:edited': 'pullRequest.fromRef.latestCommit',
265-
'pr:comment:deleted': 'pullRequest.fromRef.latestCommit',
266-
267-
# Bitbucket Cloud, aka bitbucket.org
268-
'repo:push': 'push.changes.0.new.target.hash',
269-
'repo:commit_comment_created': 'commit.hash',
270-
'pullrequest:created': 'pullrequest.source.commit',
271-
'pullrequest:updated': 'pullrequest.source.commit',
272-
'pullrequest:approved': 'pullrequest.source.commit',
273-
'pullrequest:unapproved': 'pullrequest.source.commit',
274-
'pullrequest:fulfilled': 'pullrequest.source.commit',
275-
'pullrequest:rejected': 'pullrequest.source.commit',
276-
'pullrequest:comment_created': 'pullrequest.source.commit',
277-
'pullrequest:comment_updated': 'pullrequest.source.commit',
278-
'pullrequest:comment_deleted': 'pullrequest.source.commit',
279-
}
280-
281-
def get_event_type(self):
282-
return self.request.META.get('HTTP_X_EVENT_KEY')
283-
284-
def get_event_guid(self):
285-
return self.request.META.get('HTTP_X_REQUEST_UUID')
286-
287-
def get_signature(self):
288-
header_sig = self.request.META.get('HTTP_X_HUB_SIGNATURE')
289-
if not header_sig:
290-
raise PermissionDenied
291-
return force_bytes(header_sig)

awx/main/migrations/0092_v360_webhook_mixin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Migration(migrations.Migration):
2424
migrations.AddField(
2525
model_name='jobtemplate',
2626
name='webhook_service',
27-
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab'), ('bitbucket', 'Bitbucket')], max_length=16),
27+
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab')], max_length=16),
2828
),
2929
migrations.AddField(
3030
model_name='workflowjobtemplate',
@@ -39,6 +39,6 @@ class Migration(migrations.Migration):
3939
migrations.AddField(
4040
model_name='workflowjobtemplate',
4141
name='webhook_service',
42-
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab'), ('bitbucket', 'Bitbucket')], max_length=16),
42+
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab')], max_length=16),
4343
),
4444
]

awx/main/migrations/0094_v360_webhook_mixin2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Migration(migrations.Migration):
2424
migrations.AddField(
2525
model_name='job',
2626
name='webhook_service',
27-
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab'), ('bitbucket', 'Bitbucket')], max_length=16),
27+
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab')], max_length=16),
2828
),
2929
migrations.AddField(
3030
model_name='workflowjob',
@@ -39,6 +39,6 @@ class Migration(migrations.Migration):
3939
migrations.AddField(
4040
model_name='workflowjob',
4141
name='webhook_service',
42-
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab'), ('bitbucket', 'Bitbucket')], max_length=16),
42+
field=models.CharField(blank=True, choices=[('github', 'Github'), ('gitlab', 'Gitlab')], max_length=16),
4343
),
4444
]

awx/main/models/credential/__init__.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,22 +1001,6 @@ def create(self):
10011001
},
10021002
)
10031003

1004-
ManagedCredentialType(
1005-
namespace='bitbucket_token',
1006-
kind='token',
1007-
name=ugettext_noop('Bitbucket Personal Access Token'),
1008-
managed_by_tower=True,
1009-
inputs={
1010-
'fields': [{
1011-
'id': 'token',
1012-
'label': ugettext_noop('Token'),
1013-
'type': 'string',
1014-
'secret': True,
1015-
}],
1016-
'required': ['token'],
1017-
},
1018-
)
1019-
10201004
ManagedCredentialType(
10211005
namespace='insights',
10221006
kind='insights',

awx/main/models/mixins.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ class Meta:
498498
SERVICES = [
499499
('github', "Github"),
500500
('gitlab', "Gitlab"),
501-
('bitbucket', "Bitbucket"),
502501
]
503502

504503
webhook_service = models.CharField(

awx/main/tests/functional/test_credential.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def test_default_cred_types():
7979
'aws',
8080
'azure_kv',
8181
'azure_rm',
82-
'bitbucket_token',
8382
'cloudforms',
8483
'conjur',
8584
'gce',

0 commit comments

Comments
 (0)