communitybridge / easycla

The Contributor License Agreement (CLA) service of the Linux Foundation lets project contributors read, sign, and submit contributor license agreements easily.
https://easycla.lfx.linuxfoundation.org
MIT License
62 stars 45 forks source link

GitHub Application Status Update Failure #201

Closed dealako closed 4 years ago

dealako commented 4 years ago

Summary

During the EasyCLA application check status which is called upon a PR open, reopen, update callback, the EasyCLA backend encounters an error which it doesn't recover from. This error stops the processing of the EasyCLA status check.

Background

Upcon reviewing the backend python logs, the following error was observed:

[DEBUG] 2019-09-14T00:54:24.108Z c5f7676c-a1b1-4708-8c67-62b28d9d1243 updating github pull request for repo: 27729926, pr: PullRequest(title="Adding s390x support to grpc-java", number=6152) with signed authors: [] with missing authors: [('61e32c618940853d552ff62d041fc8fc5f755fe7', GitCommit(sha=None))]
00:54:24
2019-09-14 00:54:24,429 INFO cla: Getting comment body for repository type: github
00:54:24
[INFO] 2019-09-14T00:54:24.429Z c5f7676c-a1b1-4708-8c67-62b28d9d1243 Getting comment body for repository type: github
00:54:24
2019-09-14 00:54:24,429 INFO cla: 192.30.252.97 - - [2019-09-14 00:54:24.429423] POST /v2/github/activity 200 OK - GitHub-Hookshot/5a04bc9
00:54:24
[INFO] 2019-09-14T00:54:24.429Z c5f7676c-a1b1-4708-8c67-62b28d9d1243 192.30.252.97 - - [2019-09-14 00:54:24.429423] POST /v2/github/activity 200 OK - GitHub-Hookshot/5a04bc9
00:54:24
unhashable type: 'GitCommit': TypeError Traceback (most recent call last): File "/var/task/wsgi_handler.py", line 108, in handler return serverless_wsgi.handle_request(wsgi_app, event, context) File "/var/task/serverless_wsgi.py", line 173, in handle_request response = Response.from_app(app, environ) File "/var/task/werkzeug/wrappers/base_response.py", line 287, in from_app retur
unhashable type: 'GitCommit': TypeError
Traceback (most recent call last):
File "/var/task/wsgi_handler.py", line 108, in handler
return serverless_wsgi.handle_request(wsgi_app, event, context)
File "/var/task/serverless_wsgi.py", line 173, in handle_request
response = Response.from_app(app, environ)
File "/var/task/werkzeug/wrappers/base_response.py", line 287, in from_app
return cls(*_run_wsgi_app(app, environ, buffered))
File "/var/task/werkzeug/test.py", line 1119, in run_wsgi_app
app_rv = app(environ, start_response)
File "/var/task/hug/api.py", line 497, in api_auto_instantiate
return module.__hug_wsgi__(*args, **kwargs)
File "falcon/api.py", line 274, in falcon.api.API.__call__
raise
File "falcon/api.py", line 269, in falcon.api.API.__call__
responder(req, resp, **params)
File "/var/task/hug/api.py", line 356, in version_router
request, response, api_version=api_version, **kwargs
File "/var/task/hug/interface.py", line 930, in __call__
raise exception
File "/var/task/hug/interface.py", line 901, in __call__
self.call_function(input_parameters), context, request, response, **kwargs
File "/var/task/hug/interface.py", line 823, in call_function
return self.interface(**parameters)
File "/var/task/hug/interface.py", line 123, in __call__
return __hug_internal_self._function(*args, **kwargs)
File "/var/task/cla/routes.py", line 1485, in github_app_activity
return cla.controllers.github.activity(body)
File "/var/task/cla/controllers/github.py", line 192, in activity
result = service.received_activity(body)
File "/var/task/cla/models/github_models.py", line 71, in received_activity
return self.process_reopened_pull_request(data)
File "/var/task/cla/models/github_models.py", line 508, in process_reopened_pull_request
return self.process_opened_pull_request(data)
File "/var/task/cla/models/github_models.py", line 260, in process_opened_pull_request
self.update_change_request(installation_id, github_repository_id, pull_request_id)
File "/var/task/cla/models/github_models.py", line 361, in update_change_request
missing=missing)
File "/var/task/cla/models/github_models.py", line 708, in update_pull_request
signed, missing)
File "/var/task/cla/utils.py", line 689, in assemble_cla_comment
comment = get_comment_body(repository_type, sign_url, signed, missing)
File "/var/task/cla/utils.py", line 738, in get_comment_body
if author not in committers:
TypeError: unhashable type: 'GitCommit'

Expected behavior

The EasyCLA backend would place the PR commit authors into a pass or fail bucket and update the GitHub status.

Screenshots

GitHub application failure on the backend causes the EasyCLA application on the GitHub page to disappear:

Screen Shot 2019-09-14 at 12 13 48 PM

Environment

Please complete the following information:

Acceptance Criteria

The "done" criteria when this feature or problem is resolved.

  1. Add defensive checks for the exception
  2. Test case developed, implemented, confirmed
  3. Verified fix in STAGING environment

*References

PR: https://github.com/grpc/grpc-java/pull/6152

Log Entry: https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logEventViewer:group=/aws/lambda/cla-backend-prod-githubactivity;stream=2019/09/13/%5B$LATEST%5D17382ce85fd547a7bf0321ed7eebb1cb;refid=34976989735724049610440285724874976476274677318113427505;reftime=1568422464108

jpalmerLinuxFoundation commented 4 years ago

@dealako, @manikantanr how are we able to validate that this has resolved the issue? I don't have my head totally wrapped around what the root cause is.

jpalmerLinuxFoundation commented 4 years ago

We potentially have another PR with this issue on ASWF: OpenCue: https://github.com/AcademySoftwareFoundation/OpenCue/pull/456