Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

Commit b3a1d04

Browse files
committed
cater for BitBucket using fullName in some payloads #14
1 parent 0b86a42 commit b3a1d04

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
21 Bytes
Binary file not shown.

functions/source/GitPullS3/lambda_function.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,24 @@ def lambda_handler(event, context):
149149
if k1 == k2:
150150
secure = True
151151
# TODO: Add the ability to clone TFS repo using SSH keys
152+
try:
153+
full_name = event['body-json']['repository']['full_name']
154+
except KeyError:
155+
full_name = event['body-json']['repository']['fullName']
152156
if not secure:
153157
logger.error('Source IP %s is not allowed' % event['context']['source-ip'])
154158
raise Exception('Source IP %s is not allowed' % event['context']['source-ip'])
155159

156160
if('action' in event['body-json'] and event['body-json']['action'] == 'published'):
157161
branch_name = 'tags/%s' % event['body-json']['release']['tag_name']
158-
repo_name = event['body-json']['repository']['full_name'] + '/release'
162+
repo_name = full_name + '/release'
159163
else:
160164
try:
161165
branch_name = 'master'
162166
repo_name = event['body-json']['project']['path_with_namespace']
163167
except:
164168
branch_name = event['body-json']['ref'].replace('refs/heads/', '')
165-
repo_name = event['body-json']['repository']['full_name'] + '/branch/' + branch_name
169+
repo_name = full_name + '/branch/' + branch_name
166170
try:
167171
remote_url = event['body-json']['project']['git_ssh_url']
168172
except Exception:
@@ -189,3 +193,4 @@ def lambda_handler(event, context):
189193
os.remove('/tmp/id_rsa')
190194
os.remove('/tmp/id_rsa.pub')
191195
return 'Successfully updated %s' % repo_name
196+

0 commit comments

Comments
 (0)