Skip to content

Commit

Permalink
Add deployment ID as url link (#14)
Browse files Browse the repository at this point in the history
* Add deployment ID as url link for all Codedeploy messages
  • Loading branch information
Komorebi-E committed Nov 22, 2018
1 parent 2bfbdfa commit bb7b3ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions notify-slack/functions/lambda-slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def send_slack(message):
"""
Send Slack Message to Deployments Channel
"""
region = os.environ['AWS_DEFAULT_REGION']
slack_url = decrypt(os.environ['SLACK_WEBHOOK'])
slack_channel = os.environ['SLACK_CHANNEL']
notify_users = os.environ['NOTIFY_USERS']
Expand All @@ -34,8 +35,10 @@ def send_slack(message):
icon_emoji = ":codedeploy:"
title = message['status']
pretext = ""
text = "The deployment for app *%s* in group %s\n with id `%s`" % ( message['applicationName'],
message['deploymentGroupName'], message['deploymentId'])
deployment_url = '<https://' + region + '.console.aws.amazon.com/codesuite/codedeploy/deployments/' + message['deploymentId'] + '?region=' + region + '|' + message['deploymentId'] + '>'

text = "The deployment for app *%s* in group %s\n with id %s" % ( message['applicationName'],
message['deploymentGroupName'], deployment_url)

matchObj = re.match( r'fail', message['status'], re.I) # Check for FAILED state
if matchObj :
Expand Down
Binary file removed notify-slack/functions/lambda-slack.zip
Binary file not shown.

0 comments on commit bb7b3ec

Please sign in to comment.