Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
257 commits
Select commit Hold shift + click to select a range
83e619f
Merge branch 'main' of https://github.com/NHSDigital/eps-assist-me in…
kris-szlapa Jul 15, 2025
def2405
Add compile-node target to Makefile
kris-szlapa Jul 15, 2025
1c286a2
Remove unnecessary empty line
kris-szlapa Jul 15, 2025
f20159e
Add LambdaFunction and RestApiGateway resources for chatbot functiona…
kris-szlapa Jul 16, 2025
43e89d0
Mark false positives in .gitallowed file
kris-szlapa Jul 16, 2025
7821143
Provide fallback values for tags
kris-szlapa Jul 16, 2025
9824f17
Update building command
kris-szlapa Jul 16, 2025
4680d82
Remove unnecessary import
kris-szlapa Jul 17, 2025
e958872
Merge branch 'main' of https://github.com/NHSDigital/eps-assist-me in…
kris-szlapa Jul 17, 2025
e3c0ee3
Replace PythonFunction with a custom bundling strategy
kris-szlapa Jul 18, 2025
c47fc51
Add ShellCheck for root-level scripts
kris-szlapa Jul 18, 2025
ab7491a
Remove unnecessary policies
kris-szlapa Jul 18, 2025
515e02b
Update functionName and environmentVariables
kris-szlapa Jul 18, 2025
58a5b1f
Add accountId tag to app
kris-szlapa Jul 18, 2025
b0f8744
Remove download-get-secrets-layer from cdk-synth
kris-szlapa Jul 18, 2025
3d464fd
Remove DLQ and VPC from lambda
kris-szlapa Jul 18, 2025
140101e
Add suppressed rules for lambda
kris-szlapa Jul 18, 2025
3dbef16
Add suppressions for CDK-generated Lambda handlers
kris-szlapa Jul 18, 2025
e1bca6d
Implement a script to add cfn-guard metadata to suppress rules on a r…
kris-szlapa Jul 19, 2025
0d7828c
Update nag suppressions
kris-szlapa Jul 19, 2025
be7152f
Add metadata to lambda so they don't get flagged as failing cfn-guard
kris-szlapa Jul 19, 2025
3261e11
Update backet stack resources
kris-szlapa Jul 19, 2025
9e72167
Enable docker inside docker to install pip
kris-szlapa Jul 19, 2025
29ae73f
Remove docker volume mount option
kris-szlapa Jul 19, 2025
70027d4
Restore git-secrets-docker-setup Makefile target
kris-szlapa Jul 19, 2025
5c76512
Refactor KMS key import logic
kris-szlapa Jul 19, 2025
9ce3b92
Remove download-get-secrets-layer target and step
kris-szlapa Jul 19, 2025
5e0c9bb
Pass AWS credentials into the bundling context
kris-szlapa Jul 19, 2025
e3cbe3b
Comment out quality_checks step
kris-szlapa Jul 19, 2025
9e5c1df
Add debug AWS credentials inside Docker container step
kris-szlapa Jul 19, 2025
40100aa
Manually bundle Lambda functions instead of using default Docker bund…
kris-szlapa Jul 19, 2025
107573c
Add requirements and remove runtime install block from createIndexFun…
kris-szlapa Jul 19, 2025
1d82c9f
Update bundle lambda functions step with correct path
kris-szlapa Jul 19, 2025
b460345
Update bundle lambda functions step with correct stack name
kris-szlapa Jul 19, 2025
9f71a7e
Debug working directiory path in bundle lambda function step
kris-szlapa Jul 19, 2025
b69e548
Amend path in bundle lambda functions step
kris-szlapa Jul 19, 2025
1cf0671
Change docker mount to include entire repo
kris-szlapa Jul 19, 2025
a2200d0
Add debug container filesystem layout step
kris-szlapa Jul 19, 2025
337d841
Amend debug container filesystem layout step stack name
kris-szlapa Jul 19, 2025
d989fd8
Add create version.txt for CDK tooling step
kris-szlapa Jul 19, 2025
2a31a82
Update CDK_APP_PATH to use .build
kris-szlapa Jul 19, 2025
2751fbe
Add STACK_NAME to docker run env
kris-szlapa Jul 19, 2025
84d4242
Pass ACCOUNT_ID as an env variable to fix cdk.json step
kris-szlapa Jul 19, 2025
5354ed0
Show final .build/cdk.json
kris-szlapa Jul 19, 2025
28324a5
Amend tag debugging in EpsAssistMeApp
kris-szlapa Jul 19, 2025
f7a97a5
Move .build/cdk.json to root for CDK context
kris-szlapa Jul 19, 2025
94c6ff0
Update bedrock knowledge base roleArm
kris-szlapa Jul 19, 2025
3bcdc5a
Update bedrock knowledge base roleArm to ci-resources
kris-szlapa Jul 19, 2025
4feaa94
Reorder resources in cdk stack
kris-szlapa Jul 19, 2025
5427e8a
Remove objectLockEnabled true property from S3 buckets
kris-szlapa Jul 19, 2025
70a420b
Remove replication configuration as deployment role lacks s3:PutRepli…
kris-szlapa Jul 19, 2025
ec9d41f
Use existing Bedrock role that already has trust relationship with Be…
kris-szlapa Jul 19, 2025
30c27d5
Add explicit dependency to ensure the vector index is created before …
kris-szlapa Jul 19, 2025
47439a6
Get the underlying CloudFormation resource
kris-szlapa Jul 19, 2025
d6b590d
Use the node.addDependency method instead of CfnResource.addDependency
kris-szlapa Jul 20, 2025
dc2ee19
Add onUpdate handler to the VectorIndex custom resource, use timestam…
kris-szlapa Jul 20, 2025
1abcfb5
Add a delay using a custom resource that doesn't do anything but wait
kris-szlapa Jul 20, 2025
40b69e3
Suppress CDK-nag warning for the delay custom resource
kris-szlapa Jul 20, 2025
8cd7e87
Add function to wait for the OpenSearch index to exist and remove del…
kris-szlapa Jul 20, 2025
42ebae0
Removed suppression for delay custom resource as it's no longer needed
kris-szlapa Jul 20, 2025
d4b5f58
Add timeout to createIndexFunction handler
kris-szlapa Jul 20, 2025
0fa2685
Restore createIndexFunction handler
kris-szlapa Jul 20, 2025
acf5100
Amend logic to ensure that Lambda function will only return success t…
kris-szlapa Jul 20, 2025
8db137d
Set log group removal policy to RETAIN
kris-szlapa Jul 20, 2025
c821ca4
Create a role for Bedrock KB with permissions it needs
kris-szlapa Jul 20, 2025
316cfdc
Suppress wildcard and granular permissions for Bedrock execution role
kris-szlapa Jul 20, 2025
8c763e4
Amend suppressions for Bedrock execution role
kris-szlapa Jul 20, 2025
09e1125
Add bedrockKbRole.roleArn to principals list for the OpenSearch Serve…
kris-szlapa Jul 20, 2025
d3679da
Move Bedrock Execution Role for Knowledge Base in cdk stack
kris-szlapa Jul 20, 2025
4a49d2b
Add AOSS Index permissions for Lambda
kris-szlapa Jul 20, 2025
85a2885
Add IAM Managed policy for OpenSearch Serverless permissions
kris-szlapa Jul 21, 2025
e1dab32
Add nag suppressions for CreateIndexFunctionAossPolicy
kris-szlapa Jul 21, 2025
3e8319f
Set log group removal policy to DESTROY
kris-szlapa Jul 21, 2025
7a38206
Change timeout value fr a strinto int
kris-szlapa Jul 21, 2025
8e6a09c
Clean up debug steps in cdk_release_code workflow
kris-szlapa Jul 21, 2025
c7a435a
Skip index health polling since AOSS lacks full health API support
kris-szlapa Jul 21, 2025
a95e511
Update parameter names in slackbot Lambda code
kris-szlapa Jul 21, 2025
8c11511
Store Slack bot token and signing secret in SSM parameters and attach…
kris-szlapa Jul 21, 2025
733b18e
Add Lambda self-invoke policy needed for Slack Bolt lazy handlers
kris-szlapa Jul 21, 2025
36e4726
Suppress wildcard permissions for SlackBot Lambda guardrail access
kris-szlapa Jul 21, 2025
2ddb88c
Grant API Gateway role permission to call the Lambda
kris-szlapa Jul 21, 2025
25a9bd3
Suppress wildcard permissions for API Gateway role
kris-szlapa Jul 21, 2025
f0485cb
Keep Lambda execution role independent from API Gateway
kris-szlapa Jul 21, 2025
f5422cf
Remove the executionManagedPolicy for lambda:InvokeFunction
kris-szlapa Jul 21, 2025
23a689c
Use custom LambdaEndpoint to connect the SlackBot Lambda to the API G…
kris-szlapa Jul 21, 2025
0807e3d
Update HttpMethod import
kris-szlapa Jul 21, 2025
3c95253
Remove LambdaEndpoint import to avoid circular dependencies and creat…
kris-szlapa Jul 21, 2025
1de00bd
Create execution policy in LambdaFunction that grants permission to i…
kris-szlapa Jul 21, 2025
78f138f
Reorder creation of dependencies
kris-szlapa Jul 21, 2025
3d949fd
Remove other policies
kris-szlapa Jul 21, 2025
8f7bf5b
Add IAM Policy for Lambda to invoke itself
kris-szlapa Jul 21, 2025
7f88449
Move lambdaSelfInvokePolicy block to after the Lambda is created
kris-szlapa Jul 21, 2025
a2c84da
Remove the explicit attachment of Lambda’s execution policy to the AP…
kris-szlapa Jul 21, 2025
f052a17
Avoid referencing any property of the Lambda resource itself in the p…
kris-szlapa Jul 21, 2025
8ea3c1e
Suppress wildcard permissions for Lambda self-invoke policy
kris-szlapa Jul 21, 2025
9fc9bce
Remove white space
kris-szlapa Jul 21, 2025
cee02d0
Allow API Gateway to invoke Lambda and attach additional policies
kris-szlapa Jul 21, 2025
4f1a483
Move lambdaEnv definition to the top
kris-szlapa Jul 21, 2025
821f9f2
Increase timeout for waiting until index exists in AOSS
kris-szlapa Jul 21, 2025
7442211
Add get mapping call to ensure index is fully ready
kris-szlapa Jul 21, 2025
0822621
Set log group removalPolicy to RETAIN
kris-szlapa Jul 21, 2025
96b6eb1
Set log group removalPolicy to DESTROY
kris-szlapa Jul 22, 2025
476cc8f
Comment out slack bot lambda policies
kris-szlapa Jul 22, 2025
ee1d31d
Restore stack with working slack response from source 3d949fd
kris-szlapa Jul 22, 2025
331b3a2
Add Lambda self-invoke policy and allow API Gateway to invoke the Lambda
kris-szlapa Jul 22, 2025
0740897
Test deployment
kris-szlapa Jul 22, 2025
ea35510
Restore working stack
kris-szlapa Jul 22, 2025
dcc1413
Remove unnecessary environment variables passed to container
kris-szlapa Jul 22, 2025
58a7941
Move files to constructs folder
kris-szlapa Jul 22, 2025
952199a
Refactor stack and update nag suppressions
kris-szlapa Jul 22, 2025
0bdc6fd
Add nag suppressions for Bedrock execution role
kris-szlapa Jul 22, 2025
eb18563
Set the log group removal policy to RETAIN
kris-szlapa Jul 22, 2025
e9fe3ce
Increase timeout in wait_for_index_aoss function
kris-szlapa Jul 22, 2025
5b0c6b9
Set bucket removal policy to RETAIN
kris-szlapa Jul 22, 2025
9876bd8
Increase timeout while waiting for index
kris-szlapa Jul 22, 2025
bb20f48
Set bucket removal policy to DESTROY
kris-szlapa Jul 22, 2025
81500ec
Refactor EpsAssistMeStack and LambdaFunction modules
kris-szlapa Jul 23, 2025
56e65fe
Update suppression for Lambda self-invoke policy
kris-szlapa Jul 23, 2025
73a3b11
Set the log group removal policy to DESTROY
kris-szlapa Jul 23, 2025
086c861
Create SlackAskEpsEndpoint and integrate it with the SlackBotLambda
kris-szlapa Jul 23, 2025
38ca341
Amend method type in LambdaEndpoint
kris-szlapa Jul 23, 2025
d1747df
Add permission for slackBotLambda to invoke itself
kris-szlapa Jul 23, 2025
363adb0
Ensure SlackBot Lambda is created before referencing its function nam…
kris-szlapa Jul 23, 2025
de83c60
Allow slackBotLambda to invoke any Lambda in account
kris-szlapa Jul 23, 2025
921c3cc
Comment out COLLECTION_NAME for testing
kris-szlapa Jul 23, 2025
e17b323
Use a unique osCollection name per deploy
kris-szlapa Jul 23, 2025
fc8ef58
Restore initial COLLECTION_NAME
kris-szlapa Jul 23, 2025
156648a
Remove encryptionKey property from s3 buckets
kris-szlapa Jul 23, 2025
6620867
Create a customer-managed KMS key and grant Bedrock permission to dec…
kris-szlapa Jul 23, 2025
2c5b039
Add WebClient and SlackApiError classes to slackBotFunction
kris-szlapa Jul 23, 2025
417f824
Restore SlackBot function that does not require chat:write scope
kris-szlapa Jul 23, 2025
1a0f4c8
Add ENABLE_MUTUAL_TLS variable to GitHub Actions
kris-szlapa Jul 24, 2025
99824d7
Move api resorurces from stack
kris-szlapa Jul 24, 2025
2d17bfd
Add suppressions for Apis construct
kris-szlapa Jul 24, 2025
aa70d27
Use apis map and rename function key to slackBot
kris-szlapa Jul 24, 2025
ad96293
Move Lambda resources out of stack
kris-szlapa Jul 24, 2025
d67b93b
Update nag suppressions
kris-szlapa Jul 24, 2025
12d979c
Extract storage resources from stack and update nag suppressions
kris-szlapa Jul 25, 2025
e19fc72
Add suppression for Bedrock execution role S3 bucket access
kris-szlapa Jul 25, 2025
c8bc7a8
Extract Secrets and SSM resources from stack and update NAG suppressions
kris-szlapa Jul 25, 2025
f8b53d9
Separate S3 functionality into a reusable construct
kris-szlapa Jul 25, 2025
1c1da19
Update NAG suppression for IAM wildcard permissions in Bedrock execut…
kris-szlapa Jul 25, 2025
13f56b4
Remove obsolete NAG suppression paths
kris-szlapa Jul 25, 2025
c6c54fd
Create SecretWithParameter construct for secret and SSM parameter
kris-szlapa Jul 25, 2025
cef2ecb
Create OpenSearchResources and OpenSearchCollection constructs
kris-szlapa Jul 25, 2025
f4a2d96
Use shorter OpenSearch collection names
kris-szlapa Jul 25, 2025
312287b
Extract Bedrock resources and Guardrails into separate construct
kris-szlapa Jul 25, 2025
27c6490
Update logRetentionInDays value in EpsAssistMeStack
kris-szlapa Jul 25, 2025
4a86e9a
Add VectorKnowledgeBase construct for knowledge base and guardrail
kris-szlapa Jul 25, 2025
655bc71
Amend functions comment
kris-szlapa Jul 25, 2025
19f68fc
Enable Docker-in-Docker to support generative-ai-cdk-constructs library
kris-szlapa Jul 25, 2025
a3d9de7
Install Docker inside cdk-utils-build-repo container before running C…
kris-szlapa Jul 25, 2025
13ee74f
Restore docker run steps
kris-szlapa Jul 25, 2025
bd798d7
Rename vector knowledge base resources module
kris-szlapa Jul 26, 2025
215290a
Use L1 constructs from aws-bedrock instead of L2 from generative-ai-c…
kris-szlapa Jul 26, 2025
e78ad79
Move Build Python Lambda Functions step to cdk package code
kris-szlapa Jul 26, 2025
8201ba3
Exclude build directory when copying the files
kris-szlapa Jul 26, 2025
86501fd
Remove duplicate step
kris-szlapa Jul 27, 2025
c7e4bda
Create version.txt for CDK tooling
kris-szlapa Jul 27, 2025
44b1761
Add required environment variables that CDK container expects
kris-szlapa Jul 27, 2025
a004dba
Move version.txt into .build
kris-szlapa Jul 27, 2025
081ac72
Move version.txt to .build
kris-szlapa Jul 27, 2025
fbe1e3a
Correct CDK_APP_PATH in docker run
kris-szlapa Jul 27, 2025
6f76e1b
Add STACK_NAME to cdk_package_code workflow and update build path for…
kris-szlapa Jul 27, 2025
09f3a4f
Remove kbName from VectorKnowledgeBaseProps
kris-szlapa Jul 27, 2025
451a3dd
Remove custom name property from VectorKnowledgeBaseResources
kris-szlapa Jul 27, 2025
ade81bb
Use this.node.addr in VectorKnowledgeBaseResources names
kris-szlapa Jul 27, 2025
278e49f
Shorten VectorKnowledgeBaseResources names to fit within AWS limits
kris-szlapa Jul 27, 2025
bac5b48
Use dynamic name for OpenSearchCollection
kris-szlapa Jul 27, 2025
f6cd1cb
Add hash to createHash
kris-szlapa Jul 27, 2025
caffb27
Add hash to collectionName in OpenSearchResources class
kris-szlapa Jul 27, 2025
2eeb7b9
Shorten collectionName to fit within AWS limits
kris-szlapa Jul 27, 2025
b577049
Add hash to names in VectorKnowledgeBaseResources
kris-szlapa Jul 27, 2025
d0b374f
Remove version.txt creation step that incorrectly sets CDK utils vers…
kris-szlapa Jul 27, 2025
0f88cbd
Create version.txt for CDK utils container
kris-szlapa Jul 27, 2025
51b77d7
Check for version.txt in cdk-utils-build container
kris-szlapa Jul 27, 2025
542cbd9
Extract files for debugging
kris-szlapa Jul 27, 2025
97045a8
Copy version.txt from Docker image into .build
kris-szlapa Jul 27, 2025
c80e6c4
Update copy version.txt step
kris-szlapa Jul 27, 2025
b238778
Print out version.txt path
kris-szlapa Jul 27, 2025
9ee946f
Clean up copy version.txt step
kris-szlapa Jul 27, 2025
be4528f
Extract IAM resources from stack
kris-szlapa Jul 27, 2025
7a57776
Switch from aws-bedrock to generative-ai-cdk-constructs in VectorKnow…
kris-szlapa Jul 28, 2025
0816c00
Restore native cdk constructs
kris-szlapa Jul 28, 2025
799f0e2
Replace wildcard import with specific named imports
kris-szlapa Jul 28, 2025
0a151aa
Extract vector index resources from stack
kris-szlapa Jul 28, 2025
19deae5
Update comment in stack
kris-szlapa Jul 28, 2025
79c780f
Remove unnecessary import
kris-szlapa Jul 28, 2025
5ce8a49
Add comments to cdk resources
kris-szlapa Jul 28, 2025
bdb9228
Remove unnecessary access policy for collection
kris-szlapa Jul 28, 2025
dc6ac3d
Remove hash from resource names
kris-szlapa Jul 28, 2025
414e50e
Remove white spaces
kris-szlapa Jul 28, 2025
46b53e0
Refactor OpenSearchCollection class
kris-szlapa Jul 28, 2025
0c85dc2
Simplify bucket names
kris-szlapa Jul 28, 2025
121b363
Enable quality checks step
kris-szlapa Jul 28, 2025
732763d
Update dependencies comment
kris-szlapa Jul 28, 2025
98c8c22
Add patterns to the .gitallowed file
kris-szlapa Jul 28, 2025
5b6a468
Add token pattern to .gitallowed file
kris-szlapa Jul 28, 2025
1b8ca73
Refactor the code
kris-szlapa Jul 28, 2025
794483c
Update nag suppressions
kris-szlapa Jul 28, 2025
94885a3
Add build-lambda-packages Makefile target
kris-szlapa Jul 28, 2025
0eccbd4
Remove missing context values check
kris-szlapa Jul 28, 2025
5950e87
Update stackName in build-lambda-packages Makefile target
kris-szlapa Jul 28, 2025
77ef777
Add cfn-guard suppressions for security violations
kris-szlapa Jul 28, 2025
589e8d0
Add cfg guard suppression
kris-szlapa Jul 28, 2025
8e10cb6
Amend addCfnGuardMetadata function with better debugging
kris-szlapa Jul 28, 2025
c68ea93
Update cfn guard rules suppression
kris-szlapa Jul 28, 2025
c009058
Allow cfn-guard to run and report security findings without blocking …
kris-szlapa Jul 28, 2025
e12bb57
Comment out quality_checks to allow deployment
kris-szlapa Jul 28, 2025
db176d4
Uncomment quality_checks step
kris-szlapa Jul 28, 2025
94270d5
Preserve existing guard metadata and merge with new rules
kris-szlapa Jul 28, 2025
95b2cb3
Remove unnecessary getSecretLayer pre-commit hook
kris-szlapa Jul 28, 2025
344906d
Remove ENABLE_MUTUAL_TLS variable
kris-szlapa Jul 28, 2025
1b1aab3
Remove unused accessLogBucket
kris-szlapa Jul 28, 2025
d82b57f
Suppress S3 server access logs for knowledge base documents bucket
kris-szlapa Jul 28, 2025
ba415cb
Restore quality check step
kris-szlapa Jul 28, 2025
056d652
Implement applyCfnGuardSuppressions function to suppress cfn guard
kris-szlapa Jul 28, 2025
732d6f2
Find all CfnResources of a specific CloudFormation type
kris-szlapa Jul 28, 2025
b043aa8
Add S3_BUCKET_DEFAULT_LOCK_ENABLED to the S3 bucket suppr
kris-szlapa Jul 28, 2025
0ebcb42
Remove unnecessary script for uploading AWS documentation
kris-szlapa Jul 29, 2025
8051d4f
Remove working directory setup from cdk_release_code steps
kris-szlapa Jul 29, 2025
e734d9f
Comment out quality checks
kris-szlapa Jul 29, 2025
b114703
Change Lambda code asset path to packageBasePath and remove build-lam…
kris-szlapa Jul 29, 2025
ff98854
Install Python Lambda dependencies directly into source directories
kris-szlapa Jul 29, 2025
4f54590
Remove copy version.txt step
kris-szlapa Jul 29, 2025
05c246c
Remove delete permissions from S3 access policy not needed for Bedroc…
kris-szlapa Jul 29, 2025
6097f17
Use managed policies in Functions resources
kris-szlapa Jul 29, 2025
8d94b68
Update nag suppressions
kris-szlapa Jul 29, 2025
301ae48
Create VectorKnowledgeBase construct after vector index
kris-szlapa Jul 29, 2025
ec852cd
Create slackBotManagedPolicy with wildcards initially
kris-szlapa Jul 29, 2025
40313be
Add KMS permissions directly to the Bedrock execution role policy
kris-szlapa Jul 29, 2025
3a1efe6
Update nag suppressions to include new wildcard permissions
kris-szlapa Jul 29, 2025
8b19a6c
Remove unnecessary imports
kris-szlapa Jul 29, 2025
4c032ee
Move slackBotManagedPolicy from Functions to IamResources
kris-szlapa Jul 29, 2025
fd9be1b
Add AAAA DNS record to provide IPv6 support
kris-szlapa Jul 29, 2025
59d044e
Remove stripping code from protocol logic
kris-szlapa Jul 29, 2025
908eca8
Update README with project structure section
kris-szlapa Jul 29, 2025
eb9fa90
Enable quality checks step
kris-szlapa Jul 29, 2025
521995f
Update NAG suppression for SlackBot managed policy
kris-szlapa Jul 29, 2025
8d5fe4b
Update nag suppressions for SlackBot managed policy
kris-szlapa Jul 29, 2025
17403a6
Correct conditional logic in S3Bucket and store LambdaEndpoint instance
kris-szlapa Jul 29, 2025
56ac982
Add Python Lambda code to Sonar coverage exclusion
kris-szlapa Jul 29, 2025
3b643c1
Rename variable input to query_input to avoid shadowing builtin
kris-szlapa Jul 29, 2025
cfcb197
Replace generic Exception class with RuntimeError
kris-szlapa Jul 29, 2025
d712fb8
Log exceptions in nag suspensions logic
kris-szlapa Jul 29, 2025
8c771c7
Remove unnecessary assertion
kris-szlapa Jul 29, 2025
a260b79
Remove useless variable assignment and instantiate LambdaEndpoint dir…
kris-szlapa Jul 29, 2025
a93dd04
Disable comment suppress unused variable warning
kris-szlapa Jul 29, 2025
1ece006
Convert IamResources to use declarative pattern
kris-szlapa Jul 29, 2025
01cdee7
Deploy code to main stack
kris-szlapa Jul 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu

# Install system dependencies
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
curl git build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget llvm \
libncurses5-dev libncursesw5-dev xz-utils tk-dev \
liblzma-dev python3-pip libffi-dev libyaml-dev
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y dist-upgrade \
&& apt-get -y install --no-install-recommends htop vim curl git build-essential \
libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev libbz2-dev \
zlib1g-dev unixodbc unixodbc-dev libsecret-1-0 libsecret-1-dev libsqlite3-dev \
jq apt-transport-https ca-certificates gnupg-agent \
software-properties-common bash-completion python3-pip make libbz2-dev \
libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev liblzma-dev netcat-openbsd libyaml-dev

# Install aws stuff
RUN wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \
unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
/tmp/aws-cli/aws/install && \
rm tmp/awscliv2.zip && \
rm -rf /tmp/aws-cli

# Set user to vscode
USER vscode
Expand Down Expand Up @@ -41,4 +52,5 @@ ADD .tool-versions /home/vscode/.tool-versions
RUN asdf install; \
asdf reshim python; \
asdf reshim poetry; \
asdf reshim nodejs; \
asdf direnv setup --shell bash --version 2.32.2;
3 changes: 3 additions & 0 deletions .gitallowed
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ sha256:[a-f0-9]{64}
.*=\s*"[><=!~^,0-9\s\.]+"
app = App\(token=bot_token\)
token=bot_token
token: slackBotToken
token: props\.slackBotToken
secretValue: JSON\.stringify\(\{token: props\.slackBotToken\}\)
8 changes: 8 additions & 0 deletions .github/workflows/cdk_package_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: cdk package code
on:
workflow_call:
inputs:
STACK_NAME:
required: true
type: string
VERSION_NUMBER:
required: true
type: string
Expand Down Expand Up @@ -56,6 +59,11 @@ jobs:
run: |
make install

- name: Build Python Lambda Functions
run: |
pip3 install -r packages/slackBotFunction/requirements.txt -t packages/slackBotFunction
pip3 install -r packages/createIndexFunction/requirements.txt -t packages/createIndexFunction

- name: 'Tar files'
run: |
tar -rf artifact.tar \
Expand Down
57 changes: 24 additions & 33 deletions .github/workflows/cdk_release_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
CDK_APP_NAME:
required: true
type: string
DEPLOY_CODE:
type: boolean
default: false
LOG_RETENTION_IN_DAYS:
required: true
type: string
Expand Down Expand Up @@ -74,7 +77,7 @@ jobs:
with:
name: build_artifact

- name: extract build_artifact
- name: Extract build_artifact
run: |
mkdir -p .build
tar -xf artifact.tar -C .build
Expand Down Expand Up @@ -106,6 +109,7 @@ jobs:
run: |
./.github/scripts/fix_cdk_json.sh
env:
ACCOUNT_ID: "${{ env.ACCOUNT_ID }}"
STACK_NAME: "${{ inputs.STACK_NAME }}"
VERSION_NUMBER: "${{ inputs.VERSION_NUMBER }}"
COMMIT_ID: "${{ inputs.COMMIT_ID }}"
Expand All @@ -117,35 +121,29 @@ jobs:
- name: Show diff
run: |
docker run \
-v "$(pwd)/.build":/home/cdkuser/workspace/ \
-e AWS_ACCESS_KEY_ID=${{ steps.connect-aws.outputs.aws-access-key-id }} \
-e AWS_SECRET_ACCESS_KEY=${{ steps.connect-aws.outputs.aws-secret-access-key }} \
-e AWS_SESSION_TOKEN=${{ steps.connect-aws.outputs.aws-session-token }} \
-e AWS_REGION="eu-west-2" \
-e stack_name="${{ inputs.STACK_NAME }}" \
-e VERSION_NUMBER="${{ inputs.VERSION_NUMBER}}" \
-e COMMIT_ID="${{ inputs.COMMIT_ID}}" \
-e SHOW_DIFF="true" \
-e DEPLOY_CODE="false" \
-e CDK_APP_PATH="packages/cdk/bin/EpsAssistMeApp.ts" \
cdk-utils-build-repo:latest
shell: bash
-v "$(pwd)/.build":/home/cdkuser/workspace/ \
-e AWS_ACCESS_KEY_ID=${{ steps.connect-aws.outputs.aws-access-key-id }} \
-e AWS_SECRET_ACCESS_KEY=${{ steps.connect-aws.outputs.aws-secret-access-key }} \
-e AWS_SESSION_TOKEN=${{ steps.connect-aws.outputs.aws-session-token }} \
-e AWS_REGION="eu-west-2" \
-e SHOW_DIFF="true" \
-e DEPLOY_CODE="false" \
-e CDK_APP_PATH="packages/cdk/bin/EpsAssistMeApp.ts" \
cdk-utils-build-repo:latest

- name: Deploy code
if: ${{ inputs.DEPLOY_CODE == true }}
run: |
docker run \
-v "$(pwd)/.build":/home/cdkuser/workspace/ \
-e AWS_ACCESS_KEY_ID=${{ steps.connect-aws.outputs.aws-access-key-id }} \
-e AWS_SECRET_ACCESS_KEY=${{ steps.connect-aws.outputs.aws-secret-access-key }} \
-e AWS_SESSION_TOKEN=${{ steps.connect-aws.outputs.aws-session-token }} \
-e AWS_REGION="eu-west-2" \
-e stack_name="${{ inputs.STACK_NAME }}" \
-e VERSION_NUMBER="${{ inputs.VERSION_NUMBER}}" \
-e COMMIT_ID="${{ inputs.COMMIT_ID}}" \
-e SHOW_DIFF="false" \
-e DEPLOY_CODE="true" \
-e CDK_APP_PATH="packages/cdk/bin/EpsAssistMeApp.ts" \
cdk-utils-build-repo:latest
-v "$(pwd)/.build":/home/cdkuser/workspace/ \
-e AWS_ACCESS_KEY_ID=${{ steps.connect-aws.outputs.aws-access-key-id }} \
-e AWS_SECRET_ACCESS_KEY=${{ steps.connect-aws.outputs.aws-secret-access-key }} \
-e AWS_SESSION_TOKEN=${{ steps.connect-aws.outputs.aws-session-token }} \
-e AWS_REGION="eu-west-2" \
-e SHOW_DIFF="false" \
-e DEPLOY_CODE="true" \
-e CDK_APP_PATH="packages/cdk/bin/EpsAssistMeApp.ts" \
cdk-utils-build-repo:latest
shell: bash

- name: mark_released_in_jira
Expand All @@ -162,13 +160,6 @@ jobs:
ref: gh-pages
path: gh-pages

- name: Checkout gh-pages
if: ${{ !startsWith(inputs.STACK_NAME, 'lambda-resources-pr-') }}
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages

- name: Update release tag in github pages
if: ${{ !startsWith(inputs.STACK_NAME, 'epsam-pr-') }}
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
needs: [get_commit_id, tag_release]
uses: ./.github/workflows/cdk_package_code.yml
with:
STACK_NAME: epsam
VERSION_NUMBER: ${{ needs.tag_release.outputs.version_tag }}
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}

Expand All @@ -110,6 +111,7 @@ jobs:
VERSION_NUMBER: ${{ needs.tag_release.outputs.version_tag }}
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
CDK_APP_NAME: EpsAssistMeApp
DEPLOY_CODE: true
LOG_RETENTION_IN_DAYS: 30
LOG_LEVEL: DEBUG
MARK_JIRA_RELEASED: false
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,22 @@ jobs:
needs: [get_issue_number, get_commit_id]
uses: ./.github/workflows/cdk_package_code.yml
with:
STACK_NAME: epsam
VERSION_NUMBER: PR-${{ needs.get_issue_number.outputs.issue_number }}
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}

release_code:
needs: [get_issue_number, package_code, get_commit_id]
uses: ./.github/workflows/cdk_release_code.yml
with:
STACK_NAME: epsam-pr-${{needs.get_issue_number.outputs.issue_number}}
STACK_NAME: epsam
TARGET_ENVIRONMENT: dev-pr
VERSION_NUMBER: PR-${{ needs.get_issue_number.outputs.issue_number }}
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
CDK_APP_NAME: EpsAssistMeApp
DEPLOY_CODE: true
LOG_RETENTION_IN_DAYS: 30
LOG_LEVEL: DEBUG

secrets:
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
CDK_PULL_IMAGE_ROLE: ${{ secrets.DEV_CDK_PULL_IMAGE_ROLE }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
needs: [get_commit_id, tag_release]
uses: ./.github/workflows/cdk_package_code.yml
with:
STACK_NAME: epsam
VERSION_NUMBER: ${{ needs.tag_release.outputs.version_tag }}
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}

Expand All @@ -129,6 +130,7 @@ jobs:
VERSION_NUMBER: ${{ needs.tag_release.outputs.version_tag }}
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
CDK_APP_NAME: EpsAssistMeApp
DEPLOY_CODE: true
LOG_RETENTION_IN_DAYS: 30
LOG_LEVEL: DEBUG
secrets:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ _site/
vendor
.npmrc
cdk.out
.build
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nodejs 22.12.0
python 3.12.7
python 3.13.3
poetry 1.8.3
shellcheck 0.10.0
direnv 2.32.2
Expand Down
8 changes: 8 additions & 0 deletions .vscode/eps-assist-me.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
{
"name": "packages/cdk",
"path": "../packages/cdk"
},
{
"name": "packages/createIndexFunction",
"path": "../packages/createIndexFunction"
},
{
"name": "packages/slackBotFunction",
"path": "../packages/slackBotFunction"
}
],
"settings": {
Expand Down
56 changes: 47 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,37 @@ install-hooks: install-python
install-node:
npm ci

compile-node:
npx tsc --build tsconfig.build.json

pre-commit: git-secrets-docker-setup
poetry run pre-commit run --all-files

git-secrets-docker-setup:
export LOCAL_WORKSPACE_FOLDER=$(pwd)
docker build -f https://raw.githubusercontent.com/NHSDigital/eps-workflow-quality-checks/refs/tags/v4.0.4/dockerfiles/nhsd-git-secrets.dockerfile -t git-secrets .

lint: lint-githubactions lint-githubaction-scripts

lint-githubactions:
actionlint

lint-githubaction-scripts:
shellcheck ./scripts/*.sh
shellcheck .github/scripts/*.sh

lint: lint-githubactions lint-githubaction-scripts
test: compile-node
npm run test --workspace packages/cdk

clean:
rm -rf packages/cdk/coverage
rm -rf packages/cdk/lib
rm -rf cdk.out
rm -rf .build

deep-clean: clean
rm -rf .venv
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

check-licenses: check-licenses-node check-licenses-python

Expand All @@ -43,6 +60,12 @@ check-licenses-python:
aws-configure:
aws configure sso --region eu-west-2

aws-login:
aws sso login --sso-session sso-session

cfn-guard:
./scripts/run_cfn_guard.sh

cdk-deploy: guard-stack_name
REQUIRE_APPROVAL="$${REQUIRE_APPROVAL:-any-change}" && \
VERSION_NUMBER="$${VERSION_NUMBER:-undefined}" && \
Expand All @@ -52,23 +75,34 @@ cdk-deploy: guard-stack_name
--all \
--ci true \
--require-approval $${REQUIRE_APPROVAL} \
--context accountId=$$ACCOUNT_ID \
--context stackName=$$stack_name \
--context VERSION_NUMBER=$$VERSION_NUMBER \
--context COMMIT_ID=$$COMMIT_ID
--context versionNumber=$$VERSION_NUMBER \
--context commitId=$$COMMIT_ID \
--context logRetentionInDays=$$LOG_RETENTION_IN_DAYS \
--context slackBotToken=$$SLACK_BOT_TOKEN \
--context slackSigningSecret=$$SLACK_SIGNING_SECRET

cdk-synth:
npx cdk synth \
--quiet \
--app "npx ts-node --prefer-ts-exts packages/cdk/bin/EpsAssistMeApp.ts" \
--context accountId=undefined \
--context stackName=epsam \
--context VERSION_NUMBER=undefined \
--context COMMIT_ID=undefined
--context versionNumber=undefined \
--context commitId=undefined \
--context logRetentionInDays=30 \
--context slackBotToken=dummy \
--context slackSigningSecret=dummy

cdk-diff:
npx cdk diff \
--app "npx ts-node --prefer-ts-exts packages/cdk/bin/EpsAssistMeApp.ts" \
--context accountId=$$ACCOUNT_ID \
--context stackName=$$stack_name \
--context VERSION_NUMBER=$$VERSION_NUMBER \
--context COMMIT_ID=$$COMMIT_ID
--context versionNumber=$$VERSION_NUMBER \
--context commitId=$$COMMIT_ID \
--context logRetentionInDays=$$LOG_RETENTION_IN_DAYS

cdk-watch: guard-stack_name
REQUIRE_APPROVAL="$${REQUIRE_APPROVAL:-any-change}" && \
Expand All @@ -80,6 +114,10 @@ cdk-watch: guard-stack_name
--all \
--ci true \
--require-approval $${REQUIRE_APPROVAL} \
--context accountId=$$ACCOUNT_ID \
--context stackName=$$stack_name \
--context VERSION_NUMBER=$$VERSION_NUMBER \
--context COMMIT_ID=$$COMMIT_ID
--context versionNumber=$$VERSION_NUMBER \
--context commitId=$$COMMIT_ID \
--context logRetentionInDays=$$LOG_RETENTION_IN_DAYS \
--context slackBotToken=$$SLACK_BOT_TOKEN \
--context slackSigningSecret=$$SLACK_SIGNING_SECRET
Loading