Merge pull request #1965 from coreos-inc/condense-slack-notifications
Less verbose notifications for QSS
This commit is contained in:
commit
7fc33a9a57
4 changed files with 8 additions and 8 deletions
|
@ -46,7 +46,8 @@ def filter_tags_have_repository_event(query, event):
|
|||
.switch(RepositoryTag)
|
||||
.join(Repository)
|
||||
.join(RepositoryNotification)
|
||||
.where(RepositoryNotification.event == event))
|
||||
.where(RepositoryNotification.event == event)
|
||||
.order_by(RepositoryTag.lifetime_start_ts.desc()))
|
||||
|
||||
def list_repository_tags(namespace_name, repository_name, include_hidden=False,
|
||||
include_storage=False):
|
||||
|
|
|
@ -135,7 +135,7 @@ class VulnerabilityFoundEvent(NotificationEvent):
|
|||
'name': notification.repository.name,
|
||||
})
|
||||
return build_event_data(repo, {
|
||||
'tags': ['latest', 'prod'],
|
||||
'tags': ['latest', 'prod', 'foo', 'bar', 'baz'],
|
||||
'image': 'some-image-id',
|
||||
'vulnerability': {
|
||||
'id': 'CVE-FAKE-CVE',
|
||||
|
@ -157,10 +157,9 @@ class VulnerabilityFoundEvent(NotificationEvent):
|
|||
return actual_level_index <= filter_level_index
|
||||
|
||||
def get_summary(self, event_data, notification_data):
|
||||
msg = '%s vulnerability detected in repository %s in tags %s'
|
||||
return msg % (event_data['vulnerability']['priority'],
|
||||
event_data['repository'],
|
||||
', '.join(event_data['tags']))
|
||||
msg = '%s vulnerability detected in repository %s in %s tags'
|
||||
return msg % (event_data['vulnerability']['priority'], event_data['repository'],
|
||||
len(event_data['tags']))
|
||||
|
||||
|
||||
class BaseBuildEvent(NotificationEvent):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
A <a href="{{ event_data.vulnerability.link }}">{{ event_data.vulnerability.priority }} vulnerability</a> ({{ event_data.vulnerability.id }}) was detected in tags
|
||||
{{ 'tags' | icon_image }}
|
||||
{% for tag in event_data.tags %}{%if loop.index > 1 %}, {% endif %}{{ (event_data.repository, tag) | repository_tag_reference }}{% endfor %} in
|
||||
{% for tag in event_data.tags[0:3] %}{%if loop.index > 1 %}, {% endif %}{{ (event_data.repository, tag) | repository_tag_reference }}{% endfor %} {% if event_data.tags|length > 3 %}(and {{ event_data.tags|length - 3 }} more) {% endif %} in
|
||||
repository {{ event_data.repository | repository_reference }}
|
||||
|
|
|
@ -296,7 +296,7 @@ class TestSecurityScanner(unittest.TestCase):
|
|||
self.assertIsNotNone(queue_item)
|
||||
|
||||
body = json.loads(queue_item.body)
|
||||
self.assertEquals(['latest', 'prod'], body['event_data']['tags'])
|
||||
self.assertEquals(set(['latest', 'prod']), set(body['event_data']['tags']))
|
||||
self.assertEquals('CVE-2014-9471', body['event_data']['vulnerability']['id'])
|
||||
self.assertEquals('Low', body['event_data']['vulnerability']['priority'])
|
||||
self.assertTrue(body['event_data']['vulnerability']['has_fix'])
|
||||
|
|
Reference in a new issue