-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(unsigned) feat: delete overdue draft form responses and dont nag #444
Conversation
@daine Now that you have implemented a mechanism to delete responses before publishing forms I am not quite sure why we have to handle any deletion on the Nagware infra side. |
The use case here I believe is to handle people who never publish the form (as per Brian's design and response on this issue). It's the second scenario |
The propose solution appears satisfactory concerning the deletion of test responses for drafted forms. It avoids introducing any unnecessary attributes and instead utilizes the existing template property, which is more appropriate. |
|
||
if (!process.env.AWS_SAM_LOCAL) { | ||
const jsonConfig = JSON.parse(firstRecord[2].stringValue.trim(1, -1)) || undefined; | ||
formName = firstRecord[1].stringValue !== "" ? firstRecord[1].stringValue : `${jsonConfig.titleEn} - ${jsonConfig.titleFr}`; | ||
// TODO: Not sure what field the isPublished value is in, but based on the SQL query, it should be in the 4th index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@craigzour this is a guess for me right now, I could use your guidance since I'm unable to test it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
firstRecord[3]
sounds about right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I agree. You can delete the comment ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are almost good to go :)
|
||
if (!process.env.AWS_SAM_LOCAL) { | ||
const jsonConfig = JSON.parse(firstRecord[2].stringValue.trim(1, -1)) || undefined; | ||
formName = firstRecord[1].stringValue !== "" ? firstRecord[1].stringValue : `${jsonConfig.titleEn} - ${jsonConfig.titleFr}`; | ||
// TODO: Not sure what field the isPublished value is in, but based on the SQL query, it should be in the 4th index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I agree. You can delete the comment ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :) Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌮
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
Signed-off-by: Daine Trinidad <[email protected]>
be381d1
to
d1704c7
Compare
⚠ Terrform update availableTerraform: 1.5.3 (using 1.4.2)
Terragrunt: 0.48.4 (using 0.46.3) |
Staging: app✅ Terraform Init: Plan: 2 to add, 1 to change, 2 to destroy Show summary
Show planResource actions are indicated with the following symbols:
~ update in-place
-/+ destroy and then create replacement
Terraform will perform the following actions:
# aws_lambda_function.nagware will be updated in-place
~ resource "aws_lambda_function" "nagware" {
id = "Nagware"
~ last_modified = "2023-07-21T12:42:28.000+0000" -> (known after apply)
~ layers = [
- "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_lib_packages:8",
- "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_node_packages:15",
] -> (known after apply)
~ source_code_hash = "y34UuQHJpw45wPAaGnYetfK3Np4OClJnnkY9F5bpN7I=" -> "iEcgvvidpFH4l1y2zkp2weM9newMLuhW5SACT1opKjk="
tags = {
"CostCentre" = "forms-platform-staging"
"Terraform" = "true"
}
# (17 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# aws_lambda_layer_version.nagware_lib must be replaced
-/+ resource "aws_lambda_layer_version" "nagware_lib" {
~ arn = "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_lib_packages:8" -> (known after apply)
- compatible_architectures = [] -> null
~ created_date = "2023-07-21T12:42:08.652+0000" -> (known after apply)
~ id = "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_lib_packages:8" -> (known after apply)
~ layer_arn = "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_lib_packages" -> (known after apply)
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
~ source_code_hash = "Yt+PCj+su2PKY5jmYB/8Klpw1hhZMhvzkQjhfplPFSk=" -> "aMoOyf/2lLfJkqzVR1L+oPscSFKywcFmQTPl1evU0IY=" # forces replacement
~ source_code_size = 3814 -> (known after apply)
~ version = "8" -> (known after apply)
# (4 unchanged attributes hidden)
}
# aws_lambda_layer_version.nagware_nodejs must be replaced
-/+ resource "aws_lambda_layer_version" "nagware_nodejs" {
~ arn = "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_node_packages:15" -> (known after apply)
- compatible_architectures = [] -> null
~ created_date = "2023-07-21T12:42:15.055+0000" -> (known after apply)
~ id = "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_node_packages:15" -> (known after apply)
~ layer_arn = "arn:aws:lambda:ca-central-1:687401027353:layer:nagware_node_packages" -> (known after apply)
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
~ source_code_hash = "gqUAucq28GdqL2sbVq4aA+ZEnm+/oXU6jRvkkBKRx4o=" -> "Ggli/WoTw6SVanhWXvhR4WQDQ7Mv+fS3slM292yTyXo=" # forces replacement
~ source_code_size = 3676202 -> (known after apply)
~ version = "15" -> (known after apply)
# (4 unchanged attributes hidden)
}
Plan: 2 to add, 1 to change, 2 to destroy.
Warning: Argument is deprecated
with aws_s3_bucket.reliability_file_storage,
on s3.tf line 4, in resource "aws_s3_bucket" "reliability_file_storage":
4: resource "aws_s3_bucket" "reliability_file_storage" {
Use the aws_s3_bucket_lifecycle_configuration resource instead
(and 17 more similar warnings elsewhere)
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Releasing state lock. This may take a few moments...
Show Conftest resultsWARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_2am_every_day"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_3am_every_day"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_4am_every_day"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_5am_every_business_day"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.archive_form_templates"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.archiver"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.audit_logs"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.dead_letter_queue_consumer"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.nagware"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.reliability"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.submission"]
28 tests, 17 passed, 11 warnings, 0 failures, 0 exceptions
|
Note: I opened a new PR (#448) instead with signed commits. I signed the commits by doing a rebase since I added my new GPG key after already doing the commit |
Pull request was closed
Summary | Résumé
Fix for cds-snc/platform-forms-client#2338
Updates the nagware to check if the detected overdue responses are for an unpublished form, and deletes them accordingly.
Test instructions | Instructions pour tester la modification
./invoke_nagware.js
Tested with: