Skip to content

Commit bead422

Browse files
authored
Merge branch 'master' into VED-719-blue-green-proxy-pipeline
2 parents d01ed82 + ea949b9 commit bead422

File tree

96 files changed

+5587
-3270
lines changed

Some content is hidden

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

96 files changed

+5587
-3270
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: 2
77
updates:
88
- package-ecosystem: "docker"
99
directories:
10-
- "/ack_backend"
10+
- "/lambdas/ack_backend"
1111
- "/delta_backend"
1212
- "/filenameprocessor"
1313
- "/grafana/non-prod/docker"
@@ -49,7 +49,6 @@ updates:
4949
- package-ecosystem: "pip"
5050
directories:
5151
- "/"
52-
- "/ack_backend"
5352
- "/backend"
5453
- "/batch_processor_filter"
5554
- "/delta_backend"
@@ -58,6 +57,7 @@ updates:
5857
- "/filenameprocessor"
5958
- "/mesh_processor"
6059
- "/recordprocessor"
60+
- "/lambdas/ack_backend"
6161
- "/lambdas/redis_sync"
6262
- "/lambdas/id_sync"
6363
- "/lambdas/mns_subscription"
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Deploy Backend
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
apigee_environment:
7+
required: true
8+
type: string
9+
create_mns_subscription:
10+
required: false
11+
type: boolean
12+
default: true
13+
environment:
14+
required: true
15+
type: string
16+
sub_environment:
17+
required: true
18+
type: string
19+
workflow_dispatch:
20+
inputs:
21+
apigee_environment:
22+
type: choice
23+
description: Select the Apigee proxy environment
24+
options:
25+
- internal-dev
26+
- int
27+
- ref
28+
- prod
29+
create_mns_subscription:
30+
description: Create an MNS Subscription. Only available in dev
31+
required: false
32+
type: boolean
33+
default: true
34+
environment:
35+
type: string
36+
description: Select the backend environment
37+
options:
38+
- dev
39+
- preprod
40+
- prod
41+
sub_environment:
42+
type: string
43+
description: Set the sub environment name e.g. pr-xxx, or green/blue in higher environments
44+
45+
jobs:
46+
terraform-plan:
47+
runs-on: ubuntu-latest
48+
environment:
49+
name: ${{ inputs.environment }}
50+
env: # Sonarcloud - do not allow direct usage of untrusted data
51+
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
52+
BACKEND_ENVIRONMENT: ${{ inputs.environment }}
53+
BACKEND_SUB_ENVIRONMENT: ${{ inputs.sub_environment }}
54+
permissions:
55+
id-token: write
56+
contents: read
57+
steps:
58+
- name: Connect to AWS
59+
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a
60+
with:
61+
aws-region: eu-west-2
62+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
63+
role-session-name: github-actions
64+
65+
- name: Whoami
66+
run: aws sts get-caller-identity
67+
68+
- name: Checkout
69+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
70+
71+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
72+
with:
73+
terraform_version: "1.12.2"
74+
75+
- name: Terraform Init
76+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
77+
run: make init apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
78+
79+
- name: Terraform Plan
80+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
81+
run: make plan apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
82+
83+
terraform-apply:
84+
needs: terraform-plan
85+
runs-on: ubuntu-latest
86+
environment:
87+
name: ${{ inputs.environment }}
88+
env: # Sonarcloud - do not allow direct usage of untrusted data
89+
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
90+
BACKEND_ENVIRONMENT: ${{ inputs.environment }}
91+
BACKEND_SUB_ENVIRONMENT: ${{ inputs.sub_environment }}
92+
permissions:
93+
id-token: write
94+
contents: read
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
98+
99+
- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a
100+
with:
101+
aws-region: eu-west-2
102+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
103+
role-session-name: github-actions
104+
105+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
106+
with:
107+
terraform_version: "1.12.2"
108+
109+
- name: Terraform Init
110+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
111+
run: make init apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
112+
113+
- name: Terraform Apply
114+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
115+
run: |
116+
make apply apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
117+
echo "ID_SYNC_QUEUE_ARN=$(make -s output name=id_sync_queue_arn)" >> $GITHUB_ENV
118+
119+
- name: Install poetry
120+
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
121+
run: pip install poetry==2.1.4
122+
123+
- uses: actions/setup-python@v5
124+
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
125+
with:
126+
python-version: 3.11
127+
cache: 'poetry'
128+
129+
- name: Create MNS Subscription
130+
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
131+
working-directory: './lambdas/mns_subscription'
132+
env:
133+
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
134+
SQS_ARN: ${{ env.ID_SYNC_QUEUE_ARN }}
135+
run: |
136+
poetry install --no-root
137+
echo "Subscribing SQS to MNS for notifications..."
138+
make subscribe

.github/workflows/deploy-blue-green.yml

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

.github/workflows/deploy-template.yml

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

.github/workflows/quality-checks.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,6 @@ jobs:
106106
poetry run coverage run -m unittest discover -p "*batch*.py" || echo "recordforwarder tests failed" >> ../failed_tests.txt
107107
poetry run coverage xml -o ../recordforwarder-coverage.xml
108108
109-
- name: Run unittest with coverage-ack-lambda
110-
working-directory: ack_backend
111-
id: acklambda
112-
env:
113-
PYTHONPATH: ${{ github.workspace }}/ack_backend/src:${{ github.workspace }}/ack_backend/tests
114-
continue-on-error: true
115-
run: |
116-
poetry install
117-
poetry run coverage run -m unittest discover || echo "ack-lambda tests failed" >> ../failed_tests.txt
118-
poetry run coverage xml -o ../ack-lambda-coverage.xml
119-
120109
- name: Run unittest with coverage-delta
121110
working-directory: delta_backend
122111
id: delta
@@ -148,6 +137,17 @@ jobs:
148137
poetry run coverage run -m unittest discover || echo "mesh_processor tests failed" >> ../failed_tests.txt
149138
poetry run coverage xml -o ../mesh_processor-coverage.xml
150139
140+
- name: Run unittest with coverage-ack-lambda
141+
working-directory: lambdas/ack_backend
142+
id: acklambda
143+
env:
144+
PYTHONPATH: ${{ env.LAMBDA_PATH }}/ack_backend/src:${{ github.workspace }}/ack_backend/tests
145+
continue-on-error: true
146+
run: |
147+
poetry install
148+
poetry run coverage run --source=src -m unittest discover || echo "ack-lambda tests failed" >> ../../failed_tests.txt
149+
poetry run coverage xml -o ../../ack-lambda-coverage.xml
150+
151151
- name: Run unittest with coverage-mns-subscription
152152
working-directory: lambdas/mns_subscription
153153
id: mns_subscription

0 commit comments

Comments
 (0)