Skip to content

Commit

Permalink
Merge branch 'release/1.10.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabfuel committed Feb 10, 2020
2 parents 3089261 + add944d commit a21dc07
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ecs_deploy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.10.0'
VERSION = '1.10.1'
2 changes: 1 addition & 1 deletion ecs_deploy/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def notify_start(self, cluster, tag, task_definition, comment, user, service=Non
messages.append(('Comment', comment))

for diff in task_definition.diff:
if diff.field == 'image' and diff.value.endswith(':' + tag):
if tag and diff.field == 'image' and diff.value.endswith(':' + tag):
continue
if diff.field == 'environment':
messages.append(('Environment', '_sensitive (therefore hidden)_'))
Expand Down
33 changes: 33 additions & 0 deletions tests/test_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,39 @@ def test_notify_start(post_mock, url, service_match, task_definition):
post_mock.assert_called_with(url, json=payload)


@patch('requests.post')
def test_notify_start_without_tag(post_mock, url, service_match, task_definition):
post_mock.return_value = NotifyResponseSuccessfulMock()

task_definition.set_images(webserver=u'new-image:my-tag', application=u'app-image:another-tag')
task_definition.set_environment((('webserver', 'foo', 'baz'),))

slack = SlackNotification(url, service_match)
slack.notify_start('my-cluster', None, task_definition, 'my-comment', 'my-user', 'my-service', 'my-rule')

payload = {
'username': 'ECS Deploy',
'attachments': [
{
'pretext': 'Deployment has started',
'color': None,
'fields': [
{'title': 'Cluster', 'value': 'my-cluster', 'short': True},
{'title': 'Service', 'value': 'my-service', 'short': True},
{'title': 'Scheduled Task', 'value': 'my-rule', 'short': True},
{'title': 'User', 'value': 'my-user', 'short': True},
{'title': 'Comment', 'value': 'my-comment', 'short': True},
{'title': 'image', 'value': 'new-image:my-tag', 'short': True},
{'title': 'image', 'value': 'app-image:another-tag', 'short': True},
{'title': 'Environment', 'value': '_sensitive (therefore hidden)_', 'short': True}
]
}
]
}

post_mock.assert_called_with(url, json=payload)


@patch('requests.post')
@freeze_time()
def test_notify_success(post_mock, url, service_match, task_definition):
Expand Down

0 comments on commit a21dc07

Please sign in to comment.