From 24c92da1425b5c4f936d5aba8f484f3a12429c86 Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Tue, 10 Dec 2024 11:27:16 +0000 Subject: [PATCH 01/11] Update pull_request_template.md (#2993) Update checklist and *encourage* use of. --- docs/pull_request_template.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index 17a2fb772c..ff0550d772 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -12,13 +12,13 @@ _Explain how your code addresses the purpose of the change_ _Any tips and tricks, blog posts or tools which helped you. Plus anything notable you've discovered about the Use a Lasting Power of Attorney service_ -## Checklist +## Checklist (**tick/delete or ~~strikethrough~~** as appropriate) * [ ] I have performed a self-review of my own code -* [ ] I have added relevant logging with appropriate levels to my code -* [ ] New event_codes have been documented on the [wiki page](https://opgtransform.atlassian.net/wiki/spaces/LSML2/pages/3277881441/Understanding+the+event+logs) -* [ ] I have updated documentation (Confluence/GitHub wiki/tech debt doc) where relevant * [ ] I have added tests to prove my work +* [ ] I have added relevant and appropriately leveled logging, **without PII**, to my code +* [ ] New event_codes have been documented on the [wiki page](https://opgtransform.atlassian.net/wiki/spaces/LSML2/pages/3277881441/Understanding+the+event+logs) +* [ ] I have updated documentation (Confluence/GitHub wiki/tech debt doc) * [ ] I have added welsh translation tags and updated translation files * [ ] I have run an accessibility tool on any pages I have made changes to and fixed any issues found * [ ] I have notified the Interaction Designer of any content changes so that appropriate screenshots/flow diagram changes can be made From f3bdb7cf7be4c4f003ad4b255e18f8fc98a15c0f Mon Sep 17 00:00:00 2001 From: Jay Whitwell <72501756+jay-whitwell@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:15:35 +0000 Subject: [PATCH 02/11] UML-3762: update slack notification (#2995) --- .github/workflows/path-to-live.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/path-to-live.yml b/.github/workflows/path-to-live.yml index eb38a43ff0..4273b5e8b0 100644 --- a/.github/workflows/path-to-live.yml +++ b/.github/workflows/path-to-live.yml @@ -36,7 +36,7 @@ jobs: specific_path: ${{ steps.variables.outputs.path }} steps: - uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb # pin@v3 - + - name: get changed docs files in any folder id: changed-files-docs uses: tj-actions/changed-files@ef3b6f1fa5eccdc95d915ec0f87a16535a73d0ca @@ -268,9 +268,10 @@ jobs: uses: ./.github/workflows/_slack-notification.yml needs: - production_health_check + - update_documentation with: template: production_release.txt - workflow_status: ${{ needs.production_health_check.result }} + workflow_status: ${{ needs.production_health_check.result || needs.update_documentation.result }} workspace: production secrets: webhook: ${{ secrets.PROD_SLACK_WEB_HOOK }} From aab3c5e2334538f587a9efc4256a5e2cd39357db Mon Sep 17 00:00:00 2001 From: Jay Whitwell <72501756+jay-whitwell@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:03:45 +0000 Subject: [PATCH 03/11] UML-3727: rename and Lambda RIE (#2994) * UML-3727: event receiver lambda * update name to event-receiver * remove old files * rename resources * fix typo * fix typo * use svc prefix and suffix * add if statement back * fix missed - --- .github/workflows/_build-and-push.yml | 11 +++++----- docker-compose.yml | 20 +++++++++++++++++++ .../Dockerfile | 0 .../app/main.go | 0 .../go.mod | 0 .../go.sum | 0 terraform/account/region.tf | 4 ++-- terraform/account/region/lambda_functions.tf | 14 ++++++------- terraform/account/region/variables.tf | 4 ++-- terraform/account/terraform.tfvars.json | 18 +++++++++++------ terraform/account/variables.tf | 2 +- 11 files changed, 50 insertions(+), 23 deletions(-) rename lambda-functions/{ingestion-lambda => event-receiver}/Dockerfile (100%) rename lambda-functions/{ingestion-lambda => event-receiver}/app/main.go (100%) rename lambda-functions/{ingestion-lambda => event-receiver}/go.mod (100%) rename lambda-functions/{ingestion-lambda => event-receiver}/go.sum (100%) diff --git a/.github/workflows/_build-and-push.yml b/.github/workflows/_build-and-push.yml index 4c1aa823d1..727062b261 100644 --- a/.github/workflows/_build-and-push.yml +++ b/.github/workflows/_build-and-push.yml @@ -75,8 +75,8 @@ jobs: run_unit_tests: 'true' run_integration_tests: 'false' artifact_to_dl: '' - - svc_prefix: 'ingestion' - svc_suffix: 'lambda' + - svc_prefix: 'event' + svc_suffix: 'receiver' build_development_docker: 'false' run_unit_tests: 'false' run_integration_tests: 'false' @@ -264,9 +264,10 @@ jobs: elif [[ "${SVC_PREFIX}" = "stats_upload" ]]; then docker build --no-cache --file lambda-functions/upload-statistics/Dockerfile --tag stats_upload_lambda:latest lambda-functions/upload-statistics - elif [[ "${SVC_PREFIX}" = "ingestion" ]]; then - docker build --file lambda-functions/ingestion-lambda/Dockerfile --tag ingestion_lambda:latest lambda-functions/ingestion-lambda - + elif [[ "${SVC_PREFIX}" = "event" ]]; then + if [[ "${SVC_SUFFIX}" = "receiver" ]]; then + docker build --file lambda-functions/${SVC_PREFIX}-${SVC_SUFFIX}/Dockerfile --tag ${SVC_PREFIX}_${SVC_SUFFIX}:latest lambda-functions/${SVC_PREFIX}-${SVC_SUFFIX} + fi fi if: (inputs.specific_path == 'all' || inputs.specific_path == matrix.svc_prefix) diff --git a/docker-compose.yml b/docker-compose.yml index 67ea6bfbfe..e6737e847f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -268,6 +268,26 @@ services: ports: - 9007:8080 + + # --------------------------- + # Lambda for ingestion from MLPA + + event-reciever-lambda: + container_name: event-reciever + build: + context: ./lambda-functions/event-reciever + dockerfile: Dockerfile + environment: + ENVIRONMENT: local + REGION: eu-west-1 + AWS_ACCESS_KEY_ID: 'devkey' + AWS_SECRET_ACCESS_KEY: 'secretdevkey' + volumes: + - ./lambda-functions/event-reciever/app:/function/app + - ./lambda-functions/.aws-lambda-rie:/aws-lambda + ports: + - 9008:8080 + proxy: container_name: proxy image: traefik:3.0 diff --git a/lambda-functions/ingestion-lambda/Dockerfile b/lambda-functions/event-receiver/Dockerfile similarity index 100% rename from lambda-functions/ingestion-lambda/Dockerfile rename to lambda-functions/event-receiver/Dockerfile diff --git a/lambda-functions/ingestion-lambda/app/main.go b/lambda-functions/event-receiver/app/main.go similarity index 100% rename from lambda-functions/ingestion-lambda/app/main.go rename to lambda-functions/event-receiver/app/main.go diff --git a/lambda-functions/ingestion-lambda/go.mod b/lambda-functions/event-receiver/go.mod similarity index 100% rename from lambda-functions/ingestion-lambda/go.mod rename to lambda-functions/event-receiver/go.mod diff --git a/lambda-functions/ingestion-lambda/go.sum b/lambda-functions/event-receiver/go.sum similarity index 100% rename from lambda-functions/ingestion-lambda/go.sum rename to lambda-functions/event-receiver/go.sum diff --git a/terraform/account/region.tf b/terraform/account/region.tf index e84dec2b4e..0b1ab52531 100644 --- a/terraform/account/region.tf +++ b/terraform/account/region.tf @@ -8,7 +8,7 @@ module "eu_west_1" { environment_name = local.environment lambda_container_version = var.lambda_container_version vpc_flow_logs_iam_role = aws_iam_role.vpc_flow_logs - ingestion_lambda_enabled = true + event_receiver_enabled = true depends_on = [ module.cloudwatch_mrk, @@ -36,7 +36,7 @@ module "eu_west_2" { environment_name = local.environment lambda_container_version = var.lambda_container_version vpc_flow_logs_iam_role = aws_iam_role.vpc_flow_logs - ingestion_lambda_enabled = false + event_receiver_enabled = false depends_on = [ module.cloudwatch_mrk, diff --git a/terraform/account/region/lambda_functions.tf b/terraform/account/region/lambda_functions.tf index 6cb8195ff0..93cef568f8 100644 --- a/terraform/account/region/lambda_functions.tf +++ b/terraform/account/region/lambda_functions.tf @@ -8,18 +8,18 @@ data "aws_ecr_repository" "ship_to_opg_metrics" { provider = aws.management } -data "aws_ecr_repository" "ingestion_repo" { - name = "use_an_lpa/ingestion_lambda" +data "aws_ecr_repository" "event_receiver_repo" { + name = "use_an_lpa/event_receiver" provider = aws.management } -module "ingestion_lambda" { - count = var.ingestion_lambda_enabled ? 1 : 0 +module "event_receiver" { + count = var.event_receiver_enabled ? 1 : 0 source = "./modules/lambda_function" - lambda_name = "ingestion-lambda-${var.account_name}" + lambda_name = "event-receiver-${var.account_name}" working_directory = "/" - image_uri = "${data.aws_ecr_repository.ingestion_repo.repository_url}:${var.lambda_container_version}" - ecr_arn = data.aws_ecr_repository.ingestion_repo.arn + image_uri = "${data.aws_ecr_repository.event_receiver_repo.repository_url}:${var.lambda_container_version}" + ecr_arn = data.aws_ecr_repository.event_receiver_repo.arn aws_cloudwatch_log_group_kms_key_id = data.aws_kms_alias.cloudwatch_mrk.arn providers = { diff --git a/terraform/account/region/variables.tf b/terraform/account/region/variables.tf index b9278c1e51..4c4c6c1244 100644 --- a/terraform/account/region/variables.tf +++ b/terraform/account/region/variables.tf @@ -37,8 +37,8 @@ variable "environment_name" { type = string } -variable "ingestion_lambda_enabled" { - description = "Enable the ingestion lambda" +variable "event_receiver_enabled" { + description = "Enable the event receiver Lambda" type = bool } variable "lambda_container_version" { diff --git a/terraform/account/terraform.tfvars.json b/terraform/account/terraform.tfvars.json index 432302f903..d99d7e0a5c 100644 --- a/terraform/account/terraform.tfvars.json +++ b/terraform/account/terraform.tfvars.json @@ -8,7 +8,7 @@ "development": { "account_id": "367815980639", "cloudwatch_application_insights_enabled": true, - "ingestion_lambda_enabled": true, + "event_receiver_enabled": true, "shared_account_id": "679638075911", "is_production": false, "retention_in_days": 7, @@ -27,7 +27,9 @@ "int.lpa-codes.api.opg.service.justice.gov.uk.", "dev.lpa.api.opg.service.justice.gov.uk." ], - "domains_blocked": ["*."] + "domains_blocked": [ + "*." + ] }, "dynamodb_cloudtrail": { "enabled": false, @@ -47,7 +49,7 @@ "preproduction": { "account_id": "888228022356", "cloudwatch_application_insights_enabled": false, - "ingestion_lambda_enabled": false, + "event_receiver_enabled": false, "shared_account_id": "679638075911", "is_production": false, "retention_in_days": 7, @@ -66,7 +68,9 @@ "int.lpa-codes.api.opg.service.justice.gov.uk.", "dev.lpa.api.opg.service.justice.gov.uk." ], - "domains_blocked": ["*."] + "domains_blocked": [ + "*." + ] }, "dynamodb_cloudtrail": { "enabled": false, @@ -86,7 +90,7 @@ "production": { "account_id": "690083044361", "cloudwatch_application_insights_enabled": true, - "ingestion_lambda_enabled": false, + "event_receiver_enabled": false, "shared_account_id": "679638075911", "is_production": true, "retention_in_days": 400, @@ -105,7 +109,9 @@ "lpa-codes.api.opg.service.justice.gov.uk.", "lpa.api.opg.service.justice.gov.uk." ], - "domains_blocked": ["*."] + "domains_blocked": [ + "*." + ] }, "dynamodb_cloudtrail": { "enabled": true, diff --git a/terraform/account/variables.tf b/terraform/account/variables.tf index 5f22016942..4016ec2c48 100644 --- a/terraform/account/variables.tf +++ b/terraform/account/variables.tf @@ -20,7 +20,7 @@ variable "accounts" { account_id = string cloudwatch_application_insights_enabled = bool shared_account_id = number - ingestion_lambda_enabled = bool + event_receiver_enabled = bool is_production = bool retention_in_days = number pagerduty_service_name = string From 23b97680c7d1bcc222f7da6e077a639cee594092 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:18:03 +0000 Subject: [PATCH 04/11] Renovate Update aws-actions/amazon-ecr-login digest to b06ccd1 (#2997) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/_build-and-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_build-and-push.yml b/.github/workflows/_build-and-push.yml index 727062b261..60d247531b 100644 --- a/.github/workflows/_build-and-push.yml +++ b/.github/workflows/_build-and-push.yml @@ -119,7 +119,7 @@ jobs: - name: ecr login id: login_ecr - uses: aws-actions/amazon-ecr-login@37b726ebcaba9d1c1838caf54540902bad814823 # pin@v1.5.1 + uses: aws-actions/amazon-ecr-login@b06ccd195086ba5254c95c627ee1cbeab86c7432 # pin@v1.5.1 with: registries: 311462405659 if: | From 8a084d89c5b211ebf0e17ad9d19b0e1ea4669cb4 Mon Sep 17 00:00:00 2001 From: Nick Davis <62664046+nickdavis2001@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:30:50 +0000 Subject: [PATCH 05/11] UML-3753 tech debt - remove no longer needed IaP flag (#2987) * remove feature flagged old logic * take out old feature flag logic * take out old feature flag logic * take out old feature flag logic * remove IaP flag * remove IaP flag * take out IaP flag * fixing tests * Revert "fixing tests" This reverts commit 0144c9b3da6ea2f25efb1ea5fd4a2faeedb66b32. * turn off old tests that were flagged as false for iap flag * more IaP removal * more removals of feature flag logic * remove more feature flag logic * more feature flag removals * more mods * take out iap feature * remove steps no longer used * remove flag * remove flag from api side * remove feature flag * remove flag from terraform * tflint --- docker-compose.yml | 5 -- .../app/config/autoload/features.global.php | 4 -- .../app/features/actor-view-lpa.feature | 2 +- .../context/Acceptance/ViewerContext.php | 32 +++++---- .../context/Integration/ViewerContext.php | 38 +++++------ .../features/view-lpa-using-sharecode.feature | 14 +--- .../App/src/Service/Lpa/SiriusLpaManager.php | 1 - .../app/config/autoload/features.global.php | 4 -- .../app/features/bootstrap/behat.config.php | 1 - .../context/Integration/ViewerContext.php | 12 ++-- .../app/features/context/UI/ViewerContext.php | 67 +++---------------- .../app/features/pdf-download-of-lpa.feature | 6 -- ...-with-instructions-and-preferences.feature | 21 ------ .../src/Handler/ViewLpaSummaryHandler.php | 3 - .../check-access-codes-combined-lpa.html.twig | 10 --- .../actor/check-access-codes.html.twig | 10 --- ...a-create-viewercode-combined-lpa.html.twig | 10 --- .../actor/lpa-create-viewercode.html.twig | 10 --- .../actor/lpa-show-viewercode.html.twig | 63 +++++------------ ...ns-preferences-important-message.html.twig | 20 ------ .../view-lpa-summary-combined-lpa.html.twig | 29 +++----- .../actor/view-lpa-summary.html.twig | 29 +++----- .../full-lpa-display-combined-lpa.html.twig | 12 ++-- .../partials/full-lpa-display.html.twig | 12 ++-- .../lpa-details-combined-lpa.html.twig | 31 ++------- .../lpa-summary-details/lpa-details.html.twig | 31 ++------- .../Viewer/src/Handler/DownloadLpaHandler.php | 2 +- .../src/Viewer/src/Handler/ViewLpaHandler.php | 2 +- terraform/environment/region.tf | 2 - terraform/environment/region/api_ecs.tf | 4 -- terraform/environment/region/use_ecs.tf | 4 -- terraform/environment/region/viewer_ecs.tf | 4 -- terraform/environment/terraform.tfvars.json | 5 -- terraform/environment/variables.tf | 11 ++- 34 files changed, 115 insertions(+), 396 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e6737e847f..c413ae5311 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -50,9 +50,6 @@ services: GOOGLE_ANALYTICS_ID: "UA-170469426-2" KMS_SESSION_CMK_ALIAS: "alias/viewer-sessions-cmk-alias" - # Feature flags - INSTRUCTIONS_AND_PREFERENCES: "true" - # Local only API_SERVICE_URL: PDF_SERVICE_URL: @@ -107,7 +104,6 @@ services: # Feature flags DELETE_LPA_FEATURE: "true" ALLOW_MERIS_LPAS: "false" - INSTRUCTIONS_AND_PREFERENCES: "true" ALLOW_GOV_ONE_LOGIN: "true" SUPPORT_DATASTORE_LPAS: "false" @@ -194,7 +190,6 @@ services: # Feature flags ALLOW_MERIS_LPAS: "false" - INSTRUCTIONS_AND_PREFERENCES: "true" ALLOW_GOV_ONE_LOGIN: "true" SUPPORT_DATASTORE_LPAS: "false" diff --git a/service-api/app/config/autoload/features.global.php b/service-api/app/config/autoload/features.global.php index 1380c73f85..3450ec0e92 100644 --- a/service-api/app/config/autoload/features.global.php +++ b/service-api/app/config/autoload/features.global.php @@ -6,10 +6,6 @@ 'feature_flags' => [ 'use_legacy_codes_service' => getenv('USE_LEGACY_CODES_SERVICE') ?: 'false', 'allow_meris_lpas' => filter_var(getenv('ALLOW_MERIS_LPAS'), FILTER_VALIDATE_BOOLEAN) ?: false, - 'instructions_and_preferences' => filter_var( - getenv('INSTRUCTIONS_AND_PREFERENCES'), - FILTER_VALIDATE_BOOLEAN - ) ?: false, 'support_datastore_lpas' => filter_var( getenv('SUPPORT_DATASTORE_LPAS'), FILTER_VALIDATE_BOOLEAN diff --git a/service-api/app/features/actor-view-lpa.feature b/service-api/app/features/actor-view-lpa.feature index d00ebe170f..9baf76f39a 100644 --- a/service-api/app/features/actor-view-lpa.feature +++ b/service-api/app/features/actor-view-lpa.feature @@ -26,7 +26,7 @@ Feature: View an LPA that I have added to my account When I request to view an LPA which status is "Revoked" Then I am taken back to the dashboard page - @integration @acceptance @pact @ff:instructions_and_preferences:true + @integration @acceptance @pact Scenario: The user can see the instructions and preferences on their LPA Given I am on the dashboard page When I request to view an LPA which has instructions and preferences diff --git a/service-api/app/features/context/Acceptance/ViewerContext.php b/service-api/app/features/context/Acceptance/ViewerContext.php index e26dc1ab7e..f2ecdb370d 100644 --- a/service-api/app/features/context/Acceptance/ViewerContext.php +++ b/service-api/app/features/context/Acceptance/ViewerContext.php @@ -144,23 +144,21 @@ public function iGiveAValidLPAShareCode(): void // SiriusLpas::get $this->apiFixtures->append(new Response(StatusCodeInterface::STATUS_OK, [], json_encode($this->lpa))); - if (($this->base->container->get(FeatureEnabled::class))('instructions_and_preferences')) { - $imageResponse = new stdClass(); - $imageResponse->uId = (int) $this->lpa->uId; - $imageResponse->status = 'COLLECTION_COMPLETE'; - $imageResponse->signedUrls = [ - 'iap-' . $this->lpa->uId . '-instructions' => 'https://image_url', - 'iap-' . $this->lpa->uId . '-preferences' => 'https://image_url', - ]; - - $this->apiFixtures->append( - new Response( - StatusCodeInterface::STATUS_OK, - [], - json_encode($imageResponse), - ) - ); - } + $imageResponse = new stdClass(); + $imageResponse->uId = (int) $this->lpa->uId; + $imageResponse->status = 'COLLECTION_COMPLETE'; + $imageResponse->signedUrls = [ + 'iap-' . $this->lpa->uId . '-instructions' => 'https://image_url', + 'iap-' . $this->lpa->uId . '-preferences' => 'https://image_url', + ]; + + $this->apiFixtures->append( + new Response( + StatusCodeInterface::STATUS_OK, + [], + json_encode($imageResponse), + ) + ); $this->apiPost( '/v1/viewer-codes/summary', diff --git a/service-api/app/features/context/Integration/ViewerContext.php b/service-api/app/features/context/Integration/ViewerContext.php index 1e3f1c0271..9d7e82ac92 100644 --- a/service-api/app/features/context/Integration/ViewerContext.php +++ b/service-api/app/features/context/Integration/ViewerContext.php @@ -173,22 +173,20 @@ public function iGiveAValidLPAShareCode(): void $this->lpa ); - if ($this->container->get(FeatureEnabled::class)('instructions_and_preferences')) { - $imageResponse = new stdClass(); - $imageResponse->uId = (int) $this->lpa->uId; - $imageResponse->status = 'COLLECTION_COMPLETE'; - $imageResponse->signedUrls = [ - 'iap-' . $this->lpa->uId . '-instructions' => 'https://image_url', - 'iap-' . $this->lpa->uId . '-preferences' => 'https://image_url', - ]; - - $this->pactGetInteraction( - $this->iapImagesPactProvider, - '/v1/image-request/' . $this->lpa->uId, - StatusCodeInterface::STATUS_OK, - $imageResponse - ); - } + $imageResponse = new stdClass(); + $imageResponse->uId = (int) $this->lpa->uId; + $imageResponse->status = 'COLLECTION_COMPLETE'; + $imageResponse->signedUrls = [ + 'iap-' . $this->lpa->uId . '-instructions' => 'https://image_url', + 'iap-' . $this->lpa->uId . '-preferences' => 'https://image_url', + ]; + + $this->pactGetInteraction( + $this->iapImagesPactProvider, + '/v1/image-request/' . $this->lpa->uId, + StatusCodeInterface::STATUS_OK, + $imageResponse + ); // organisation parameter is null when doing a summary check $lpaData = $this->lpaService->getByViewerCode($this->viewerCode, $this->donorSurname, null); @@ -196,11 +194,9 @@ public function iGiveAValidLPAShareCode(): void Assert::assertEquals($this->lpa->uId, $lpaData['lpa']['uId']); Assert::assertEquals($lpaExpiry, $lpaData['expires']); - if ($this->container->get(FeatureEnabled::class)('instructions_and_preferences')) { - Assert::assertArrayHasKey('iap', $lpaData); - Assert::assertInstanceOf(InstructionsAndPreferencesImages::class, $lpaData['iap']); - Assert::assertEquals('COLLECTION_COMPLETE', $lpaData['iap']->status->value); - } + Assert::assertArrayHasKey('iap', $lpaData); + Assert::assertInstanceOf(InstructionsAndPreferencesImages::class, $lpaData['iap']); + Assert::assertEquals('COLLECTION_COMPLETE', $lpaData['iap']->status->value); } /** diff --git a/service-api/app/features/view-lpa-using-sharecode.feature b/service-api/app/features/view-lpa-using-sharecode.feature index 50be1651b5..1a72363baf 100644 --- a/service-api/app/features/view-lpa-using-sharecode.feature +++ b/service-api/app/features/view-lpa-using-sharecode.feature @@ -4,14 +4,6 @@ Feature: View an LPA via sharecode I can enter that code and see the details of an LPA So that I can carry out business functions - @integration @acceptance @pact @ff:instructions_and_preferences:false - Scenario: View an LPA - Given I have been given access to an LPA via share code - And I access the viewer service - When I give a valid LPA share code - And I enter an organisation name and confirm the LPA is correct - Then I can see the full details of the valid LPA - @integration @acceptance @pact Scenario: View a cancelled LPA Given I have been given access to a cancelled LPA via share code @@ -33,21 +25,21 @@ Feature: View an LPA via sharecode When I give a valid LPA share code And I want to see an option to check another LPA - @acceptance @integration @pact @ff:instructions_and_preferences:true + @acceptance @integration @pact Scenario: The user should be able to see instructions Given I have been given access to an LPA via share code And the LPA has instructions When I give a valid LPA share code Then I can see instructions images - @acceptance @integration @pact @ff:instructions_and_preferences:true + @acceptance @integration @pact Scenario: The user should be able to see preferences Given I have been given access to an LPA via share code And the LPA has preferences When I give a valid LPA share code Then I can see preferences images - @acceptance @integration @pact @ff:instructions_and_preferences:true + @acceptance @integration @pact Scenario: The user should be able to see instructions and preferences Given I have been given access to an LPA via share code And the LPA has instructions and preferences diff --git a/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php b/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php index 9358af140d..f12c6c1e5b 100644 --- a/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php +++ b/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php @@ -181,7 +181,6 @@ public function getByViewerCode(string $viewerCode, string $donorSurname, ?strin ]; if ( - ($this->featureEnabled)('instructions_and_preferences') && (($lpaData['applicationHasGuidance'] ?? false) || ($lpaData['applicationHasRestrictions'] ?? false)) ) { $this->logger->info('The LPA has instructions and/or preferences. Fetching images'); diff --git a/service-front/app/config/autoload/features.global.php b/service-front/app/config/autoload/features.global.php index b2d94e54ce..0a49740eae 100644 --- a/service-front/app/config/autoload/features.global.php +++ b/service-front/app/config/autoload/features.global.php @@ -16,10 +16,6 @@ getenv('ALLOW_MERIS_LPAS'), FILTER_VALIDATE_BOOLEAN ) ?: false, - 'instructions_and_preferences' => filter_var( - getenv('INSTRUCTIONS_AND_PREFERENCES'), - FILTER_VALIDATE_BOOLEAN - ) ?: false, 'allow_gov_one_login' => filter_var( getenv('ALLOW_GOV_ONE_LOGIN'), FILTER_VALIDATE_BOOLEAN diff --git a/service-front/app/features/bootstrap/behat.config.php b/service-front/app/features/bootstrap/behat.config.php index 6e6b383b95..b5467a6cc8 100644 --- a/service-front/app/features/bootstrap/behat.config.php +++ b/service-front/app/features/bootstrap/behat.config.php @@ -36,7 +36,6 @@ ], 'feature_flags' => [ 'delete_lpa_feature' => true, - 'instructions_and_preferences' => true, 'allow_gov_one_login' => true, 'support_datastore_lpas' => false, ], diff --git a/service-front/app/features/context/Integration/ViewerContext.php b/service-front/app/features/context/Integration/ViewerContext.php index 5dd6e356c8..48b938a2b1 100644 --- a/service-front/app/features/context/Integration/ViewerContext.php +++ b/service-front/app/features/context/Integration/ViewerContext.php @@ -236,14 +236,10 @@ public function iChooseToDownloadADocumentVersionOfTheLPA(): void $pdfService = $this->container->get(PdfService::class); - if (($this->container->get(FeatureEnabled::class))('instructions_and_preferences')) { - $pdfService->getLpaAsPdf( - $this->viewedLpa, - new Images(700000000001, ImagesStatus::COLLECTION_COMPLETE, []), - ); - } else { - $pdfService->getLpaAsPdf($this->viewedLpa); - } + $pdfService->getLpaAsPdf( + $this->viewedLpa, + new Images(700000000001, ImagesStatus::COLLECTION_COMPLETE, []), + ); $request = $this->apiFixtures->getLastRequest(); Assert::assertStringContainsString('Mr Test Testable Testerson', $request->getBody()->getContents()); diff --git a/service-front/app/features/context/UI/ViewerContext.php b/service-front/app/features/context/UI/ViewerContext.php index 793f1bb3e7..47a0bcd41c 100644 --- a/service-front/app/features/context/UI/ViewerContext.php +++ b/service-front/app/features/context/UI/ViewerContext.php @@ -357,13 +357,11 @@ public function iChooseToDownloadADocumentVersionOfTheLPA() 'expires' => (new DateTime('+30 days'))->format('c'), ]; - if (($this->base->container->get(FeatureEnabled::class))('instructions_and_preferences')) { - $data['iap'] = [ - 'uId' => (int) $this->lpaData['uId'], - 'status' => $this->imageCollectionStatus, - 'signedUrls' => [], - ]; - } + $data['iap'] = [ + 'uId' => (int) $this->lpaData['uId'], + 'status' => $this->imageCollectionStatus, + 'signedUrls' => [], + ]; // API call for lpa full fetch $this->apiFixtures->append( @@ -532,7 +530,6 @@ public function iEnterAnOrganisationNameAndConfirmTheLPAIsCorrect() if ( ($data['lpa']['applicationHasGuidance'] ?? false) || ($data['lpa']['applicationHasRestrictions'] ?? false) - && ($this->base->container->get(FeatureEnabled::class))('instructions_and_preferences') ) { $data['iap'] = [ 'uId' => (int) $this->lpaData['uId'], @@ -783,10 +780,8 @@ public function iGiveAValidLPAShareCodeOf(string $code, string $storedCode) public function iCanClearlySeeTheLPAHasInstructionsAndPreferences() { $this->ui->assertElementContainsText('div.govuk-panel', 'This LPA has preferences and instructions'); - if (($this->base->container->get(FeatureEnabled::class))('instructions_and_preferences')) { - $this->ui->assertElementOnPage('iap-instructions img.opg-ip__image'); - $this->ui->assertElementOnPage('iap-preferences img.opg-ip__image'); - } + $this->ui->assertElementOnPage('iap-instructions img.opg-ip__image'); + $this->ui->assertElementOnPage('iap-preferences img.opg-ip__image'); } /** @@ -795,10 +790,8 @@ public function iCanClearlySeeTheLPAHasInstructionsAndPreferences() public function iCanClearlySeeTheLPAHasPreferences() { $this->ui->assertElementContainsText('div.govuk-panel', 'This LPA has preferences'); - if (($this->base->container->get(FeatureEnabled::class))('instructions_and_preferences')) { - $this->ui->assertElementNotOnPage('iap-instructions img.opg-ip__image'); - $this->ui->assertElementOnPage('iap-preferences img.opg-ip__image'); - } + $this->ui->assertElementNotOnPage('iap-instructions img.opg-ip__image'); + $this->ui->assertElementOnPage('iap-preferences img.opg-ip__image'); } /** @@ -807,46 +800,8 @@ public function iCanClearlySeeTheLPAHasPreferences() public function iCanClearlySeeTheLPAHasInstructions() { $this->ui->assertElementContainsText('div.govuk-panel', 'This LPA has instructions'); - if (($this->base->container->get(FeatureEnabled::class))('instructions_and_preferences')) { - $this->ui->assertElementOnPage('iap-instructions img.opg-ip__image'); - $this->ui->assertElementNotOnPage('iap-preferences img.opg-ip__image'); - } - } - - /** - * @Then /^I can see the lpa has instructions and preferences set in summary$/ - */ - public function iCanSeeTheLPAHasInstructionsAndPreferencesInSummary() - { - $this->ui->assertPageContainsText('Preferences and instructions'); - $this->ui->assertElementContainsText( - 'dd[data-field-name="instructions_and_preferences"]', - 'Yes, the donor made preferences and/or instructions on their LPA.' - ); - } - - /** - * @Then /^I can see the lpa has no instructions and preferences set in summary$/ - */ - public function iCanSeeTheLPAHasNoInstructionsAndPreferencesInSummary() - { - $this->ui->assertPageContainsText('Preferences and instructions'); - $this->ui->assertElementNotContainsText( - 'dd.govuk-summary-list__value', - 'Yes, the donor made preferences and/or instructions on their LPA.' - ); - $this->ui->assertElementContainsText('dd[data-field-name="instructions_and_preferences"]', 'No'); - } - - /** - * @Then /^I can clearly see the lpa has instructions andor preferences$/ - */ - public function iCanClearlySeeTheLPAHasInstructionsAndOrPreferences() - { - $this->ui->assertElementContainsText('div.govuk-panel', 'This LPA has preferences and/or instructions'); - $this->ui->assertElementNotOnPage('.iap-loader'); - $this->ui->assertPageNotContainsText('A scanned image of the donor’s preferences will appear here soon'); - $this->ui->assertPageNotContainsText('We cannot show the instructions for this LPA. Until we can fix this problem'); + $this->ui->assertElementOnPage('iap-instructions img.opg-ip__image'); + $this->ui->assertElementNotOnPage('iap-preferences img.opg-ip__image'); } /** diff --git a/service-front/app/features/pdf-download-of-lpa.feature b/service-front/app/features/pdf-download-of-lpa.feature index ab9c17df63..7f314dbe72 100644 --- a/service-front/app/features/pdf-download-of-lpa.feature +++ b/service-front/app/features/pdf-download-of-lpa.feature @@ -15,9 +15,3 @@ Feature: PDF download Given I am viewing a valid LPA When I choose to download a document version of the LPA Then a PDF is downloaded - - @integration @ui @ff:instructions_and_preferences:false - Scenario: The user can download a document version of the LPA they're viewing without images - Given I am viewing a valid LPA - When I choose to download a document version of the LPA - Then a PDF is downloaded diff --git a/service-front/app/features/view-lpa-using-sharecode-with-instructions-and-preferences.feature b/service-front/app/features/view-lpa-using-sharecode-with-instructions-and-preferences.feature index e982cc08d9..db80f47537 100644 --- a/service-front/app/features/view-lpa-using-sharecode-with-instructions-and-preferences.feature +++ b/service-front/app/features/view-lpa-using-sharecode-with-instructions-and-preferences.feature @@ -37,27 +37,6 @@ Feature: View an LPA via sharecode And preferences will show “no” And instructions will show “no” - @ui @ff:instructions_and_preferences:false - Scenario: Instructions and preferences information shows for older LPAs - Given The LPA has instructions and preferences and is signed before 2016 - When I enter an organisation name and confirm the LPA is correct - Then I can see the full details of the valid LPA - And I can clearly see the lpa has instructions andor preferences - - @ui @ff:instructions_and_preferences:false - Scenario: Instructions and preferences summary information shows for older LPAs - Given The LPA has instructions and preferences and is signed before 2016 - When I enter an organisation name and confirm the LPA is correct - Then I can see the full details of the valid LPA - And I can see the lpa has instructions and preferences set in summary - - @ui @ff:instructions_and_preferences:false - Scenario: Older LPAs with no instructions and preferences do not show anything in the summary - Given The LPA has no instructions or preferences and is signed before 2016 - When I enter an organisation name and confirm the LPA is correct - Then I can see the full details of the valid LPA - And I can see the lpa has no instructions and preferences set in summary - @ui Scenario: The viewer can see waiting message and image for instructions and preferences images that aren't ready yet Given The LPA has instructions and preferences for which images aren't yet ready diff --git a/service-front/app/src/Actor/src/Handler/ViewLpaSummaryHandler.php b/service-front/app/src/Actor/src/Handler/ViewLpaSummaryHandler.php index 32c29ec8b9..10cd6f7301 100644 --- a/service-front/app/src/Actor/src/Handler/ViewLpaSummaryHandler.php +++ b/service-front/app/src/Actor/src/Handler/ViewLpaSummaryHandler.php @@ -72,11 +72,8 @@ public function handle(ServerRequestInterface $request): ResponseInterface // to see if we should call it. Ideally these would live in the api layer but we // can't do that without a big refactor of how that works atm. if ( - ($this->featureEnabled)('instructions_and_preferences') && - ( ($lpaData->lpa->getApplicationHasGuidance() ?? false) || ($lpaData->lpa->getApplicationHasRestrictions() ?? false) - ) ) { $renderData['iap_images'] = $this->instAndPrefImagesService->getImagesById($identity, $actorLpaToken); } diff --git a/service-front/app/src/Actor/templates/actor/check-access-codes-combined-lpa.html.twig b/service-front/app/src/Actor/templates/actor/check-access-codes-combined-lpa.html.twig index 1e2d50ba16..fe924802e3 100644 --- a/service-front/app/src/Actor/templates/actor/check-access-codes-combined-lpa.html.twig +++ b/service-front/app/src/Actor/templates/actor/check-access-codes-combined-lpa.html.twig @@ -56,16 +56,6 @@

{% trans %}Give an organisation their access code so they can view this LPA. They should go to www.gov.uk/view-lpa to use the code.{% endtrans %}

- {% if (lpa.applicationHasRestrictions or lpa.applicationHasGuidance) and not feature_enabled("instructions_and_preferences") %} -
- - - {% trans %}Warning{% endtrans %} - {{ include('@actor/partials/lpa-instructions-preferences-warning-message.html.twig') }} - -
- {% endif %} -
{% for code in shareCodes %} {% set id_counter = ( id_counter | default(0) ) + 1 %} diff --git a/service-front/app/src/Actor/templates/actor/check-access-codes.html.twig b/service-front/app/src/Actor/templates/actor/check-access-codes.html.twig index 6e67940651..245746ed3e 100644 --- a/service-front/app/src/Actor/templates/actor/check-access-codes.html.twig +++ b/service-front/app/src/Actor/templates/actor/check-access-codes.html.twig @@ -55,16 +55,6 @@

{% trans %}Give an organisation their access code so they can view this LPA. They should go to www.gov.uk/view-lpa to use the code.{% endtrans %}

- {% if (lpa.applicationHasRestrictions or lpa.applicationHasGuidance) and not feature_enabled("instructions_and_preferences") %} -
- - - {% trans %}Warning{% endtrans %} - {{ include('@actor/partials/lpa-instructions-preferences-warning-message.html.twig') }} - -
- {% endif %} -
{% for code in shareCodes %} {% set id_counter = ( id_counter | default(0) ) + 1 %} diff --git a/service-front/app/src/Actor/templates/actor/lpa-create-viewercode-combined-lpa.html.twig b/service-front/app/src/Actor/templates/actor/lpa-create-viewercode-combined-lpa.html.twig index 7d3d8c5152..661a1e3712 100644 --- a/service-front/app/src/Actor/templates/actor/lpa-create-viewercode-combined-lpa.html.twig +++ b/service-front/app/src/Actor/templates/actor/lpa-create-viewercode-combined-lpa.html.twig @@ -45,16 +45,6 @@ }) }}
- {% if (lpa.applicationHasRestrictions or lpa.applicationHasGuidance) and not feature_enabled('instructions_and_preferences')%} -
- - - {% trans %}Warning{% endtrans %} - {{ include('@actor/partials/lpa-instructions-preferences-warning-message.html.twig') }} - -
- {% endif %} - {% if not lpa.applicationHasRestrictions and not lpa.applicationHasGuidance %}
diff --git a/service-front/app/src/Actor/templates/actor/lpa-create-viewercode.html.twig b/service-front/app/src/Actor/templates/actor/lpa-create-viewercode.html.twig index eba6700194..31987f883e 100644 --- a/service-front/app/src/Actor/templates/actor/lpa-create-viewercode.html.twig +++ b/service-front/app/src/Actor/templates/actor/lpa-create-viewercode.html.twig @@ -46,16 +46,6 @@ }) }}
- {% if (lpa.applicationHasRestrictions or lpa.applicationHasGuidance) and not feature_enabled('instructions_and_preferences')%} -
- - - {% trans %}Warning{% endtrans %} - {{ include('@actor/partials/lpa-instructions-preferences-warning-message.html.twig') }} - -
- {% endif %} - {% if not lpa.applicationHasRestrictions and not lpa.applicationHasGuidance %}
diff --git a/service-front/app/src/Actor/templates/actor/lpa-show-viewercode.html.twig b/service-front/app/src/Actor/templates/actor/lpa-show-viewercode.html.twig index 7d5b6ed93c..75a9a92f3b 100644 --- a/service-front/app/src/Actor/templates/actor/lpa-show-viewercode.html.twig +++ b/service-front/app/src/Actor/templates/actor/lpa-show-viewercode.html.twig @@ -49,29 +49,6 @@
- {% if not feature_enabled("instructions_and_preferences") %} -
- - {% trans %}Warning{% endtrans %} - {% if is_donor_signature_date_too_old(lpa) %} -

- {% trans %}If there are preferences or instructions on this LPA, you may also be asked to show the paper LPA.{% endtrans %} -

- {% elseif lpa.applicationHasRestrictions and lpa.applicationHasGuidance %} -

- {% trans %}As there are preferences and instructions on this LPA, you may also be asked to show the paper LPA.{% endtrans %} -

- {% elseif lpa.applicationHasRestrictions %} -

- {% trans %}As there are instructions on this LPA, you may also be asked to show the paper LPA.{% endtrans %} -

- {% elseif lpa.applicationHasGuidance %} -

- {% trans %}As there are preferences on this LPA, you may also be asked to show the paper LPA.{% endtrans %} -

- {% endif %} -
- {% endif %}

{% trans %}What to do next{% endtrans %}

@@ -88,32 +65,22 @@

- {% if feature_enabled('instructions_and_preferences') %} - {% if not is_donor_signature_date_too_old(lpa) %} -

- {% if lpa.applicationHasRestrictions and lpa.applicationHasGuidance %} - {% trans %} - Scanned copies of the donor’s preferences and instructions will be shown in the LPA summary. You’ll need to show organisations the paper LPA if any part of these cannot be read properly. - {% endtrans %} - {% elseif lpa.applicationHasGuidance %} - {% trans %} - Scanned copies of the donor’s preferences will be shown in the LPA summary. You’ll need to show organisations the paper LPA if any part of these cannot be read properly. - {% endtrans %} - {% elseif lpa.applicationHasRestrictions %} - {% trans %} - Scanned copies of the donor’s instructions will be shown in the LPA summary. You’ll need to show organisations the paper LPA if any part of these cannot be read properly. - {% endtrans %} - {% endif %} -

- {% elseif is_donor_signature_date_too_old(lpa) %} - {% if lpa.applicationHasRestrictions or lpa.applicationHasGuidance %} -

- {% trans %} - Scanned copies of the donor’s preferences or instructions will be shown in the LPA summary. You’ll need to show organisations the paper LPA if any part of these cannot be read properly. - {% endtrans %} -

+ {% if not is_donor_signature_date_too_old(lpa) %} +

+ {% if lpa.applicationHasRestrictions and lpa.applicationHasGuidance %} + {% trans %} + Scanned copies of the donor’s preferences and instructions will be shown in the LPA summary. You’ll need to show organisations the paper LPA if any part of these cannot be read properly. + {% endtrans %} + {% elseif lpa.applicationHasGuidance %} + {% trans %} + Scanned copies of the donor’s preferences will be shown in the LPA summary. You’ll need to show organisations the paper LPA if any part of these cannot be read properly. + {% endtrans %} + {% elseif lpa.applicationHasRestrictions %} + {% trans %} + Scanned copies of the donor’s instructions will be shown in the LPA summary. You’ll need to show organisations the paper LPA if any part of these cannot be read properly. + {% endtrans %} {% endif %} - {% endif %} +

{% endif %} {% if lpa.caseSubtype == 'pfa' %} diff --git a/service-front/app/src/Actor/templates/actor/partials/lpa-instructions-preferences-important-message.html.twig b/service-front/app/src/Actor/templates/actor/partials/lpa-instructions-preferences-important-message.html.twig index e88baf57d9..b9b9774700 100644 --- a/service-front/app/src/Actor/templates/actor/partials/lpa-instructions-preferences-important-message.html.twig +++ b/service-front/app/src/Actor/templates/actor/partials/lpa-instructions-preferences-important-message.html.twig @@ -3,11 +3,6 @@ {% trans %} This LPA has instructions.
{% endtrans %} - {% if not feature_enabled('instructions_and_preferences') %} - {% trans %} - You might need to show organisations the paper LPA. - {% endtrans %} - {% endif %} {% endtrans %} - {% if not feature_enabled('instructions_and_preferences') %} - {% trans %} - You might need to show organisations the paper LPA. - {% endtrans %} - {% endif %} {% endtrans %} - {% if not feature_enabled('instructions_and_preferences') %} - {% trans %} - You might need to show organisations the paper LPA. - {% endtrans %} - {% endif %} {% endtrans %} - {% if not feature_enabled('instructions_and_preferences') %} - {% trans %} - You might need to show organisations the paper LPA. - {% endtrans %} - {% endif %} - {% if not feature_enabled("instructions_and_preferences") %} -

- {{ include('@actor/partials/lpa-instructions-preferences-warning-message.html.twig') }} -

- {% endif %}
{% endif %} @@ -112,21 +107,19 @@ {% trans %}LPA details{% endtrans %} - {% if feature_enabled("instructions_and_preferences") %} - {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} + {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} - - {% endif %} + {% include '@partials/lpa-summary-details/lpa-details-combined-lpa.html.twig' %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% if iap_images.status is not constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %}
{% endif %} @@ -113,21 +108,19 @@ {% trans %}LPA details{% endtrans %} - {% if feature_enabled("instructions_and_preferences") %} - {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} + {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} - - {% endif %} + {% include '@partials/lpa-summary-details/lpa-details.html.twig' %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% if iap_images.status is not constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %}
{% trans %}If any scanned images are not readable, organisations may ask to see the paper LPA so that @@ -136,9 +129,7 @@ {% endif %} {% endif %} - {% if feature_enabled("instructions_and_preferences") %} - - {% endif %} +

diff --git a/service-front/app/src/Common/templates/partials/full-lpa-display-combined-lpa.html.twig b/service-front/app/src/Common/templates/partials/full-lpa-display-combined-lpa.html.twig index 7f8c0fb5ae..3ca6ce1808 100644 --- a/service-front/app/src/Common/templates/partials/full-lpa-display-combined-lpa.html.twig +++ b/service-front/app/src/Common/templates/partials/full-lpa-display-combined-lpa.html.twig @@ -108,14 +108,12 @@ {% trans %}LPA details{% endtrans %} - {% if feature_enabled("instructions_and_preferences") %} - {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} - - {% endif %} + {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} + {% include '@partials/lpa-summary-details/lpa-details-combined-lpa.html.twig' %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% if iap_images.status is not constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %}

{% trans %}If any scanned images are not readable, ask the person who gave you the access @@ -124,9 +122,7 @@ {% endif %} {% endif %} - {% if feature_enabled("instructions_and_preferences") %} - - {% endif %} +
diff --git a/service-front/app/src/Common/templates/partials/full-lpa-display.html.twig b/service-front/app/src/Common/templates/partials/full-lpa-display.html.twig index 58f9ea3cc8..84078134ae 100644 --- a/service-front/app/src/Common/templates/partials/full-lpa-display.html.twig +++ b/service-front/app/src/Common/templates/partials/full-lpa-display.html.twig @@ -108,14 +108,12 @@ {% trans %}LPA details{% endtrans %} - {% if feature_enabled("instructions_and_preferences") %} - {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} - - {% endif %} + {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %} + {% include '@partials/lpa-summary-details/lpa-details.html.twig' %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% if iap_images.status is not constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %}
{% trans %}If any scanned images are not readable, ask the person who gave you the access @@ -124,9 +122,7 @@ {% endif %} {% endif %} - {% if feature_enabled("instructions_and_preferences") %} - - {% endif %} +
diff --git a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details-combined-lpa.html.twig b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details-combined-lpa.html.twig index 590d4bd9cc..54734363e8 100644 --- a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details-combined-lpa.html.twig +++ b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details-combined-lpa.html.twig @@ -59,25 +59,9 @@
{{ lpa.uId }}
- {% if is_donor_signature_date_too_old(lpa) and (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) and not feature_enabled("instructions_and_preferences") %} -
-
{% trans %}Instructions and preferences{% endtrans %}
-
- {% trans %}Yes, the donor made preferences and/or instructions on their LPA.{% endtrans %} -
{% trans %}To view these, ask to see the paper LPA.{% endtrans %} -
-
- {% elseif is_donor_signature_date_too_old(lpa) and not (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) and not feature_enabled("instructions_and_preferences") %} -
-
{% trans %}Instructions and preferences{% endtrans %}
-
- {% trans %}No{% endtrans %} -
-
- {% else %} {# Instructions and Preferences are split OR I&P images are enabled #} -
+
- {% if feature_enabled('instructions_and_preferences') and (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) %} + {% if lpa.applicationHasGuidance or lpa.applicationHasRestrictions %} {% if lpa.hasSeveranceWarning %}
@@ -99,7 +83,7 @@
{% trans %}Preferences{% endtrans %}
{% if lpa.applicationHasGuidance %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% trans %}Yes, the donor made preferences on their LPA.{% endtrans %} {% else %} {% trans %}Yes, the donor made preferences on their LPA.{% endtrans %} @@ -112,7 +96,7 @@
- {% if feature_enabled("instructions_and_preferences") and lpa.applicationHasGuidance and iap_images is defined %} + {% if lpa.applicationHasGuidance and iap_images is defined %} {% if iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %} {{ iap.preferences_error() }} {% elseif ((iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_IN_PROGRESS')) @@ -133,7 +117,7 @@
{% trans %}Instructions{% endtrans %}
{% if lpa.applicationHasRestrictions %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% trans %}Yes, the donor set instructions on their LPA.{% endtrans %} {% else %} {% trans %}Yes, the donor set instructions on their LPA.{% endtrans %} @@ -146,7 +130,7 @@
- {% if feature_enabled("instructions_and_preferences") and lpa.applicationHasRestrictions and iap_images is defined %} + {% if lpa.applicationHasRestrictions and iap_images is defined %} {% if iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %} {{ iap.instructions_error() }} {% elseif ((iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_IN_PROGRESS')) @@ -162,7 +146,7 @@ - {% if feature_enabled("instructions_and_preferences") and iap_images is defined and + {% if iap_images is defined and iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_COMPLETE') %} {% set unknown_images = iap_images.getUnknownImageUrls %} {% if (unknown_images | length) > 0 %} @@ -172,4 +156,3 @@ {% endif %} {% endif %} - {% endif %} diff --git a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details.html.twig b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details.html.twig index dd241bd94a..4351ce5ccb 100644 --- a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details.html.twig +++ b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details.html.twig @@ -59,25 +59,9 @@
{{ lpa.uId }}
- {% if is_donor_signature_date_too_old(lpa) and (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) and not feature_enabled("instructions_and_preferences") %} -
-
{% trans %}Preferences and instructions{% endtrans %}
-
- {% trans %}Yes, the donor made preferences and/or instructions on their LPA.{% endtrans %} -
{% trans %}To view these, ask to see the paper LPA.{% endtrans %} -
-
- {% elseif is_donor_signature_date_too_old(lpa) and not (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) and not feature_enabled("instructions_and_preferences") %} -
-
{% trans %}Preferences and Instructions{% endtrans %}
-
- {% trans %}No{% endtrans %} -
-
- {% else %} {# Instructions and Preferences are split OR I&P images are enabled #} - + - {% if feature_enabled('instructions_and_preferences') and (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) %} + {% if lpa.applicationHasGuidance or lpa.applicationHasRestrictions %} {% if lpa.hasSeveranceWarning %}
@@ -99,7 +83,7 @@
{% trans %}Preferences{% endtrans %}
{% if lpa.applicationHasGuidance %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% trans %}Yes, the donor made preferences on their LPA.{% endtrans %} {% else %} {% trans %}Yes, the donor made preferences on their LPA.{% endtrans %} @@ -112,7 +96,7 @@
- {% if feature_enabled("instructions_and_preferences") and lpa.applicationHasGuidance and iap_images is defined %} + {% if lpa.applicationHasGuidance and iap_images is defined %} {% if iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %} {{ iap.preferences_error() }} {% elseif ((iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_IN_PROGRESS')) @@ -133,7 +117,7 @@
{% trans %}Instructions{% endtrans %}
{% if lpa.applicationHasRestrictions %} - {% if feature_enabled("instructions_and_preferences") and iap_images is defined %} + {% if iap_images is defined %} {% trans %}Yes, the donor set instructions on their LPA.{% endtrans %} {% else %} {% trans %}Yes, the donor set instructions on their LPA.{% endtrans %} @@ -146,7 +130,7 @@
- {% if feature_enabled("instructions_and_preferences") and lpa.applicationHasRestrictions and iap_images is defined %} + {% if lpa.applicationHasRestrictions and iap_images is defined %} {% if iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %} {{ iap.instructions_error() }} {% elseif ((iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_IN_PROGRESS')) @@ -162,7 +146,7 @@ - {% if feature_enabled("instructions_and_preferences") and iap_images is defined and + {% if iap_images is defined and iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_COMPLETE') %} {% set unknown_images = iap_images.getUnknownImageUrls %} {% if (unknown_images | length) > 0 %} @@ -172,4 +156,3 @@ {% endif %} {% endif %} - {% endif %} diff --git a/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php b/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php index 7ead2a8bf3..b629932bd7 100644 --- a/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php +++ b/service-front/app/src/Viewer/src/Handler/DownloadLpaHandler.php @@ -52,7 +52,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface $lpa = $this->lpaService->getLpaByCode($code, $surname, null); $images = null; - if (($this->featureEnabled)('instructions_and_preferences') && $lpa->offsetExists('iap')) { + if ($lpa->offsetExists('iap')) { // TODO UML-2930 This date logic needs removing 30 days after 4th July (or whenever we go live, whichever // is later) // necessary for development. Do not uncomment for live environments. diff --git a/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php b/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php index 9a3b30dd36..55d1b55fc5 100644 --- a/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php +++ b/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php @@ -56,7 +56,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface 'lpa' => $lpaData->lpa, ]; - if (($this->featureEnabled)('instructions_and_preferences') && $lpaData->offsetExists('iap')) { + if ($lpaData->offsetExists('iap')) { $this->logger->info( 'Instructions and preferences images found for lpa {lpa_id} with state {state}', [ diff --git a/terraform/environment/region.tf b/terraform/environment/region.tf index 040384c2e7..1dffca588e 100644 --- a/terraform/environment/region.tf +++ b/terraform/environment/region.tf @@ -67,7 +67,6 @@ module "eu_west_1" { feature_flags = { "allow_gov_one_login" = local.environment.application_flags.allow_gov_one_login - "instructions_and_preferences" = local.environment.application_flags.instructions_and_preferences "allow_meris_lpas" = local.environment.application_flags.allow_meris_lpas "deploy_opentelemetry_sidecar" = local.environment.deploy_opentelemetry_sidecar "delete_lpa_feature" = local.environment.application_flags.delete_lpa_feature @@ -155,7 +154,6 @@ module "eu_west_2" { feature_flags = { "allow_gov_one_login" = local.environment.application_flags.allow_gov_one_login - "instructions_and_preferences" = local.environment.application_flags.instructions_and_preferences "allow_meris_lpas" = local.environment.application_flags.allow_meris_lpas "deploy_opentelemetry_sidecar" = local.environment.deploy_opentelemetry_sidecar "delete_lpa_feature" = local.environment.application_flags.delete_lpa_feature diff --git a/terraform/environment/region/api_ecs.tf b/terraform/environment/region/api_ecs.tf index 2e52274e5a..33077bb9a2 100644 --- a/terraform/environment/region/api_ecs.tf +++ b/terraform/environment/region/api_ecs.tf @@ -537,10 +537,6 @@ locals { name = "SUPPORT_DATASTORE_LPAS", value = tostring(var.feature_flags.support_datastore_lpas) }, - { - name = "INSTRUCTIONS_AND_PREFERENCES", - value = tostring(var.feature_flags.instructions_and_preferences) - }, { name = "ALLOW_GOV_ONE_LOGIN", value = tostring(var.feature_flags.allow_gov_one_login) diff --git a/terraform/environment/region/use_ecs.tf b/terraform/environment/region/use_ecs.tf index eeb905faaf..c209bd1351 100644 --- a/terraform/environment/region/use_ecs.tf +++ b/terraform/environment/region/use_ecs.tf @@ -360,10 +360,6 @@ locals { name = "ALLOW_MERIS_LPAS", value = tostring(var.feature_flags.allow_meris_lpas) }, - { - name = "INSTRUCTIONS_AND_PREFERENCES", - value = tostring(var.feature_flags.instructions_and_preferences) - }, { name = "ALLOW_GOV_ONE_LOGIN", value = tostring(var.feature_flags.allow_gov_one_login) diff --git a/terraform/environment/region/viewer_ecs.tf b/terraform/environment/region/viewer_ecs.tf index a970f0264c..ca1ae89053 100644 --- a/terraform/environment/region/viewer_ecs.tf +++ b/terraform/environment/region/viewer_ecs.tf @@ -326,10 +326,6 @@ locals { name = "BRUTE_FORCE_CACHE_TIMEOUT", value = "60" }, - { - name = "INSTRUCTIONS_AND_PREFERENCES", - value = tostring(var.feature_flags.instructions_and_preferences) - }, { name = "ALLOW_GOV_ONE_LOGIN", value = tostring(var.feature_flags.allow_gov_one_login) diff --git a/terraform/environment/terraform.tfvars.json b/terraform/environment/terraform.tfvars.json index ed2db73e0d..d8fc24c215 100644 --- a/terraform/environment/terraform.tfvars.json +++ b/terraform/environment/terraform.tfvars.json @@ -60,7 +60,6 @@ "use_older_lpa_journey": true, "delete_lpa_feature": true, "allow_meris_lpas": false, - "instructions_and_preferences": true, "allow_gov_one_login": true, "support_datastore_lpas": false }, @@ -159,7 +158,6 @@ "use_older_lpa_journey": true, "delete_lpa_feature": true, "allow_meris_lpas": false, - "instructions_and_preferences": true, "allow_gov_one_login": false, "support_datastore_lpas": false }, @@ -258,7 +256,6 @@ "use_older_lpa_journey": true, "delete_lpa_feature": true, "allow_meris_lpas": false, - "instructions_and_preferences": true, "allow_gov_one_login": true, "support_datastore_lpas": false }, @@ -357,7 +354,6 @@ "use_older_lpa_journey": true, "delete_lpa_feature": true, "allow_meris_lpas": false, - "instructions_and_preferences": true, "allow_gov_one_login": true, "support_datastore_lpas": false }, @@ -455,7 +451,6 @@ "use_older_lpa_journey": true, "delete_lpa_feature": true, "allow_meris_lpas": false, - "instructions_and_preferences": true, "allow_gov_one_login": true, "support_datastore_lpas": false }, diff --git a/terraform/environment/variables.tf b/terraform/environment/variables.tf index c95eb3611c..0c006272c0 100644 --- a/terraform/environment/variables.tf +++ b/terraform/environment/variables.tf @@ -79,12 +79,11 @@ variable "environments" { deploy_opentelemetry_sidecar = bool fargate_spot = bool application_flags = object({ - allow_gov_one_login = bool - use_older_lpa_journey = bool - delete_lpa_feature = bool - allow_meris_lpas = bool - instructions_and_preferences = bool - support_datastore_lpas = bool + allow_gov_one_login = bool + use_older_lpa_journey = bool + delete_lpa_feature = bool + allow_meris_lpas = bool + support_datastore_lpas = bool }) dynamodb_tables = object({ actor_codes = object({ From e4d0b8ff86f278ba4c832d4c7a1f8f2478d6bdb9 Mon Sep 17 00:00:00 2001 From: Jay Whitwell <72501756+jay-whitwell@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:00:27 +0000 Subject: [PATCH 06/11] UML-3727: fix typo and bump pdf service (#3000) Co-authored-by: Nick Davis <62664046+nickdavis2001@users.noreply.github.com> --- docker-compose.dependencies.yml | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.dependencies.yml b/docker-compose.dependencies.yml index 6bd21a0a52..4a66c84e19 100644 --- a/docker-compose.dependencies.yml +++ b/docker-compose.dependencies.yml @@ -97,7 +97,7 @@ services: # PDF Generator service-pdf: container_name: service-pdf - image: 311462405659.dkr.ecr.eu-west-1.amazonaws.com/pdf-service:v1.361.0 + image: 311462405659.dkr.ecr.eu-west-1.amazonaws.com/pdf-service:v1.371.0 ports: - 9004:80 diff --git a/docker-compose.yml b/docker-compose.yml index c413ae5311..93a3d828b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -270,7 +270,7 @@ services: event-reciever-lambda: container_name: event-reciever build: - context: ./lambda-functions/event-reciever + context: ./lambda-functions/event-receiver dockerfile: Dockerfile environment: ENVIRONMENT: local From 60a4906537c93c4fc409e182c4de590f82837f0f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:35:35 +0000 Subject: [PATCH 07/11] Renovate Update tj-actions/changed-files digest to ac47125 (#3001) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/path-to-live.yml | 2 +- .github/workflows/pull-request-path.yml | 6 +++--- .github/workflows/workflow-deploy-ref-to-env.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/path-to-live.yml b/.github/workflows/path-to-live.yml index 4273b5e8b0..3fefb02532 100644 --- a/.github/workflows/path-to-live.yml +++ b/.github/workflows/path-to-live.yml @@ -39,7 +39,7 @@ jobs: - name: get changed docs files in any folder id: changed-files-docs - uses: tj-actions/changed-files@ef3b6f1fa5eccdc95d915ec0f87a16535a73d0ca + uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f with: files: | **/*.md diff --git a/.github/workflows/pull-request-path.yml b/.github/workflows/pull-request-path.yml index f3ed29ae4f..a919967e12 100644 --- a/.github/workflows/pull-request-path.yml +++ b/.github/workflows/pull-request-path.yml @@ -50,19 +50,19 @@ jobs: - name: get changed files in the admin folder id: changed-files-admin - uses: tj-actions/changed-files@ef3b6f1fa5eccdc95d915ec0f87a16535a73d0ca + uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f with: files: | service-admin/** - name: get changed files in the terraform folder id: changed-files-terraform - uses: tj-actions/changed-files@ef3b6f1fa5eccdc95d915ec0f87a16535a73d0ca + uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f with: files: | terraform/** - name: get changed docs files in any folder id: changed-files-docs - uses: tj-actions/changed-files@ef3b6f1fa5eccdc95d915ec0f87a16535a73d0ca + uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f with: files: | **/*.md diff --git a/.github/workflows/workflow-deploy-ref-to-env.yml b/.github/workflows/workflow-deploy-ref-to-env.yml index a5ac395621..beeddf417d 100644 --- a/.github/workflows/workflow-deploy-ref-to-env.yml +++ b/.github/workflows/workflow-deploy-ref-to-env.yml @@ -60,13 +60,13 @@ jobs: - name: get changed files in the admin folder id: changed-files-admin - uses: tj-actions/changed-files@ef3b6f1fa5eccdc95d915ec0f87a16535a73d0ca + uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f with: files: | service-admin/** - name: get changed files in the terraform folder id: changed-files-terraform - uses: tj-actions/changed-files@ef3b6f1fa5eccdc95d915ec0f87a16535a73d0ca + uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f with: files: | terraform/** From 0370deeb4c009c579caec49475acada4fec76557 Mon Sep 17 00:00:00 2001 From: Jay Whitwell <72501756+jay-whitwell@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:06:37 +0000 Subject: [PATCH 08/11] UML-3762: ensure end of workflow runs (#2998) * UML-3762: ensure end of workflow runs * update name --------- Co-authored-by: Nick Davis <62664046+nickdavis2001@users.noreply.github.com> --- .github/workflows/path-to-live.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/path-to-live.yml b/.github/workflows/path-to-live.yml index 3fefb02532..dc7fe4a428 100644 --- a/.github/workflows/path-to-live.yml +++ b/.github/workflows/path-to-live.yml @@ -282,13 +282,18 @@ jobs: name: end of workflow runs-on: ubuntu-latest needs: - - code_coverage - - slack_notify - - production_health_check - workflow_variables + - slack_notify steps: - - name: workflow has ended without issue + - name: workflow has ended run: | - echo "Deployment to production successful" - echo "Tag Used: main-${{ needs.workflow_variables.outputs.semver_tag }}" - echo "URL: https://use-lasting-power-of-attorney.service.gov.uk" + if ${{ contains(needs.slack_notify.result, 'success') }}; then + echo "Deployment to production successful" + echo "Tag Used: main-${{ needs.workflow_variables.outputs.semver_tag }}" + echo "URL: https://use-lasting-power-of-attorney.service.gov.uk + exit 0 + else + echo "Deployment to production failed" + exit 1 + fi + if: always() From c1047bf95b9ec4428fab264cb0a1ff8310050cad Mon Sep 17 00:00:00 2001 From: Allen Annom <49309320+allenannom@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:47:52 +0000 Subject: [PATCH 09/11] Uml 3723 golang lambda to run in localstack (#3003) * UML-3619 Convert incoming LPAs to combined format (repository layer) * UML-3723 running event receiver in localstack with the use of make up --- docker-compose.yml | 14 ++++++++++--- lambda-functions/event-receiver/Dockerfile | 7 ++++--- lambda-functions/event-receiver/README.md | 22 ++++++++++++++++++++ lambda-functions/event-receiver/app/main.go | 0 lambda-functions/upload-statistics/README.md | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 lambda-functions/event-receiver/README.md mode change 100644 => 100755 lambda-functions/event-receiver/app/main.go diff --git a/docker-compose.yml b/docker-compose.yml index 93a3d828b7..ab22779ffc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -257,6 +257,8 @@ services: REGION: eu-west-1 AWS_ACCESS_KEY_ID: 'devkey' AWS_SECRET_ACCESS_KEY: 'secretdevkey' + depends_on: + - localstack volumes: - ./lambda-functions/upload-statistics/app:/function/app - ./lambda-functions/.aws-lambda-rie:/aws-lambda @@ -267,19 +269,25 @@ services: # --------------------------- # Lambda for ingestion from MLPA - event-reciever-lambda: - container_name: event-reciever + event-receiver-lambda: + container_name: event-receiver build: context: ./lambda-functions/event-receiver dockerfile: Dockerfile environment: + AWS_LAMBDA_SERVER_PORT: '8080' + AWS_LAMBDA_RUNTIME_API: 'localhost:8080' ENVIRONMENT: local REGION: eu-west-1 AWS_ACCESS_KEY_ID: 'devkey' AWS_SECRET_ACCESS_KEY: 'secretdevkey' volumes: - - ./lambda-functions/event-reciever/app:/function/app + - ./lambda-functions/event-receiver/app:/function/app - ./lambda-functions/.aws-lambda-rie:/aws-lambda + entrypoint: + - /aws-lambda/aws-lambda-rie + command: + - ./main ports: - 9008:8080 diff --git a/lambda-functions/event-receiver/Dockerfile b/lambda-functions/event-receiver/Dockerfile index e065e01c3b..da12438023 100644 --- a/lambda-functions/event-receiver/Dockerfile +++ b/lambda-functions/event-receiver/Dockerfile @@ -7,11 +7,12 @@ COPY go.mod go.sum ./ RUN go mod download COPY app/ ./ - RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /go/bin/ingestion ./ FROM scratch AS production -COPY --from=base /go/bin/ingestion ingestion +WORKDIR /var/task + +COPY --from=base /go/bin/ingestion ./main -ENTRYPOINT ["./ingestion"] +ENTRYPOINT ["./main"] diff --git a/lambda-functions/event-receiver/README.md b/lambda-functions/event-receiver/README.md new file mode 100644 index 0000000000..7ad1fa19db --- /dev/null +++ b/lambda-functions/event-receiver/README.md @@ -0,0 +1,22 @@ +# Event Receiver + +The stats table is uploaded with historical stats from csv by a one time run script. + +This uploads to the stats table, the Cloudwatch Metric Statistics about the use of the Use a Lasting Power of Attorney service. + +### Testing the lambda image locally + +As the lambda is built from an image, this can be spun up to test in dev environment. + +Bring up the lambda locally + +``` +make build +``` + +# To test lambda +The curl follows a set command to invoke lambda functions as below + +``` +curl -XPOST "http://localhost:9008/2015-03-31/functions/function/invocations" -d '{}' +``` \ No newline at end of file diff --git a/lambda-functions/event-receiver/app/main.go b/lambda-functions/event-receiver/app/main.go old mode 100644 new mode 100755 diff --git a/lambda-functions/upload-statistics/README.md b/lambda-functions/upload-statistics/README.md index 085d35cd3b..ec7b6a042c 100644 --- a/lambda-functions/upload-statistics/README.md +++ b/lambda-functions/upload-statistics/README.md @@ -13,7 +13,7 @@ By default the script uses a mock JSON response object instead of pulling from a Bring up the lambda locally ``` -make build_all +make build ``` # To test lambda From b939b9884aa534bb931430f6addcacf6bb45261a Mon Sep 17 00:00:00 2001 From: Jay Whitwell <72501756+jay-whitwell@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:15:52 +0000 Subject: [PATCH 10/11] UML-3762: ensure end of workflow runs (#3004) --- .github/workflows/path-to-live.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/path-to-live.yml b/.github/workflows/path-to-live.yml index dc7fe4a428..1a02b9047f 100644 --- a/.github/workflows/path-to-live.yml +++ b/.github/workflows/path-to-live.yml @@ -290,7 +290,7 @@ jobs: if ${{ contains(needs.slack_notify.result, 'success') }}; then echo "Deployment to production successful" echo "Tag Used: main-${{ needs.workflow_variables.outputs.semver_tag }}" - echo "URL: https://use-lasting-power-of-attorney.service.gov.uk + echo "URL: https://use-lasting-power-of-attorney.service.gov.uk" exit 0 else echo "Deployment to production failed" From c7b17d08258febfb04e6f746a9d28a1885614daa Mon Sep 17 00:00:00 2001 From: Jay Whitwell <72501756+jay-whitwell@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:07:36 +0000 Subject: [PATCH 11/11] UML-3767: reduce lambda memory (#3005) * UML-3767: move lambda to environment * remove old files * add event receiver repo * update readme * change architecture to amd64 * reduce memory --- lambda-functions/event-receiver/Dockerfile | 4 ++-- lambda-functions/event-receiver/README.md | 6 ++---- terraform/account/region.tf | 2 -- terraform/account/region/lambda_functions.tf | 19 ------------------- terraform/account/region/variables.tf | 4 ---- terraform/account/variables.tf | 1 - terraform/environment/lambda.tf | 15 +++++++++++++++ terraform/environment/shared_data_sources.tf | 6 +++++- 8 files changed, 24 insertions(+), 33 deletions(-) diff --git a/lambda-functions/event-receiver/Dockerfile b/lambda-functions/event-receiver/Dockerfile index da12438023..88e21063a2 100644 --- a/lambda-functions/event-receiver/Dockerfile +++ b/lambda-functions/event-receiver/Dockerfile @@ -7,12 +7,12 @@ COPY go.mod go.sum ./ RUN go mod download COPY app/ ./ -RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /go/bin/ingestion ./ +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /go/bin/main ./ FROM scratch AS production WORKDIR /var/task -COPY --from=base /go/bin/ingestion ./main +COPY --from=base /go/bin/main ./main ENTRYPOINT ["./main"] diff --git a/lambda-functions/event-receiver/README.md b/lambda-functions/event-receiver/README.md index 7ad1fa19db..a003841301 100644 --- a/lambda-functions/event-receiver/README.md +++ b/lambda-functions/event-receiver/README.md @@ -1,8 +1,6 @@ # Event Receiver -The stats table is uploaded with historical stats from csv by a one time run script. - -This uploads to the stats table, the Cloudwatch Metric Statistics about the use of the Use a Lasting Power of Attorney service. +This Lambda function will process events from the new Event Receiver EventBus which processes events from MLPAB. ### Testing the lambda image locally @@ -19,4 +17,4 @@ The curl follows a set command to invoke lambda functions as below ``` curl -XPOST "http://localhost:9008/2015-03-31/functions/function/invocations" -d '{}' -``` \ No newline at end of file +``` diff --git a/terraform/account/region.tf b/terraform/account/region.tf index 0b1ab52531..95134198be 100644 --- a/terraform/account/region.tf +++ b/terraform/account/region.tf @@ -8,7 +8,6 @@ module "eu_west_1" { environment_name = local.environment lambda_container_version = var.lambda_container_version vpc_flow_logs_iam_role = aws_iam_role.vpc_flow_logs - event_receiver_enabled = true depends_on = [ module.cloudwatch_mrk, @@ -36,7 +35,6 @@ module "eu_west_2" { environment_name = local.environment lambda_container_version = var.lambda_container_version vpc_flow_logs_iam_role = aws_iam_role.vpc_flow_logs - event_receiver_enabled = false depends_on = [ module.cloudwatch_mrk, diff --git a/terraform/account/region/lambda_functions.tf b/terraform/account/region/lambda_functions.tf index 93cef568f8..54ccc75065 100644 --- a/terraform/account/region/lambda_functions.tf +++ b/terraform/account/region/lambda_functions.tf @@ -8,25 +8,6 @@ data "aws_ecr_repository" "ship_to_opg_metrics" { provider = aws.management } -data "aws_ecr_repository" "event_receiver_repo" { - name = "use_an_lpa/event_receiver" - provider = aws.management -} - -module "event_receiver" { - count = var.event_receiver_enabled ? 1 : 0 - source = "./modules/lambda_function" - lambda_name = "event-receiver-${var.account_name}" - working_directory = "/" - image_uri = "${data.aws_ecr_repository.event_receiver_repo.repository_url}:${var.lambda_container_version}" - ecr_arn = data.aws_ecr_repository.event_receiver_repo.arn - aws_cloudwatch_log_group_kms_key_id = data.aws_kms_alias.cloudwatch_mrk.arn - - providers = { - aws = aws.region - } -} - module "clsf_to_sqs" { source = "./modules/lambda_function" count = var.account.opg_metrics.enabled ? 1 : 0 diff --git a/terraform/account/region/variables.tf b/terraform/account/region/variables.tf index 4c4c6c1244..c4b74482c7 100644 --- a/terraform/account/region/variables.tf +++ b/terraform/account/region/variables.tf @@ -37,10 +37,6 @@ variable "environment_name" { type = string } -variable "event_receiver_enabled" { - description = "Enable the event receiver Lambda" - type = bool -} variable "lambda_container_version" { description = "The version of the lambda container" type = string diff --git a/terraform/account/variables.tf b/terraform/account/variables.tf index 4016ec2c48..4fa2fbcc43 100644 --- a/terraform/account/variables.tf +++ b/terraform/account/variables.tf @@ -20,7 +20,6 @@ variable "accounts" { account_id = string cloudwatch_application_insights_enabled = bool shared_account_id = number - event_receiver_enabled = bool is_production = bool retention_in_days = number pagerduty_service_name = string diff --git a/terraform/environment/lambda.tf b/terraform/environment/lambda.tf index 826c68da17..ea0f2c21fa 100644 --- a/terraform/environment/lambda.tf +++ b/terraform/environment/lambda.tf @@ -87,3 +87,18 @@ resource "aws_lambda_permission" "cloudwatch_to_update_statistics_lambda" { principal = "events.amazonaws.com" source_arn = aws_cloudwatch_event_rule.update_statistics.arn } + +module "event_receiver" { + source = "./modules/lambda" + lambda_name = "event-receiver" + environment_variables = { + ENVIRONMENT = local.environment_name + REGION = data.aws_region.current.name + } + image_uri = "${data.aws_ecr_repository.use_an_lpa_event_receiver.repository_url}:${var.container_version}" + ecr_arn = data.aws_ecr_repository.use_an_lpa_upload_statistics.arn + environment = local.environment_name + kms_key = data.aws_kms_alias.cloudwatch_encryption.target_key_arn + timeout = 900 + memory = 128 +} diff --git a/terraform/environment/shared_data_sources.tf b/terraform/environment/shared_data_sources.tf index f86c33046e..c55ab490df 100644 --- a/terraform/environment/shared_data_sources.tf +++ b/terraform/environment/shared_data_sources.tf @@ -10,6 +10,11 @@ data "aws_ecr_repository" "use_an_lpa_upload_statistics" { name = "use_an_lpa/stats_upload_lambda" } +data "aws_ecr_repository" "use_an_lpa_event_receiver" { + provider = aws.management + name = "use_an_lpa/event_receiver" +} + data "aws_ecr_repository" "mock_onelogin" { provider = aws.management name = "mock-onelogin" @@ -18,4 +23,3 @@ data "aws_ecr_repository" "mock_onelogin" { module "allow_list" { source = "git@github.com:ministryofjustice/terraform-aws-moj-ip-allow-list.git?ref=v2.3.0" } -