Skip to content

feat(beetmover): Support expiration tag for GCS artifacts#1037

Merged
hneiva merged 3 commits intomasterfrom
hneiva/beetmover-expiry-alternative
Jul 16, 2024
Merged

feat(beetmover): Support expiration tag for GCS artifacts#1037
hneiva merged 3 commits intomasterfrom
hneiva/beetmover-expiry-alternative

Conversation

@hneiva
Copy link
Copy Markdown
Contributor

@hneiva hneiva commented Jul 3, 2024

No description provided.

@hneiva hneiva requested a review from a team July 3, 2024 19:47
@hneiva hneiva force-pushed the hneiva/beetmover-expiry-alternative branch 5 times, most recently from 0b9ffe6 to 6c6dedb Compare July 8, 2024 23:11
@hneiva hneiva marked this pull request as ready for review July 8, 2024 23:11
Copy link
Copy Markdown
Contributor

@bhearsum bhearsum left a comment

Choose a reason for hiding this comment

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

Nice work here! I know it was a struggle to find a good solution to avoid having custom_time set for the files in releases.

This patch looks fine, but it needs a bit more in the way of tests. specifically, tests that with some asserts that:

  • custom_time is passed when an expiry is present
  • custom_time is not passed when an expiry is not present
  • Both of these cases mixed together in the same artifact map
  • custom_time is not set when moving artifacts

I'd also like to see a staging release run through push-to-releases so that we can inspect the state of uploads run with this in a real bucket.

I'm also wondering if we need or want to support this for other schemas? maven_beetmover_task_schema.json and import-from-gcs-to-artifact-registry stand out as places where we might want to. (Even if we do, this is probably best handled as a follow-up.)

# We need to set the data payload with some information so the metadata is NOT copied over.
# This prevents custom_time metadata from being copied unintentionally
# https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite#request-body
dest_blob._properties["name"] = destination
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Woohoo! I'm glad this ended up working out.

return resp


@pytest.mark.asyncio
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix-up (these are not tests, so they don't need this mark AIUI).

@hneiva
Copy link
Copy Markdown
Contributor Author

hneiva commented Jul 9, 2024

Yeah adding more tests is a great idea.

I've already tested this in a staging release: treeherder, Example task, gcloud bucket files

I don't think we have a use case for other schemas yet; but if we do, adding it would be quite easy. Agree we should do it on a follow-up.

@bhearsum
Copy link
Copy Markdown
Contributor

bhearsum commented Jul 9, 2024

I've already tested this in a staging release: treeherder, Example task, gcloud bucket files

Thanks! I will take a look there.

I don't think we have a use case for other schemas yet; but if we do, adding it would be quite easy. Agree we should do it on a follow-up.

I agree we don't need to do it now unless we have specific plans for cleanup of artifacts that are uploaded through those methods already.

@hneiva hneiva force-pushed the hneiva/beetmover-expiry-alternative branch from 4dfd66b to 0adf120 Compare July 9, 2024 19:06
@hneiva
Copy link
Copy Markdown
Contributor Author

hneiva commented Jul 9, 2024

build/ is part of .gitignore - had to force add to make sure the file was added ¯_(ツ)_/¯

@hneiva hneiva force-pushed the hneiva/beetmover-expiry-alternative branch from 0adf120 to db3b63b Compare July 9, 2024 19:09
@hneiva hneiva requested a review from bhearsum July 9, 2024 20:36
Copy link
Copy Markdown
Contributor

@bhearsum bhearsum left a comment

Choose a reason for hiding this comment

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

Thank you for the test improvements! I looked at your staging release as well, and it appears to have done all the right things with the artifacts on ftp.stage.mozaws.net.

@hneiva hneiva merged commit 98f2a3b into master Jul 16, 2024
@hneiva hneiva deleted the hneiva/beetmover-expiry-alternative branch July 16, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants