Skip to content

Commit bdb948e

Browse files
committed
Return 200 if the hinted repository is not found
This is contrary to what we should be logically doing but Gitlab considers hooks returning non-2xx as failed. It should be fine to say "we don't know about this repository" via HTTP status codes, but c'est la vie, I guess. This plus [0] are a recipe for disaster. Anyway, even if [0] was not the case disabling the hook for 10 minutes is still unacceptable for Jens. The workaround is to return 2xx, even in this case. [0] https://gitlab.com/gitlab-org/gitlab/-/issues/387938
1 parent 62efa98 commit bdb948e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

jens/webapps/gitlabproducer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def hello_gitlab():
6262
return 'Queue not accessible', 500
6363
except NameError as error:
6464
logging.error("'%s' couldn't be found in repositories" % (url))
65-
return 'Repository not found', 404
65+
return 'Repository not found', 200
6666
except Exception as error:
6767
logging.error("Unexpected error (%s)" % repr(error))
6868
return 'Internal Server Error!', 500

jens/webapps/test/test_gitlabproducer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_repository_not_found(self):
8383
'git_ssh_url': "file://foo"
8484
}
8585
}))
86-
self.assertEqual(reply.status_code, 404)
86+
self.assertEqual(reply.status_code, 200)
8787

8888
@patch('jens.webapps.gitlabproducer.enqueue_hint')
8989
def test_secret_token_ignored_if_not_configured(self, mock_eq):

0 commit comments

Comments
 (0)