Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] better errors on bad github response and fix too many status updates #8480

Merged
merged 4 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 3 additions & 3 deletions ci/ci/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ async def post_github_status(self, gh_client, gh_status):
f'/repos/{self.target_branch.branch.repo.short_str()}/statuses/{self.source_sha}',
data=data)
except gidgethub.HTTPException as e:
log.info(f'{self.short_str()}: notify github of build state failed due to exception: {e}')
log.info(f'{self.short_str()}: notify github of build state failed due to exception: {data} {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 All @@ -323,7 +323,7 @@ def _hail_github_status_from_statuses(statuses_json):
if n_hail_status == 0:
return None
if n_hail_status == 1:
return hail_status[0]
return hail_status[0]['state']
raise ValueError(
f'github sent multiple status summaries for our one '
'context {GITHUB_STATUS_CONTEXT}: {hail_status}\n\n{statuses_json}')
Expand Down