Repository: fabfuel/ecs-deploy

Issue:
Slack notifications don't work when deploying new image
Hi! Thanks for the tool.

I was playing around with the Slack notifications and they work fine when using the -t flag but not when passing images with the -i one.

Looks like tag variable is null over here:
 https://github.com/fabfuel/ecs-deploy/blob/1116ba7d9f7dd256b9668bbcf9cad973da4fde5d/ecs_deploy/cli.py#L87
 
Here's the full stack trace:
```
Traceback (most recent call last):
  File "/usr/local/bin/ecs", line 8, in <module>
    sys.exit(ecs())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/ecs_deploy/cli.py", line 87, in deploy
    slack.notify_start(cluster, tag, td, comment, user, service=service)
  File "/usr/local/lib/python3.7/site-packages/ecs_deploy/slack.py", line 63, in notify_start
    if diff.field == 'image' and diff.value.endswith(':' + tag):
TypeError: can only concatenate str (not "NoneType") to str
```

Discussion:

Patch:
diff --git a/ecs_deploy/slack.py b/ecs_deploy/slack.py
index 2e5761c..fa252cc 100644
--- a/ecs_deploy/slack.py
+++ b/ecs_deploy/slack.py
@@ -60,7 +60,7 @@ class SlackNotification(object):
             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)_'))


Test patch:
diff --git a/tests/test_slack.py b/tests/test_slack.py
index d9b0489..0134882 100644
--- a/tests/test_slack.py
+++ b/tests/test_slack.py
@@ -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):