Make gitea description update failures nonfatal
There appears to be a gitea bug that causes PATCH updates to projects to fail when the cache is in a bad state for that project. We use PATCH updates to a project to set the project descriptions. Since project descriptions are not critical to gitea functionality (we weren't updating them until last week) we can treat this as best effort and ignore these failures. We'll log these cases to aid in further debugging but continue on. The next pass can retry. Change-Id: I625bdc0856caaccb6b55931b0cdc6cf11a0bf3e1
This commit is contained in:
parent
e764a59877
commit
512349a28d
@ -210,12 +210,19 @@ class Gitea(object):
|
|||||||
description_update = {
|
description_update = {
|
||||||
'description': description,
|
'description': description,
|
||||||
}
|
}
|
||||||
resp = self.patch(
|
try:
|
||||||
'/api/v1/repos/{org}/{repo}'.format(org=org, repo=repo),
|
resp = self.patch(
|
||||||
json=description_update)
|
'/api/v1/repos/{org}/{repo}'.format(org=org, repo=repo),
|
||||||
# Commented out as there is no good way to log only those projects
|
json=description_update)
|
||||||
# which have an updated description and as a result this is noisy.
|
# Commented out as there is no good way to log only those
|
||||||
#self.log("Set description for:", project['project'])
|
# projects which have an updated description and as a result
|
||||||
|
# this is noisy.
|
||||||
|
#self.log("Set description for:", project['project'])
|
||||||
|
except Exception as e:
|
||||||
|
# Updating descriptions is best effort as we may fail due to
|
||||||
|
# gitea bugs, but such a failure isn't critical.
|
||||||
|
self.log("Failed to set desciption for:",
|
||||||
|
project['project'], str(e))
|
||||||
|
|
||||||
def make_projects(self, projects, gitea_repos, csrf_token,
|
def make_projects(self, projects, gitea_repos, csrf_token,
|
||||||
settings_thread_pool, branches_thread_pool, futures):
|
settings_thread_pool, branches_thread_pool, futures):
|
||||||
|
Loading…
Reference in New Issue
Block a user