Adding in cancel notifications
This commit is contained in:
parent
b7aac159ae
commit
4103a0b75f
9 changed files with 153 additions and 29 deletions
|
@ -358,3 +358,38 @@ class BuildFailureEvent(BaseBuildEvent):
|
|||
def get_summary(self, event_data, notification_data):
|
||||
return 'Build failure ' + _build_summary(event_data)
|
||||
|
||||
|
||||
class BuildCancelledEvent(BaseBuildEvent):
|
||||
@classmethod
|
||||
def event_name(cls):
|
||||
return 'build_cancelled'
|
||||
|
||||
def get_level(self, event_data, notification_data):
|
||||
return 'info'
|
||||
|
||||
def get_sample_data(self, notification):
|
||||
build_uuid = 'fake-build-id'
|
||||
|
||||
# TODO(jzelinskie): remove when more endpoints have been converted to using
|
||||
# interfaces
|
||||
repo = AttrDict({
|
||||
'namespace_name': notification.repository.namespace_user.username,
|
||||
'name': notification.repository.name,
|
||||
})
|
||||
return build_event_data(repo, {
|
||||
'build_id': build_uuid,
|
||||
'build_name': 'some-fake-build',
|
||||
'docker_tags': ['latest', 'foo', 'bar'],
|
||||
'trigger_id': '1245634',
|
||||
'trigger_kind': 'GitHub',
|
||||
'trigger_metadata': {
|
||||
"default_branch": "master",
|
||||
"ref": "refs/heads/somebranch",
|
||||
"commit": "42d4a62c53350993ea41069e9f2cfdefb0df097d"
|
||||
},
|
||||
'image_id': '1245657346'
|
||||
}, subpage='/build/%s' % build_uuid)
|
||||
|
||||
def get_summary(self, event_data, notification_data):
|
||||
return 'Build cancelled ' + _build_summary(event_data)
|
||||
|
||||
|
|
Reference in a new issue