diff options
author | Tobias Henkel <tobias.henkel@bmw.de> | 2020-10-05 14:35:44 +0200 |
---|---|---|
committer | Tobias Henkel <tobias.henkel@bmw.de> | 2020-10-05 14:46:52 +0200 |
commit | 42f58abf025b596931a439ce50c07382987a66d9 (patch) | |
tree | c200809d121b03c2374f9954fc9fad4be14721bd /zuul/driver/github | |
parent | 92a552ec67afee6adb0fcbb05cf9d8ada7395ebb (diff) | |
download | zuul-42f58abf025b596931a439ce50c07382987a66d9.tar.gz |
Restore correct reason reporting of merge failures
The optimization of merges in GitHub [1] has a side effect that the
merge failure reason always is 'Method not allowed'. This has been
unnoticed because the test framework did not distinguish between
status message and response body. GitHub reports such failures with
405 Method not allowed and a detailed reason in the response body.
[1] I48dbb5fc1b7e7dec4cb09c779b9661d82935d9df
Change-Id: Ic2e47ee14c7f97defba0905db68ef8706108c081
Diffstat (limited to 'zuul/driver/github')
-rw-r--r-- | zuul/driver/github/githubconnection.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py index f0452f8fe..50433ef51 100644 --- a/zuul/driver/github/githubconnection.py +++ b/zuul/driver/github/githubconnection.py @@ -1892,6 +1892,14 @@ class GithubConnection(BaseConnection): else: result = data["merged"] except Exception as e: + if hasattr(e, 'response'): + response = e.response + try: + raise MergeFailure('Pull request merge failed: ' + '%s' % response.json().get('message')) + except ValueError: + # There was no json body so use the generic message below. + pass raise MergeFailure('Pull request merge failed: %s' % e) if not result: |