Skip to content

Commit aeceaf4

Browse files
authored
Merge branch 'master' into ved-318-multiple-entries-system-site-route
2 parents 01ac688 + 639b3c5 commit aeceaf4

22 files changed

Lines changed: 558 additions & 818 deletions

.github/workflows/deploy-backend.yml

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
lambda_build_flags:
1010
description: >
1111
JSON map of lambda_name -> force-build flag.
12-
e.g. {"recordprocessor":true,"ack-backend":false}
12+
e.g. {"backend":true,"recordprocessor":true,"ack-backend":false}
1313
required: false
1414
type: string
1515
default: "{}"
@@ -73,14 +73,14 @@ on:
7373
lambda_build_flags:
7474
description: >
7575
JSON map of lambda_name -> force-build flag.
76-
e.g. {"recordprocessor":true,"ack-backend":false}
76+
e.g. {"backend":true,"recordprocessor":true,"ack-backend":false}
7777
required: false
7878
type: string
7979
default: "{}"
8080
lambda_image_overrides:
8181
description: >
8282
JSON map of lambda_name -> immutable image selector for reuse mode.
83-
e.g. {"recordprocessor":"internal-dev-git-abc123","ack-backend":"123456789012.dkr.ecr.eu-west-2.amazonaws.com/imms-ackbackend-repo@sha256:..."}
83+
e.g. {"backend":"internal-dev-git-abc123","ack-backend":"123456789012.dkr.ecr.eu-west-2.amazonaws.com/imms-ackbackend-repo@sha256:..."}
8484
required: false
8585
type: string
8686
default: "{}"
@@ -118,34 +118,54 @@ jobs:
118118
fail-fast: false
119119
matrix:
120120
include:
121+
- lambda_name: backend
122+
ecr_repository: imms-backend-repo
123+
lambda_dir: backend
124+
- lambda_name: batch_processor_filter
125+
ecr_repository: imms-batch-processor-filter-repo
126+
lambda_dir: batch_processor_filter
127+
- lambda_name: delta_backend
128+
ecr_repository: imms-delta-backend-repo
129+
lambda_dir: delta_backend
130+
- lambda_name: filenameprocessor
131+
ecr_repository: imms-filenameprocessor-repo
132+
lambda_dir: filenameprocessor
133+
- lambda_name: id_sync
134+
ecr_repository: imms-id-sync-repo
135+
lambda_dir: id_sync
136+
- lambda_name: mesh_processor
137+
ecr_repository: imms-mesh-processor-repo
138+
lambda_dir: mesh_processor
139+
- lambda_name: mns_publisher
140+
ecr_repository: imms-mns-publisher-repo
141+
lambda_dir: mns_publisher
142+
- lambda_name: recordforwarder
143+
ecr_repository: imms-recordforwarder-repo
144+
lambda_dir: recordforwarder
145+
- lambda_name: redis_sync
146+
ecr_repository: imms-redis-sync-repo
147+
lambda_dir: redis_sync
121148
- lambda_name: recordprocessor
122-
tf_var_suffix: recordprocessor
123149
ecr_repository: imms-recordprocessor-repo
124-
dockerfile_path: lambdas/recordprocessor/Dockerfile
125-
lambda_paths: |
126-
lambdas/recordprocessor/
150+
lambda_dir: recordprocessor
127151
- lambda_name: ack-backend
128-
tf_var_suffix: ack_backend
129152
ecr_repository: imms-ackbackend-repo
130-
dockerfile_path: lambdas/ack_backend/Dockerfile
131-
lambda_paths: |
132-
lambdas/ack_backend/
153+
lambda_dir: ack_backend
133154
uses: ./.github/workflows/deploy-lambda-artifact.yml
134155
with:
135156
lambda_name: ${{ matrix.lambda_name }}
136-
tf_var_suffix: ${{ matrix.tf_var_suffix }}
157+
tf_var_suffix: ${{ matrix.lambda_dir }}
137158
environment: ${{ inputs.environment }}
138159
sub_environment: ${{ inputs.sub_environment }}
139160
build_image: ${{ fromJson(inputs.lambda_build_flags)[matrix.lambda_name] || false }}
140161
image_version: ${{ fromJson(inputs.lambda_image_overrides)[matrix.lambda_name] || '' }}
141162
run_diff_check: ${{ inputs.run_diff_check }}
142163
diff_base_sha: ${{ inputs.diff_base_sha }}
143164
diff_head_sha: ${{ inputs.diff_head_sha }}
144-
lambda_paths: ${{ matrix.lambda_paths }}
145-
shared_paths: |
146-
lambdas/shared/src/common/
165+
lambda_paths: lambdas/${{ matrix.lambda_dir }}/
166+
shared_paths: lambdas/shared/src/common/
147167
docker_context_path: lambdas
148-
dockerfile_path: ${{ matrix.dockerfile_path }}
168+
dockerfile_path: lambdas/${{ matrix.lambda_dir }}/Dockerfile
149169
ecr_repository: ${{ matrix.ecr_repository }}
150170
image_tag_prefix: ${{ inputs.sub_environment }}-
151171
allow_implicit_tag_prefix_reuse: ${{ inputs.sub_environment == 'internal-dev' || startsWith(inputs.sub_environment, 'pr-') }}
@@ -159,7 +179,6 @@ jobs:
159179
if: ${{ !cancelled() && needs.deploy-lambda-images.result == 'success' }}
160180
outputs:
161181
image_uris_json: ${{ steps.lambda-images.outputs.image_uris_json }}
162-
terraform_image_uris_json: ${{ steps.lambda-images.outputs.terraform_image_uris_json }}
163182
runs-on: ubuntu-latest
164183
environment:
165184
name: ${{ inputs.environment }}
@@ -218,17 +237,11 @@ jobs:
218237
"${manifest_files[@]}"
219238
)"
220239
221-
terraform_image_uris_json="$(
222-
jq -cs 'map(select(.tf_var_suffix != null and .tf_var_suffix != "" and .image_uri != null) | {(.tf_var_suffix): .image_uri}) | add' \
223-
"${manifest_files[@]}"
224-
)"
225-
226240
echo "image_uris_json=${image_uris_json}" >> "$GITHUB_OUTPUT"
227-
echo "terraform_image_uris_json=${terraform_image_uris_json}" >> "$GITHUB_OUTPUT"
228241
jq -er '
229-
to_entries[]
230-
| "TF_VAR_\(.key)_image_uri=\(.value)"
231-
' <<< "${terraform_image_uris_json}" >> "$GITHUB_ENV"
242+
select(.tf_var_suffix != null and .tf_var_suffix != "" and .image_uri != null)
243+
| "TF_VAR_\(.tf_var_suffix)_image_uri=\(.image_uri)"
244+
' "${manifest_files[@]}" >> "$GITHUB_ENV"
232245
233246
- name: Terraform Init
234247
working-directory: infrastructure/instance
@@ -270,22 +283,6 @@ jobs:
270283
with:
271284
terraform_version: "1.12.2"
272285

273-
- name: Restore lambda image Terraform vars
274-
env:
275-
TERRAFORM_IMAGE_URIS_JSON: ${{ needs.terraform-plan.outputs.terraform_image_uris_json }}
276-
run: |
277-
set -euo pipefail
278-
279-
if [ -z "${TERRAFORM_IMAGE_URIS_JSON}" ] || [ "${TERRAFORM_IMAGE_URIS_JSON}" = "null" ]; then
280-
echo "terraform-plan did not emit terraform_image_uris_json."
281-
exit 1
282-
fi
283-
284-
jq -er '
285-
to_entries[]
286-
| "TF_VAR_\(.key)_image_uri=\(.value)"
287-
' <<< "${TERRAFORM_IMAGE_URIS_JSON}" >> "$GITHUB_ENV"
288-
289286
- name: Retrieve Terraform Plan
290287
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
291288
with:

.github/workflows/deploy-lambda-artifact.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ jobs:
244244
- name: Build and publish image with layer caching
245245
id: build-image
246246
if: ${{ steps.decide.outputs.deployment_mode == 'build' && !steps.build-check.outputs.existing_image_digest }}
247-
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
247+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f
248248
with:
249249
context: ${{ env.DOCKER_CONTEXT_PATH }}
250250
file: ${{ env.DOCKERFILE_PATH }}

.github/workflows/pr-deploy-and-test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ jobs:
2020
uses: ./.github/workflows/deploy-backend.yml
2121
with:
2222
apigee_environment: internal-dev
23-
lambda_build_flags: >-
24-
${{ (github.event.action == 'opened' || github.event.action == 'reopened')
25-
&& '{"recordprocessor":true,"ack-backend":true}'
26-
|| '{}' }}
2723
diff_base_sha: ${{ github.event.action == 'synchronize' && github.event.before || github.event.pull_request.base.sha }}
2824
diff_head_sha: ${{ github.event.pull_request.head.sha }}
2925
run_diff_check: ${{ github.event.action == 'synchronize' }}

.github/workflows/pr-teardown.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ jobs:
2020
APIGEE_ENVIRONMENT: internal-dev
2121
BACKEND_ENVIRONMENT: dev
2222
BACKEND_SUB_ENVIRONMENT: pr-${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.pr_number }}
23+
LAMBDA_IMAGE_REPOSITORIES: |
24+
backend:imms-backend-repo
25+
batch_processor_filter:imms-batch-processor-filter-repo
26+
delta_backend:imms-delta-backend-repo
27+
filenameprocessor:imms-filenameprocessor-repo
28+
id_sync:imms-id-sync-repo
29+
mesh_processor:imms-mesh-processor-repo
30+
mns_publisher:imms-mns-publisher-repo
31+
recordprocessor:imms-recordprocessor-repo
32+
recordforwarder:imms-recordforwarder-repo
33+
ack_backend:imms-ackbackend-repo
34+
redis_sync:imms-redis-sync-repo
2335
permissions:
2436
id-token: write
2537
contents: read
@@ -53,8 +65,10 @@ jobs:
5365
local uri="$(make -s output "name=$1" 2>/dev/null || true)"
5466
echo "${uri:-placeholder.dkr.ecr.eu-west-2.amazonaws.com/$2@sha256:0000000000000000000000000000000000000000000000000000000000000000}"
5567
}
56-
echo "TF_VAR_recordprocessor_image_uri=$(resolve_or_placeholder recordprocessor_image_uri imms-recordprocessor-repo)" >> $GITHUB_ENV
57-
echo "TF_VAR_ack_backend_image_uri=$(resolve_or_placeholder ack_backend_image_uri imms-ackbackend-repo)" >> $GITHUB_ENV
68+
while IFS=: read -r lambda_name repository_name; do
69+
[ -n "${lambda_name}" ] || continue
70+
echo "TF_VAR_${lambda_name}_image_uri=$(resolve_or_placeholder "${lambda_name}_image_uri" "${repository_name}")" >> $GITHUB_ENV
71+
done <<< "${LAMBDA_IMAGE_REPOSITORIES}"
5872
5973
- name: Install poetry
6074
run: pip install poetry==2.1.4
@@ -129,6 +143,8 @@ jobs:
129143
--output json
130144
}
131145
132-
for repository_name in imms-recordprocessor-repo imms-ackbackend-repo; do
146+
while IFS=: read -r lambda_name repository_name; do
147+
[ -n "${lambda_name}" ] || continue
148+
[ -n "${repository_name}" ] || continue
133149
cleanup_repo_by_prefix "${repository_name}"
134-
done
150+
done <<< "${LAMBDA_IMAGE_REPOSITORIES}"

infrastructure/account/ackbackend_ecr_repo.tf

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

0 commit comments

Comments
 (0)