mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
server: report errors pushing to git mirrors
This makes `fdroid server update` fail if pushing to one of the git mirrors fails. This is what happens if the other methods fail, e.g. rsync or S3. closes #347
This commit is contained in:
parent
93caf27319
commit
1f7f9d403c
2 changed files with 10 additions and 9 deletions
|
|
@ -567,7 +567,6 @@ def get_mirror_service_urls(url):
|
||||||
return urls
|
return urls
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def download_repo_index(url_str, etag=None, verify_fingerprint=True):
|
def download_repo_index(url_str, etag=None, verify_fingerprint=True):
|
||||||
"""
|
"""
|
||||||
Downloads the repository index from the given :param url_str
|
Downloads the repository index from the given :param url_str
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,6 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
||||||
|
|
||||||
# push for every remote. This will overwrite the git history
|
# push for every remote. This will overwrite the git history
|
||||||
for remote in repo.remotes:
|
for remote in repo.remotes:
|
||||||
branch = 'master'
|
|
||||||
if remote.name == 'gitlab':
|
if remote.name == 'gitlab':
|
||||||
logging.debug('Writing .gitlab-ci.yml to deploy to GitLab Pages')
|
logging.debug('Writing .gitlab-ci.yml to deploy to GitLab Pages')
|
||||||
with open(os.path.join(git_mirror_path, ".gitlab-ci.yml"), "wt") as out_file:
|
with open(os.path.join(git_mirror_path, ".gitlab-ci.yml"), "wt") as out_file:
|
||||||
|
|
@ -405,13 +404,16 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
||||||
|
|
||||||
logging.debug('Pushing to ' + remote.url)
|
logging.debug('Pushing to ' + remote.url)
|
||||||
with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd):
|
with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd):
|
||||||
remote.push(branch, force=True, set_upstream=True, progress=progress)
|
pushinfos = remote.push('master', force=True, set_upstream=True, progress=progress)
|
||||||
|
for pushinfo in pushinfos:
|
||||||
# Reset the gitlab specific stuff before the next remote.
|
if pushinfo.flags & (git.remote.PushInfo.ERROR
|
||||||
if remote.name == 'gitlab':
|
| git.remote.PushInfo.REJECTED
|
||||||
logging.debug('Removing .gitlab-ci.yml now that it has successfully deployed')
|
| git.remote.PushInfo.REMOTE_FAILURE
|
||||||
repo.index.reset('HEAD^')
|
| git.remote.PushInfo.REMOTE_REJECTED):
|
||||||
repo.index.checkout(force=True)
|
raise FDroidException(remote.url + ' push failed: ' + str(pushinfo.flags)
|
||||||
|
+ ' ' + pushinfo.summary)
|
||||||
|
else:
|
||||||
|
logging.debug(remote.url + ': ' + pushinfo.summary)
|
||||||
|
|
||||||
if progress:
|
if progress:
|
||||||
bar.done()
|
bar.done()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue