Skip to content

Commit

Permalink
Merge branch 'main' into UML-3750-unable-to-request-activation
Browse files Browse the repository at this point in the history
  • Loading branch information
allenannom authored Dec 16, 2024
2 parents 33a7843 + c7b17d0 commit 6bbe9b0
Show file tree
Hide file tree
Showing 54 changed files with 247 additions and 473 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/_build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- name: ecr login
id: login_ecr
uses: aws-actions/amazon-ecr-login@37b726ebcaba9d1c1838caf54540902bad814823 # [email protected]
uses: aws-actions/amazon-ecr-login@b06ccd195086ba5254c95c627ee1cbeab86c7432 # [email protected]
with:
registries: 311462405659
if: |
Expand Down Expand Up @@ -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)

Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/path-to-live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ 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
uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f
with:
files: |
**/*.md
Expand Down Expand Up @@ -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 }}
Expand All @@ -281,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()
6 changes: 3 additions & 3 deletions .github/workflows/pull-request-path.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/workflow-deploy-ref-to-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
33 changes: 28 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -194,7 +190,6 @@ services:

# Feature flags
ALLOW_MERIS_LPAS: "false"
INSTRUCTIONS_AND_PREFERENCES: "true"
ALLOW_GOV_ONE_LOGIN: "true"
SUPPORT_DATASTORE_LPAS: "false"

Expand Down Expand Up @@ -262,12 +257,40 @@ 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
ports:
- 9007:8080


# ---------------------------
# Lambda for ingestion from MLPA

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-receiver/app:/function/app
- ./lambda-functions/.aws-lambda-rie:/aws-lambda
entrypoint:
- /aws-lambda/aws-lambda-rie
command:
- ./main
ports:
- 9008:8080

proxy:
container_name: proxy
image: traefik:3.0
Expand Down
8 changes: 4 additions & 4 deletions docs/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <small>(**tick/delete or ~~strikethrough~~** as appropriate)</small>

* [ ] 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
Expand Down
18 changes: 18 additions & 0 deletions lambda-functions/event-receiver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.23.1-alpine AS base

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download

COPY app/ ./
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/main ./main

ENTRYPOINT ["./main"]
20 changes: 20 additions & 0 deletions lambda-functions/event-receiver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Event Receiver

This Lambda function will process events from the new Event Receiver EventBus which processes events from MLPAB.

### 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 '{}'
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions lambda-functions/ingestion-lambda/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion lambda-functions/upload-statistics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions service-api/app/config/autoload/features.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion service-api/app/features/actor-view-lpa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 15 additions & 17 deletions service-api/app/features/context/Acceptance/ViewerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
38 changes: 17 additions & 21 deletions service-api/app/features/context/Integration/ViewerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,34 +173,30 @@ 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);

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);
}

/**
Expand Down
Loading

0 comments on commit 6bbe9b0

Please sign in to comment.