Skip to content

Commit

Permalink
[ci] better errors on bad github response
Browse files Browse the repository at this point in the history
Not sure what was wrong, but CI was getting 422s from GitHub. Using a
`raise_for_status=True` ClientSession circumvented gidgethubs native
error handling logic smothering the HTTP response body where github
places critical debugging information. Aiohttp is aware that
`raise_for_status` provides no access to the response body. They addressed
this in https://github.com/aio-libs/aiohttp/pulls/3892, but that has not
been released because 4.0.0 has not yet been released.

Another relevant issue: aio-libs/aiohttp#4600.
  • Loading branch information
Daniel King committed Apr 6, 2020
1 parent ed01121 commit 17c6eef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ci/ci/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,11 @@ async def on_startup(app):
raise_for_status=True,
timeout=aiohttp.ClientTimeout(total=60))
app['client_session'] = session
app['github_client'] = gh_aiohttp.GitHubAPI(session, 'ci', oauth_token=oauth_token)
app['github_client'] = gh_aiohttp.GitHubAPI(
aiohttp.ClientSession(
timeout=aiohttp.ClientTimeout(total=60)),
'ci',
oauth_token=oauth_token)
app['batch_client'] = await BatchClient('ci', session=session)

with open('/ci-user-secret/sql-config.json', 'r') as f:
Expand Down
2 changes: 1 addition & 1 deletion ci/ci/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ async def post_github_status(self, gh_client, gh_status):
except gidgethub.HTTPException as e:
log.info(f'{self.short_str()}: notify github of build state failed due to exception: {e}')
except aiohttp.client_exceptions.ClientResponseError as e:
log.error(f'{self.short_str()}: Unexpected exception in post to github: {e}')
log.exception(f'{self.short_str()}: Unexpected exception in post to github: {data} {e}')

async def _update_github(self, gh):
await self._update_last_known_github_status(gh)
Expand Down

0 comments on commit 17c6eef

Please sign in to comment.