diff options
author | Philipp Hörist <philipp@hoerist.com> | 2023-01-07 16:13:27 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2023-01-07 16:13:35 +0300 |
commit | 7402594f83785041f213f64a1fe00c396fdaefa7 (patch) | |
tree | 039d0310215a31ce64bec6f8629fbd6c07ef080d /.ci | |
parent | 2a43353ca247f1250edffc01dd124d6c4c8c3ea1 (diff) |
ci: Handle race conditions better when creating ftp folder
Retrieving a list of folders to check if a folder is created leads
to a race condition, if multiple jobs try to deploy at the
same time.
Diffstat (limited to '.ci')
-rwxr-xr-x | .ci/deploy.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/.ci/deploy.py b/.ci/deploy.py index 2633b47b1..5c4f3e96c 100755 --- a/.ci/deploy.py +++ b/.ci/deploy.py @@ -10,6 +10,7 @@ import logging import os import sys from datetime import date +from ftplib import error_perm from ftplib import FTP_TLS from pathlib import Path @@ -70,9 +71,10 @@ def get_dir_list(ftp: FTP_TLS) -> list[str]: def create_release_folder(ftp: FTP_TLS, tag: str) -> None: ftp.cwd(RELEASE_FOLDER_BASE) folder = get_release_folder_from_tag(tag) - dir_list = get_dir_list(ftp) - if folder not in dir_list: + try: ftp.mkd(folder) + except error_perm: + pass ftp.cwd(folder) |