upload-release: Update SHA256SUM for existing files if changed.

In the very infrequent case that we re-upload a file, the logic for
upload-release would have the existing SHA256SUM take precedence over
the new one -- despite uploading the new file.

Skip existing filenames (i.e. from the new file) when gathering
SHA256SUM metadata used to assemble `SHA256SUMS.txt`.
This commit is contained in:
Alex Vandiver 2023-01-24 01:09:18 +00:00 committed by Josh Klar
parent f4e9bf269c
commit 1eb31f4f54
1 changed files with 3 additions and 0 deletions

View File

@ -51,6 +51,9 @@ for obj_summary in bucket.objects.filter(Prefix="server/zulip-server-"):
head = client.head_object(Bucket=bucket.name, Key=obj_summary.key) head = client.head_object(Bucket=bucket.name, Key=obj_summary.key)
assert obj_summary.key.startswith("server/") assert obj_summary.key.startswith("server/")
filename = obj_summary.key[len("server/") :] filename = obj_summary.key[len("server/") :]
if filename in file_hashes:
print(f" {filename} was already uploaded, skipping existing hash")
continue
metadata = head["Metadata"] metadata = head["Metadata"]
if "sha256sum" not in metadata: if "sha256sum" not in metadata:
print(f" {filename} does not have SHA256 metadata!") print(f" {filename} does not have SHA256 metadata!")