Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/ctl/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,28 @@ def push_data_s3(self, storage, platform_id):

for entry in entries:
i_total += 1
key = f"data/{storage}/{path}/{entry}"

try:
s3c.copy_object(
Bucket="rpmrepo-storage",
Key=key,
CopySource={"Bucket": "rpmrepo-storage", "Key": key},
MetadataDirective="COPY",
)
print(f"[{i_total}/{n_total}] '{key}' (exists, touched)")
Comment on lines +53 to +59
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that copying an object onto itself is a common way to touch files in S3, but a comment here would be helpful for the future.

In the images CI cache, I also did a metadata key touched=<timestamp> because I think I read somewhere that without any metadata change, the actual modification time of the object wont change. Not sure if I'm remembering that correctly.

continue
except s3c.exceptions.ClientError as e:
if e.response["Error"]["Code"] not in ("404", "NoSuchKey"):
raise

print(f"[{i_total}/{n_total}] 'data/{storage}/{path}/{entry}'")
print(f"[{i_total}/{n_total}] '{key}'")

with open(os.path.join(level, entry), "rb") as filp:
s3c.upload_fileobj(
filp,
"rpmrepo-storage",
f"data/{storage}/{path}/{entry}",
key,
)

def push_snapshot_s3(self, snapshot_id, snapshot_suffix):
Expand Down
Loading