From 3c4fd168e430a4154f6c98f6d86cc72d0abee5f8 Mon Sep 17 00:00:00 2001 From: Matthew Crouch Date: Fri, 20 Dec 2024 16:29:34 -0500 Subject: [PATCH] GQL-98: Update cdk util library --- README.md | 10 +++++--- cdk/graphql-infrastructure/package-lock.json | 8 +++--- cdk/graphql-infrastructure/package.json | 2 +- cdk/graphql/lib/graphql-stack.ts | 26 ++++++++++++-------- cdk/graphql/package-lock.json | 8 +++--- cdk/graphql/package.json | 2 +- 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 14c6bc598..c0354a0c8 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,13 @@ To install Node dependencies: npm install -You will also need Python3.11+ (Ideally installed in a virtual environment) to query the collection generateVariableDrafts field. Run the following to ensure proper operation of this query. +Note: The generateVariableDrafts is currently not working in the development environment. These steps do not work with the CDK changes. - python3 -m venv .venv - source .venv/bin/activate - pip install -r requirements.txt + You will also need Python3.11+ (Ideally installed in a virtual environment) to query the collection generateVariableDrafts field. Run the following to ensure proper operation of this query. + + python3 -m venv .venv + source .venv/bin/activate + pip install -r requirements.txt ### Environment Variables diff --git a/cdk/graphql-infrastructure/package-lock.json b/cdk/graphql-infrastructure/package-lock.json index b3631bcbe..0b234f4ba 100644 --- a/cdk/graphql-infrastructure/package-lock.json +++ b/cdk/graphql-infrastructure/package-lock.json @@ -8,7 +8,7 @@ "name": "graphql-infrastructure", "version": "0.1.0", "dependencies": { - "@edsc/cdk-utils": "^0.0.1", + "@edsc/cdk-utils": "^0.0.2", "aws-cdk-lib": "^2.173.2", "constructs": "^10.0.0" }, @@ -1514,9 +1514,9 @@ } }, "node_modules/@edsc/cdk-utils": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@edsc/cdk-utils/-/cdk-utils-0.0.1.tgz", - "integrity": "sha512-41gl0grAAIuNeF1pqcvfFBIH59Sa5mmcCgO/LVQfvfjHu3Ph34tYSnT+ZPvQ+KMi3cFzMSxd0sNmxXF6FijmgQ==", + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@edsc/cdk-utils/-/cdk-utils-0.0.2.tgz", + "integrity": "sha512-pl2/jef5hJtsnGC+NArBP1OWGSTrsLpxZVSx7PoJr3rpgVhxpMwxlC4eGkKnO3hxGGu7G9u6G/Jl+ycuzyWkvQ==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-s3": "^3.713.0", diff --git a/cdk/graphql-infrastructure/package.json b/cdk/graphql-infrastructure/package.json index 56f453bed..ae329326f 100644 --- a/cdk/graphql-infrastructure/package.json +++ b/cdk/graphql-infrastructure/package.json @@ -20,7 +20,7 @@ "typescript": "~5.6.3" }, "dependencies": { - "@edsc/cdk-utils": "^0.0.1", + "@edsc/cdk-utils": "^0.0.2", "aws-cdk-lib": "^2.173.2", "constructs": "^10.0.0" } diff --git a/cdk/graphql/lib/graphql-stack.ts b/cdk/graphql/lib/graphql-stack.ts index 07ce9a2c1..179fe18d8 100644 --- a/cdk/graphql/lib/graphql-stack.ts +++ b/cdk/graphql/lib/graphql-stack.ts @@ -128,17 +128,23 @@ export class GraphqlStack extends cdk.Stack { logGroupName: `/aws/lambda/${this.stackName}-earthdataVarinfo${logGroupSuffix}`, }); + // In production, we build the lambda with build-python.sh + let earthdataVarinfoCode = lambda.Code.fromAsset('../../src/earthdataVarinfo'); + if (NODE_ENV === 'development') { + // In development, build the lambda with the Python bundling image + earthdataVarinfoCode = lambda.Code.fromAsset('../../src/earthdataVarinfo', { + bundling: { + command: [ + 'bash', '-c', + 'pip install -r requirements.txt -t /asset-output && cp -au . /asset-output', + ], + image: lambda.Runtime.PYTHON_3_11.bundlingImage, + } + }); + } + const earthdataVarinfoLambdaFunction = new lambda.Function(this, 'EarthdataVarinfoLambdaFunction', { - // TODO does this work in dev? - code: lambda.Code.fromAsset('../../src/earthdataVarinfo', {// I switched this to happen in deploy_bamboo.sh during deployments - // bundling: { - // command: [ - // 'bash', '-c', - // 'pip install -r requirements.txt -t /asset-output && cp -au . /asset-output', - // ], - // image: lambda.Runtime.PYTHON_3_11.bundlingImage, - // } - }), + code: earthdataVarinfoCode, currentVersionOptions: { removalPolicy: cdk.RemovalPolicy.RETAIN }, diff --git a/cdk/graphql/package-lock.json b/cdk/graphql/package-lock.json index ce6387c71..0424cbc92 100644 --- a/cdk/graphql/package-lock.json +++ b/cdk/graphql/package-lock.json @@ -8,7 +8,7 @@ "name": "graphql", "version": "0.1.0", "dependencies": { - "@edsc/cdk-utils": "^0.0.1", + "@edsc/cdk-utils": "^0.0.2", "aws-cdk-lib": "^2.173.2", "constructs": "^10.0.0" }, @@ -1515,9 +1515,9 @@ } }, "node_modules/@edsc/cdk-utils": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@edsc/cdk-utils/-/cdk-utils-0.0.1.tgz", - "integrity": "sha512-41gl0grAAIuNeF1pqcvfFBIH59Sa5mmcCgO/LVQfvfjHu3Ph34tYSnT+ZPvQ+KMi3cFzMSxd0sNmxXF6FijmgQ==", + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@edsc/cdk-utils/-/cdk-utils-0.0.2.tgz", + "integrity": "sha512-pl2/jef5hJtsnGC+NArBP1OWGSTrsLpxZVSx7PoJr3rpgVhxpMwxlC4eGkKnO3hxGGu7G9u6G/Jl+ycuzyWkvQ==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-s3": "^3.713.0", diff --git a/cdk/graphql/package.json b/cdk/graphql/package.json index bc18463c7..704c21894 100644 --- a/cdk/graphql/package.json +++ b/cdk/graphql/package.json @@ -21,7 +21,7 @@ "typescript": "~5.6.3" }, "dependencies": { - "@edsc/cdk-utils": "^0.0.1", + "@edsc/cdk-utils": "^0.0.2", "aws-cdk-lib": "^2.173.2", "constructs": "^10.0.0" }