Upload read-only archive.

By uploading read-only archive, we prevent potential (implicit) re-upload.

A re-upload will always be possible if we remove the archive and rerun
the workflow. But it will be clearly explicit in this case.
This commit is contained in:
Matthieu Gautier 2022-09-28 15:11:08 +02:00
parent f7706428a2
commit dc814c626d
1 changed files with 9 additions and 1 deletions

View File

@ -226,7 +226,7 @@ def upload(file_to_upload, host, dest_path):
command = [
"scp",
"-r",
"-rp",
"-P",
port,
"-i",
@ -241,6 +241,10 @@ def upload(file_to_upload, host, dest_path):
def upload_archive(archive, project, make_release):
if not archive.exists():
print_message("No archive {} to upload!", archive)
return
if project.startswith("kiwix-") or project in ['libkiwix']:
host = "ci@master.download.kiwix.org:30022"
dest_path = "/data/download/"
@ -253,6 +257,10 @@ def upload_archive(archive, project, make_release):
else:
dest_path = dest_path + "nightly/" + DATE
# Make the archive read only. This way, scp will preserve rights.
# If somehow we try to upload twice the same archive, scp will fails.
archive.chmod(0o444)
upload(archive, host, dest_path)