Log github delivery ids properly

Previously we were doing a get for 'X-GitHub-Delivery' on a python dict
which didn't have this key. The key in the dict is 'x-github-delivery'.
Because of this we were logging None as the delivery id. Fix this by
updating the key used which will give us logging data that is helpful
for debugging.

Side note. The header as sent by github to the zuul web server appears
to be 'X-GitHub-Delivery' with that case. But somewhere along the line
things get normalized to lower case. This is true for the other headers
we lookat in the events as well.

Change-Id: I8acbc910e7e50aa53c1ade0fa2ce6f2afed053d7
This commit is contained in:
Clark Boylan 2018-06-13 13:54:27 -07:00
parent f67bdd0f35
commit cdcc8f304d
2 changed files with 4 additions and 2 deletions

View File

@ -1085,7 +1085,9 @@ class FakeGithubConnection(githubconnection.GithubConnection):
payload = json.dumps(data).encode('utf8')
secret = self.connection_config['webhook_token']
signature = githubconnection._sign_request(payload, secret)
headers = {'x-github-event': name, 'x-hub-signature': signature}
headers = {'x-github-event': name,
'x-hub-signature': signature,
'x-github-delivery': str(uuid.uuid4())}
if use_zuulweb:
return requests.post(

View File

@ -110,7 +110,7 @@ class GithubGearmanWorker(object):
headers = args.get("headers")
body = args.get("body")
delivery = headers.get('X-GitHub-Delivery')
delivery = headers.get('x-github-delivery')
self.log.debug("Github Webhook Received: {delivery}".format(
delivery=delivery))