index: do not include GitLab Pages mirror if it can't be deployed

GitLab Pages sites are limited to 1GB on gitlab.com, so the CI/CD job will
fail if the repo is bigger than that.  It should not be included as a
mirror in that case.

https://docs.gitlab.com/ee/user/gitlab_com/#gitlab-pages
This commit is contained in:
Hans-Christoph Steiner 2021-08-23 12:45:03 +02:00 committed by Jochen Sprickerhof
parent eb2fdc5a58
commit 7987c746de
3 changed files with 48 additions and 17 deletions

View file

@ -358,7 +358,7 @@ class IndexTest(unittest.TestCase):
)
self.assertTrue(os.path.exists(os.path.join('repo', 'index.xml')))
def test_get_mirror_service_urls(self):
def test_github_get_mirror_service_urls(self):
for url in [
'git@github.com:foo/bar',
'git@github.com:foo/bar.git',
@ -370,19 +370,28 @@ class IndexTest(unittest.TestCase):
fdroidserver.index.get_mirror_service_urls(url),
)
def test_gitlab_get_mirror_service_urls(self):
for url in [
'git@gitlab.com:group/project',
'git@gitlab.com:group/project.git',
'https://gitlab.com/group/project',
'https://gitlab.com/group/project.git',
]:
self.assertEqual(
[
'https://group.gitlab.io/project/fdroid',
'https://gitlab.com/group/project/-/raw/master/fdroid',
],
fdroidserver.index.get_mirror_service_urls(url),
)
with patch('fdroidserver.common.get_dir_size', return_value=100000):
self.assertEqual(
[
'https://group.gitlab.io/project/fdroid',
'https://gitlab.com/group/project/-/raw/master/fdroid',
],
fdroidserver.index.get_mirror_service_urls(url),
)
with patch('fdroidserver.common.get_dir_size', return_value=1234567890):
self.assertEqual(
[
'https://gitlab.com/group/project/-/raw/master/fdroid',
],
fdroidserver.index.get_mirror_service_urls(url),
)
def test_make_website(self):
tmptestsdir = tempfile.mkdtemp(