Skip to content

Commit 1bd04df

Browse files
committed
init: move
1 parent 65617e0 commit 1bd04df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+103
-87
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ version: 2
77
updates:
88
- package-ecosystem: "docker"
99
directories:
10+
- "/infrastructure/grafana/non-prod/docker"
1011
- "/lambdas/ack_backend"
1112
- "/lambdas/delta_backend"
12-
- "/filenameprocessor"
13-
- "/infrastructure/grafana/non-prod/docker"
13+
- "/lambdas/filenameprocessor"
1414
- "/mesh_processor"
1515
- "/recordprocessor"
1616
- "/sandbox"
@@ -50,17 +50,17 @@ updates:
5050
- "/"
5151
- "/backend"
5252
- "/batch_processor_filter"
53-
- "/tests/e2e"
54-
- "/tests/e2e_batch"
55-
- "/filenameprocessor"
5653
- "/mesh_processor"
5754
- "/recordprocessor"
5855
- "/lambdas/ack_backend"
5956
- "/lambdas/delta_backend"
60-
- "/lambdas/redis_sync"
57+
- "/lambdas/filenameprocessor"
6158
- "/lambdas/id_sync"
6259
- "/lambdas/mns_subscription"
60+
- "/lambdas/redis_sync"
6361
- "/lambdas/shared"
62+
- "/tests/e2e"
63+
- "/tests/e2e_batch"
6464
schedule:
6565
interval: "daily"
6666
open-pull-requests-limit: 1

.github/workflows/quality-checks.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,6 @@ jobs:
9797
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
9898
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
9999
100-
- name: Run unittest with filenameprocessor-coverage
101-
working-directory: filenameprocessor
102-
id: filenameprocessor
103-
continue-on-error: true
104-
run: |
105-
poetry install
106-
poetry run coverage run -m unittest discover || echo "filenameprocessor tests failed" >> ../failed_tests.txt
107-
poetry run coverage xml -o ../filenameprocessor-coverage.xml
108-
109100
- name: Run unittest with batchprocessorfilter-coverage
110101
working-directory: batch_processor_filter
111102
id: batchprocessorfilter
@@ -182,6 +173,28 @@ jobs:
182173
poetry run coverage run -m unittest discover || echo "delta tests failed" >> ../../failed_tests.txt
183174
poetry run coverage xml -o ../../delta-coverage.xml
184175
176+
- name: Run unittest with filenameprocessor-coverage
177+
working-directory: lambdas/filenameprocessor
178+
id: filenameprocessor
179+
env:
180+
PYTHONPATH: ${{ env.LAMBDA_PATH }}/filenameprocessor/src:${{ env.LAMBDA_PATH }}/filenameprocessor/tests:${{ env.SHARED_PATH }}/src
181+
continue-on-error: true
182+
run: |
183+
poetry install
184+
poetry run coverage run -m unittest discover || echo "filenameprocessor tests failed" >> ../../failed_tests.txt
185+
poetry run coverage xml -o ../../filenameprocessor-coverage.xml
186+
187+
- name: Run unittest with id_sync
188+
working-directory: lambdas/id_sync
189+
id: id_sync
190+
env:
191+
PYTHONPATH: ${{ env.LAMBDA_PATH }}/id_sync/src:${{ env.LAMBDA_PATH }}/id_sync/tests:${{ env.SHARED_PATH }}/src
192+
continue-on-error: true
193+
run: |
194+
poetry install
195+
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover || echo "id_sync tests failed" >> ../../failed_tests.txt
196+
poetry run coverage xml -o ../../id_sync-coverage.xml
197+
185198
- name: Run unittest with coverage-mns-subscription
186199
working-directory: lambdas/mns_subscription
187200
id: mns_subscription
@@ -216,17 +229,6 @@ jobs:
216229
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover -s tests -p "test_*.py" -v || echo "shared tests failed" >> ../../failed_tests.txt
217230
poetry run coverage xml -o ../../shared-coverage.xml
218231
219-
- name: Run unittest with id_sync
220-
working-directory: lambdas/id_sync
221-
id: id_sync
222-
env:
223-
PYTHONPATH: ${{ env.LAMBDA_PATH }}/id_sync/src:${{ env.LAMBDA_PATH }}/id_sync/tests:${{ env.SHARED_PATH }}/src
224-
continue-on-error: true
225-
run: |
226-
poetry install
227-
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover || echo "id_sync tests failed" >> ../../failed_tests.txt
228-
poetry run coverage xml -o ../../id_sync-coverage.xml
229-
230232
- name: Run Test Failure Summary
231233
id: check_failure
232234
run: |

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL=/usr/bin/env bash -euo pipefail
22

3-
PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS = backend batch_processor_filter filenameprocessor mesh_processor recordprocessor lambdas/ack_backend lambdas/delta_backend lambdas/redis_sync lambdas/id_sync lambdas/mns_subscription lambdas/shared
3+
PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS = backend batch_processor_filter mesh_processor recordprocessor lambdas/ack_backend lambdas/delta_backend lambdas/filenameprocessor lambdas/id_sync lambdas/mns_subscription lambdas/redis_sync lambdas/shared
44
PYTHON_PROJECT_DIRS = tests/e2e tests/e2e_batch quality_checks $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS)
55

66
.PHONY: install lint format format-check clean publish build-proxy release initialise-all-python-venvs update-all-python-dependencies run-all-python-unit-tests build-all-docker-images

filenameprocessor/Dockerfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

filenameprocessor/Makefile

Lines changed: 0 additions & 20 deletions
This file was deleted.

immunisation-fhir-api.code-workspace

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@
77
"path": "backend",
88
},
99
{
10-
"path": "filenameprocessor",
10+
"path": "mesh_processor",
1111
},
1212
{
1313
"path": "recordprocessor",
1414
},
1515
{
16-
"path": "mesh_processor",
16+
"path": "lambdas/ack_backend",
1717
},
1818
{
19-
"path": "tests/e2e",
19+
"path": "lambdas/delta_backend",
2020
},
2121
{
22-
"path": "tests/e2e_batch",
22+
"path": "lambdas/filenameprocessor",
2323
},
2424
{
25-
"path": "lambdas/ack_backend",
25+
"path": "lambdas/id_sync",
2626
},
2727
{
28-
"path": "lambdas/delta_backend",
28+
"path": "lambdas/mns_subscription",
2929
},
3030
{
3131
"path": "lambdas/redis_sync",
3232
},
3333
{
34-
"path": "lambdas/id_sync",
34+
"path": "lambdas/shared",
3535
},
3636
{
37-
"path": "lambdas/mns_subscription",
37+
"path": "tests/e2e",
3838
},
3939
{
40-
"path": "lambdas/shared",
40+
"path": "tests/e2e_batch",
4141
},
4242
],
4343
"settings": {},

infrastructure/instance/file_name_processor.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Define the directory containing the Docker image and calculate its SHA-256 hash for triggering redeployments
22
locals {
3-
filename_lambda_dir = abspath("${path.root}/../../filenameprocessor")
3+
filename_lambda_dir = abspath("${path.root}/../../lambdas/filenameprocessor")
44
filename_lambda_files = fileset(local.filename_lambda_dir, "**")
55
filename_lambda_dir_sha = sha1(join("", [for f in local.filename_lambda_files : filesha1("${local.filename_lambda_dir}/${f}")]))
66
}
77

8-
98
resource "aws_ecr_repository" "file_name_processor_lambda_repository" {
109
image_scanning_configuration {
1110
scan_on_push = true
@@ -18,6 +17,7 @@ resource "aws_ecr_repository" "file_name_processor_lambda_repository" {
1817
module "file_processor_docker_image" {
1918
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
2019
version = "8.1.0"
20+
docker_file_path = "./filenameprocessor/Dockerfile"
2121

2222
create_ecr_repo = false
2323
ecr_repo = aws_ecr_repository.file_name_processor_lambda_repository.name
@@ -40,9 +40,10 @@ module "file_processor_docker_image" {
4040

4141
platform = "linux/amd64"
4242
use_image_tag = false
43-
source_path = local.filename_lambda_dir
43+
source_path = abspath("${path.root}/../../lambdas")
4444
triggers = {
45-
dir_sha = local.filename_lambda_dir_sha
45+
dir_sha = local.filename_lambda_dir_sha
46+
shared_dir_sha = local.shared_dir_sha
4647
}
4748
}
4849

lambdas/delta_backend/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ RUN mkdir -p /home/appuser && \
77
chown -R 1001:1001 /home/appuser && pip install "poetry~=2.1.4"
88

99
# Install Poetry dependencies
10-
# Copy ack_backend Poetry files
10+
# Copy delta_backend Poetry files
1111
COPY ./delta_backend/poetry.lock ./delta_backend/pyproject.toml ./delta_backend/README.md ./
1212

13-
# Install ack_backend dependencies
13+
# Install delta_backend dependencies
1414
WORKDIR /var/task
1515
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main
1616

File renamed without changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM public.ecr.aws/lambda/python:3.11 AS base
2+
3+
# Create non-root user
4+
RUN mkdir -p /home/appuser && \
5+
echo 'appuser:x:1001:1001::/home/appuser:/sbin/nologin' >> /etc/passwd && \
6+
echo 'appuser:x:1001:' >> /etc/group && \
7+
chown -R 1001:1001 /home/appuser && pip install "poetry~=2.1.4"
8+
9+
# Install Poetry dependencies
10+
# Copy filenameprocessor Poetry files
11+
COPY ./filenameprocessor/poetry.lock ./filenameprocessor/pyproject.toml ./filenameprocessor/README.md ./
12+
13+
# Install filenameprocessor dependencies
14+
WORKDIR /var/task
15+
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main
16+
17+
# -----------------------------
18+
FROM base AS build
19+
20+
# Set working directory back to Lambda task root
21+
WORKDIR /var/task
22+
23+
# Copy shared source code
24+
COPY ./shared/src/common ./common
25+
26+
# Copy filenameprocessor source code
27+
COPY ./filenameprocessor/src .
28+
29+
# Set correct permissions
30+
RUN chmod 644 $(find . -type f) && chmod 755 $(find . -type d)
31+
32+
# Switch to the non-root user for running the container
33+
USER 1001:1001
34+
35+
# Set the Lambda handler
36+
CMD ["file_name_processor.lambda_handler"]

0 commit comments

Comments
 (0)