Fix NoneType error in GH trigger when it has no pushed_at field
This appears to occur in new repositories that have not yet been pushed. Fixes https://sentry.io/coreos/backend-production/issues/234686591/
This commit is contained in:
parent
4bee4dbfff
commit
4cb8412fd8
2 changed files with 7 additions and 2 deletions
|
@ -310,7 +310,7 @@ class GithubBuildTrigger(BuildTriggerHandler):
|
|||
'name': repo.name,
|
||||
'full_name': repo.full_name,
|
||||
'description': repo.description or '',
|
||||
'last_updated': timegm(repo.pushed_at.utctimetuple()),
|
||||
'last_updated': timegm(repo.pushed_at.utctimetuple()) if repo.pushed_at else 0,
|
||||
'url': repo.html_url,
|
||||
'has_admin_permissions': repo.permissions.admin,
|
||||
'private': repo.private,
|
||||
|
|
|
@ -53,7 +53,12 @@ def get_mock_github():
|
|||
repo_mock.full_name = '%s/%s' % (namespace, name)
|
||||
repo_mock.name = name
|
||||
repo_mock.description = 'some %s repo' % (name)
|
||||
repo_mock.pushed_at = datetime.utcfromtimestamp(0)
|
||||
|
||||
if name != 'anotherrepo':
|
||||
repo_mock.pushed_at = datetime.utcfromtimestamp(0)
|
||||
else:
|
||||
repo_mock.pushed_at = None
|
||||
|
||||
repo_mock.html_url = 'https://bitbucket.org/%s/%s' % (namespace, name)
|
||||
repo_mock.private = name == 'somerepo'
|
||||
repo_mock.permissions = Mock()
|
||||
|
|
Reference in a new issue