Delete archived letter attachments from s3#4894
Open
CrystalPea wants to merge 10 commits into
Open
Conversation
Function based on a similar task for template email files
1e2c76e to
5599157
Compare
for scoped files. Also move archiving a letter attachment into a dao method - that's a more appropriate place for it.
The scoping datetimes archived_before and archived_after were defined as timezone-aware datetimes, which didn't play well with the naive datetimes from the db (for archived_at) field. After a Slack discussion, I decided to try the approach from sqlalchemy docs to try and fix it: https://docs.sqlalchemy.org/en/20/core/custom_types.html#store-timezone-aware-timestamps-as-timezone-naive-utc The scoping now works as expected.
5599157 to
d809694
Compare
string for archived_after
d7abe81 to
5f4d19a
Compare
between two tasks instead of duplicating it.
5f4d19a to
f13be34
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I used
remove_archived_template_email_files_from_s3()task as a base for this new task.I had to adjust it, as letter attachments are a bit different. I did some refactoring on the way, and de-duplicated the code shared between the tasks.
I have pushed these changes to dev-b, and functional tests pass: https://concourse.notify.tools/teams/dev-b/pipelines/deploy-notify/jobs/functional-tests/builds/520
I also did manual testing.
I needed to make letter attachments S3 bucket available to api apps: https://github.com/alphagov/notifications-aws/pull/3045 (this needs to be merged / possibly terraform to be run first)
After that, the task worked as expected:
