status-im / infra-office-legacy

Infrastructure for cloud office services
0 stars 0 forks source link

Gitea Mirrors job failing due to timeouts #6

Closed jakubgs closed 2 years ago

jakubgs commented 2 years ago

Looks like our Gitea mirroring job is failing:

systemd[1]: Starting Gitea/GitHub Repo Mirroring...
gitea_mirror.py[4183038]: INFO - Gitea URL: http://127.0.0.1:3000/api/v1/
gitea_mirror.py[4183038]: INFO - Gitea Version: 1.15.5
gitea_mirror.py[4183038]: INFO - Org: dap-ps
gitea_mirror.py[4183038]: INFO - Created: 0, Updated: 4
gitea_mirror.py[4183038]: INFO - Org: embarklabs
gitea_mirror.py[4183038]: INFO - Created: 0, Updated: 55
gitea_mirror.py[4183038]: INFO - Org: status-im
systemd[1]: gitea-mirrors.service: start operation timed out. Terminating.
systemd[1]: gitea-mirrors.service: Main process exited, code=killed, status=15/TERM
systemd[1]: gitea-mirrors.service: Failed with result 'timeout'.
systemd[1]: Failed to start Gitea/GitHub Repo Mirroring.
jakubgs commented 2 years ago

Bumping the timeout worked, but then I found out that it times out on the Gitea side due to size of nixpkgs repo:

Traceback (most recent call last):
  File "/usr/local/bin/gitea_mirror.py", line 75, in create_update_repo
    self.get_repo(repo)
  File "/usr/local/bin/gitea_mirror.py", line 107, in get_repo
    return self._request('GET', 'repos/%s/%s' % (repo.owner.login, repo.name))
  File "/usr/local/bin/gitea_mirror.py", line 36, in _request
    result.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://127.0.0.1:3000/api/v1/repos/status-im/nixpkgs
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/gitea_mirror.py", line 190, in <module>
    main()
  File "/usr/local/bin/gitea_mirror.py", line 175, in main
    resp = ga.create_update_repo(repo)
  File "/usr/local/bin/gitea_mirror.py", line 78, in create_update_repo
    return self.create_repo(repo)
  File "/usr/local/bin/gitea_mirror.py", line 110, in create_repo
    return self._request('POST', 'repos/migrate', self._parse_gh_repo(repo))
  File "/usr/local/bin/gitea_mirror.py", line 36, in _request
    result.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:3000/api/v1/repos/migrate

Since the default migration timeout is 600 seconds: https://docs.gitea.io/en-us/config-cheat-sheet/#git---timeout-settings-gittimeout

jakubgs commented 2 years ago

Changes:

It works now:

systemd[1]: Starting Gitea/GitHub Repo Mirroring...
gitea_mirror.py[70640]: INFO - Gitea URL: http://127.0.0.1:3000/api/v1/
gitea_mirror.py[70640]: INFO - Gitea Version: 1.15.5
gitea_mirror.py[70640]: INFO - Org: dap-ps
gitea_mirror.py[70640]: INFO - Created: 0, Updated: 4
gitea_mirror.py[70640]: INFO - Org: embarklabs
gitea_mirror.py[70640]: INFO - Created: 0, Updated: 55
gitea_mirror.py[70640]: INFO - Org: status-im
gitea_mirror.py[70640]: WARNING - [status-im/qt5]: SKIPPING
gitea_mirror.py[70640]: WARNING - [status-im/nixpkgs]: SKIPPING
gitea_mirror.py[70640]: INFO - Created: 0, Updated: 539
systemd[1]: gitea-mirrors.service: Succeeded.
systemd[1]: Finished Gitea/GitHub Repo Mirroring.