Skip to content

Commit 8e5ec54

Browse files
authored
Release/4.0 (#561)
This PR covers releasing 4.0 Co-authored-by: JackPlowman jack.plowman1@nhs.net Co-authored-by: Sam Clayton SLClayton@users.noreply.github.com
1 parent 850b27a commit 8e5ec54

51 files changed

Lines changed: 723 additions & 167 deletions

Some content is hidden

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

.github/PULL_REQUEST_TEMPLATE/task_pull_request_template.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ Delete not appropriate
1818
## Development Checklist
1919

2020
- [ ] I have performed a self-review of my own code
21-
- [ ] I have run the [code formatting checks](../README.md#code-quality)
22-
- [ ] I have run the [code quality checks](../README.md#code-quality)
23-
- [ ] New code meets [standards](https://nhsd-confluence.digital.nhs.uk/display/DI/DI+Ways+of+Working) agreed by the team
2421
- [ ] Tests have added that prove my fix is effective or that my feature works (Integration tests)
2522
- [ ] I have updated Dependabot to include my changes (if applicable)
2623

2724
## Code Reviewer Checklist
2825

2926
- [ ] I can confirm the changes have been tested or approved by a tester
30-
- [ ] I have checked any ignore commands for code linting tools and I agree that the code is safe

Makefile

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ build-and-push: # Build lambda docker images and pushes them to ECR
3030
done
3131

3232
deploy: # Deploys whole project - mandatory: PROFILE
33-
make terraform-apply-auto-approve STACKS=api-key,appconfig,before-lambda-deployment
3433
eval "$$(make -s populate-deployment-variables)"
34+
make terraform-apply-auto-approve STACKS=api-key,appconfig,before-lambda-deployment
35+
eval "$$(make -s populate-serverless-variables)"
3536
make serverless-deploy
3637
make terraform-apply-auto-approve STACKS=after-lambda-deployment
3738

3839
undeploy: # Undeploys whole project - mandatory: PROFILE
40+
eval "$$(make -s populate-deployment-variables)"
3941
make terraform-destroy-auto-approve STACKS=after-lambda-deployment
40-
make serverless-remove VERSION="any" DB_PASSWORD="any" DB_SERVER="any" DB_USER_NAME="any" SLACK_WEBHOOK_URL="any" DB_READ_ONLY_USER_NAME="any" DB_READ_AND_WRITE_USER_NAME="any" DB_REPLICA_SERVER="any" PROJECT_TEAM_EMAIL_ADDRESS="any" DB_NAME="any" PROJECT_SYSTEM_EMAIL_ADDRESS="any"
42+
eval "$$(make -s populate-serverless-variables)"
43+
make serverless-remove VERSION="any"
4144
make terraform-destroy-auto-approve STACKS=before-lambda-deployment,appconfig
4245
if [ "$(PROFILE)" != "live" ]; then
4346
make terraform-destroy-auto-approve STACKS=api-key
@@ -50,12 +53,21 @@ build-and-deploy: # Builds and Deploys whole project - mandatory: PROFILE
5053
populate-deployment-variables:
5154
echo "export DB_SERVER=$$(make -s aws-rds-describe-instance-value DB_INSTANCE=$(DB_SERVER_NAME) KEY_DOT_PATH=Endpoint.Address)"
5255
echo "export DB_REPLICA_SERVER=$$(make -s aws-rds-describe-instance-value DB_INSTANCE=$(DB_REPLICA_SERVER_NAME) KEY_DOT_PATH=Endpoint.Address)"
53-
echo "export DB_READ_AND_WRITE_USER_NAME=$$(make -s secret-get-existing-value NAME=$(DB_USER_NAME_SECRET_NAME) KEY=$(DB_USER_NAME_SECRET_KEY))"
54-
echo "export DB_READ_ONLY_USER_NAME=$$(make -s secret-get-existing-value NAME=$(DB_READ_ONLY_USER_NAME_SECRET_NAME) KEY=$(DB_READ_ONLY_USER_NAME_SECRET_KEY))"
55-
echo "export SLACK_WEBHOOK_URL=$$(make -s secret-get-existing-value NAME=$(SLACK_WEBHOOK_SECRET_NAME) KEY=$(SLACK_WEBHOOK_SECRET_KEY))"
56-
echo "export PROJECT_SYSTEM_EMAIL_ADDRESS=$$(make -s secret-get-existing-value NAME=$(EMAIL_SECRETS) KEY=$(SYSTEM_EMAIL_KEY))"
57-
echo "export PROJECT_TEAM_EMAIL_ADDRESS=$$(make -s secret-get-existing-value NAME=$(EMAIL_SECRETS) KEY=$(TEAM_EMAIL_KEY))"
58-
echo "export TERRAFORM_KMS_KEY_ID=$$(make terraform-output STACKS=before-lambda-deployment | grep -oP 'kms_key_id = "\K[^"]+')"
56+
DEPLOYMENT_SECRETS=$$(make -s secret-get-existing-value NAME=$(DEPLOYMENT_SECRETS))
57+
echo "export DB_READ_AND_WRITE_USER_NAME=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(DB_USER_NAME_SECRET_KEY)')"
58+
echo "export DB_READ_ONLY_USER_NAME=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(DB_READ_ONLY_USER_NAME_SECRET_KEY)')"
59+
echo "export SLACK_WEBHOOK_URL=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(SLACK_WEBHOOK_SECRET_KEY)')"
60+
echo "export PROJECT_SYSTEM_EMAIL_ADDRESS=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(SYSTEM_EMAIL_KEY)')"
61+
echo "export PROJECT_TEAM_EMAIL_ADDRESS=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(TEAM_EMAIL_KEY)')"
62+
echo "export PROJECT_SERVICE_CATEGORY=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(SERVICE_CATEGORY_KEY)')"
63+
echo "export PROJECT_DATA_CLASSIFICATION=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(DATA_CLASSIFICATION_KEY)')"
64+
echo "export PROJECT_DISTRIBUTION_LIST=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(DISTRIBUTION_LIST_KEY)')"
65+
echo "export TF_VAR_service_category=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(SERVICE_CATEGORY_KEY)')"
66+
echo "export TF_VAR_data_classification=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(DATA_CLASSIFICATION_KEY)')"
67+
echo "export TF_VAR_distribution_list=$$(echo $$DEPLOYMENT_SECRETS | jq -r '.$(DISTRIBUTION_LIST_KEY)')"
68+
69+
populate-serverless-variables:
70+
echo "export TERRAFORM_KMS_KEY_ID=$$(make -s terraform-output STACKS=before-lambda-deployment OPTS='-raw kms_key_id' | tail -n1)"
5971

6072
unit-test-local:
6173
pyenv local .venv
@@ -239,6 +251,7 @@ send-email-build-and-deploy: ### Build and deploy send email lambda docker image
239251

240252
sls-only-deploy: # Deploys all lambdas - mandatory: PROFILE, VERSION=[commit hash-timestamp/latest]
241253
eval "$$(make -s populate-deployment-variables)"
254+
eval "$$(make -s populate-serverless-variables)"
242255
make serverless-deploy
243256

244257
quick-build-and-deploy: # Build and deploy lambdas only (meant to for fast redeployment of existing lambdas) - mandatory: PROFILE, ENVIRONMENT
@@ -523,7 +536,7 @@ trigger-dos-deployment-pipeline:
523536
--user $$JENKINS_USERNAME:$$JENKINS_PASSWORD \
524537
-H "Jenkins-Crumb: $$JENKINS_CRUMB" \
525538
-F "TARGET=\"regressiondi\"" \
526-
-F "IMAGE_TAG=\"7.11.3_157c538\"" \
539+
-F "IMAGE_TAG=\"7.12.1_d393439\"" \
527540
-F "REFRESH=\"true\""
528541
echo Jenkins Job has started
529542
echo Sleeping for 3 minutes

application/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@ ignore_names = [
2929
"metadata",
3030
"recipient_email_address",
3131
"recipient_id",
32-
"format_address",
3332
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
aws_embedded_metrics
2-
aws_lambda_powertools
2+
aws-lambda-powertools == 1.31.1

application/service_sync/changes_to_dos.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from aws_lambda_powertools.logging import Logger
55

6-
from .format import format_website
6+
from .format import format_address, format_website
77
from .service_histories import ServiceHistories
88
from .validation import validate_website
99
from common.dos import DoSService, get_valid_dos_location
@@ -98,20 +98,23 @@ def check_for_specified_opening_times_changes(self) -> bool:
9898
"Removing Specified opening times that occur in the past",
9999
extra={"all_nhs": nhs_spec_open_dates, "future_nhs": future_nhs_spec_open_dates},
100100
)
101-
if SpecifiedOpeningTime.equal_lists(dos_spec_open_dates, future_nhs_spec_open_dates):
102-
logger.info(
103-
"Specified opening times are equal, so no change",
104-
extra={"dos": dos_spec_open_dates, "nhs": future_nhs_spec_open_dates},
105-
)
106-
return False
107-
else:
101+
equal_specified_opening_times = SpecifiedOpeningTime.equal_lists(
102+
dos_spec_open_dates, future_nhs_spec_open_dates
103+
)
104+
if not equal_specified_opening_times or len(nhs_spec_open_dates) != len(future_nhs_spec_open_dates):
108105
logger.info(
109106
"Specified opening times not equal",
110107
extra={"dos": dos_spec_open_dates, "nhs": future_nhs_spec_open_dates},
111108
)
112109
self.current_specified_opening_times = dos_spec_open_dates
113110
self.new_specified_opening_times = future_nhs_spec_open_dates
114111
return True
112+
else:
113+
logger.info(
114+
"Specified opening times are equal, so no change",
115+
extra={"dos": dos_spec_open_dates, "nhs": future_nhs_spec_open_dates},
116+
)
117+
return False
115118

116119
def check_for_address_and_postcode_for_changes(self) -> Tuple[bool, bool, Optional[DoSLocation]]:
117120
"""Check if address and postcode have changed between dos_service and nhs_entity,
@@ -120,13 +123,12 @@ def check_for_address_and_postcode_for_changes(self) -> Tuple[bool, bool, Option
120123
Returns:
121124
Tuple[bool, bool]: Tuple of booleans, first is if address has changed, second is if postcode has changed, third is the DoSLocation object for the postcode
122125
""" # noqa: E501
123-
# Address Formatting Turned off in DI-591
124-
# before_title_case_address = self.nhs_entity.address_lines
125-
# self.nhs_entity.address_lines = list(map(format_address, self.nhs_entity.address_lines))
126-
# logger.info(
127-
# f"Address after title casing: {self.nhs_entity.address_lines}",
128-
# extra={"before": before_title_case_address, "after": self.nhs_entity.address_lines},
129-
# )
126+
before_title_case_address = self.nhs_entity.address_lines
127+
self.nhs_entity.address_lines = list(map(format_address, self.nhs_entity.address_lines))
128+
logger.info(
129+
f"Address after title casing: {self.nhs_entity.address_lines}",
130+
extra={"before": before_title_case_address, "after": self.nhs_entity.address_lines},
131+
)
130132
nhs_uk_address_string = "$".join(self.nhs_entity.address_lines)
131133
dos_address = self.dos_service.address
132134
is_address_same = True

application/service_sync/service_histories.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def save_service_histories(self, connection: connection) -> None:
193193
"CURRENT_DATE_TIME": current_date_time,
194194
"SERVICE_ID": self.service_id,
195195
},
196-
log_vars=False
196+
log_vars=False,
197197
)
198198
cursor.close()
199199
if self.history_already_exists:
@@ -204,7 +204,7 @@ def save_service_histories(self, connection: connection) -> None:
204204
"""UPDATE servicehistories SET history = %(SERVICE_HISTORY)s WHERE serviceid = %(SERVICE_ID)s;"""
205205
),
206206
vars={"SERVICE_HISTORY": Json(self.service_history), "SERVICE_ID": self.service_id},
207-
log_vars=False
207+
log_vars=False,
208208
)
209209
logger.info(f"Service history updated for serviceid {self.service_id}")
210210
cursor.close()
@@ -217,7 +217,7 @@ def save_service_histories(self, connection: connection) -> None:
217217
"""VALUES (%(SERVICE_ID)s, %(SERVICE_HISTORY)s);"""
218218
),
219219
vars={"SERVICE_ID": self.service_id, "SERVICE_HISTORY": Json(self.service_history)},
220-
log_vars=False
220+
log_vars=False,
221221
)
222222
cursor.close()
223223
logger.warning(f"Service history created in the database for serviceid {self.service_id}")

build/automation/init.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ INFRASTRUCTURE_DIR_REL := $(shell echo $(INFRASTRUCTURE_DIR) | sed "s;$(PROJECT_
605605
JQ_DIR_REL := $(shell echo $(abspath $(LIB_DIR)/jq) | sed "s;$(PROJECT_DIR);;g")
606606

607607
GIT_BRANCH_PATTERN_MAIN := ^(main|master|develop)$$
608-
GIT_BRANCH_PATTERN_PREFIX := ^(task|spike|automation|test|bugfix|hotfix|fix|release|migration|refactor)
608+
GIT_BRANCH_PATTERN_PREFIX := ^(task|spike|automation|test|bugfix|hotfix|fix|release|migration|refactor|documentation)
609609
GIT_BRANCH_PATTERN_SUFFIX := ([A-Z]{2,5}-([0-9]{1,5}|X{1,5})_[A-Z][a-z]+_[A-Za-z0-9]+_[A-Za-z0-9_]+)$$
610610
GIT_BRANCH_PATTERN_ADDITIONAL := ^(task/Update_(automation_scripts|dependencies|documentation|tests|versions)|task/Refactor|task/Refactor_[A-Za-z0-9_]+_[A-Za-z0-9_]+|refactor/[A-Z][a-z]+_[A-Za-z0-9_]+_[A-Za-z0-9_]+|devops/[A-Z][a-z]+_[A-Za-z0-9_]+_[A-Za-z0-9_]+|alignment/[A-Z][a-z]+_[A-Za-z0-9_]+_[A-Za-z0-9_]+|dependabot/.*)$$
611611
GIT_BRANCH_PATTERN := $(GIT_BRANCH_PATTERN_MAIN)|$(GIT_BRANCH_PATTERN_PREFIX)/$(GIT_BRANCH_PATTERN_SUFFIX)|$(GIT_BRANCH_PATTERN_ADDITIONAL)

build/automation/var/platform-texas/v1/account-live-k8s-nonprod.mk

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ TF_VAR_terraform_platform_state_store = nhsd-texasplatform-terraform-state-store
88

99
TF_VAR_developer_role_name = UECPUServiceDeveloper
1010

11-
EMAIL_SECRETS := uec-dos-int-dev/deployment
12-
PROJECT_EMAIL_SECRET_NAME := $(EMAIL_SECRETS)
11+
1312
SYSTEM_EMAIL_KEY := DI_SYSTEM_MAILBOX_ADDRESS
1413
TEAM_EMAIL_KEY := DI_TEAM_MAILBOX_ADDRESS
15-
TF_VAR_email_secrets := $(EMAIL_SECRETS)
16-
TF_VAR_system_email_address_key := $(SYSTEM_EMAIL_KEY)
1714

1815
# ==============================================================================
1916

build/automation/var/platform-texas/v1/account-live-k8s-prod.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ TF_VAR_terraform_platform_state_store = nhsd-texasplatform-terraform-state-store
88

99
TF_VAR_developer_role_name = UECPUSupportServiceDeveloper
1010

11-
EMAIL_SECRETS := uec-dos-int-live/deployment
12-
PROJECT_EMAIL_SECRET_NAME := $(EMAIL_SECRETS)
1311
SYSTEM_EMAIL_KEY := DI_SYSTEM_MAILBOX_ADDRESS
1412
TEAM_EMAIL_KEY := DI_TEAM_MAILBOX_ADDRESS
15-
TF_VAR_email_secrets := $(EMAIL_SECRETS)
16-
TF_VAR_system_email_address_key := $(SYSTEM_EMAIL_KEY)
1713

1814
# ==============================================================================
1915

build/automation/var/profile/demo.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# ==============================================================================
44
# Service variables
5+
DEPLOYMENT_SECRETS = $(PROJECT_ID)-demo/deployment # Move to project.mk when nonprod profiles are merged
56

67
LOG_LEVEL:= INFO
78

@@ -26,6 +27,8 @@ SLACK_WEBHOOK_SECRET_NAME = uec-dos-int-$(PROFILE)/deployment
2627
SLACK_WEBHOOK_SECRET_KEY = SLACK_WEBHOOK
2728
SLACK_ALERT_CHANNEL := dos-integration-dev-status
2829

30+
TAG_SECRET_MANAGER := uec-dos-int-live/deployment
31+
2932
# ==============================================================================
3033
# Organisation Types Feature Flags
3134

0 commit comments

Comments
 (0)