From c4b34825848801f72aa8cc9ec9255f835cbabf12 Mon Sep 17 00:00:00 2001 From: Adam Bigelow Date: Tue, 4 Oct 2022 20:38:23 +0000 Subject: [PATCH 01/14] fix(lambda-python): export poetry dependencies without hashes to prevent failures --- packages/@aws-cdk/aws-lambda-python/lib/packaging.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index 55f9118cd3ff1..bc221000c6251 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -46,7 +46,7 @@ export class Packaging { public static readonly POETRY = new Packaging({ dependenciesFile: DependenciesFile.POETRY, // Export dependencies with credentials avaiable in the bundling image. - exportCommand: `poetry export --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, + exportCommand: `poetry export --without-hashes --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, }); /** From c3f8d12cad1e847c83e691f66ece4e5c0f626e22 Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Tue, 4 Oct 2022 17:54:00 -0400 Subject: [PATCH 02/14] tests(aws-lambda-python): add --without-hashes flag to expected poetry command --- packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts index e9c598d795af7..e49f2ebe914cf 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts @@ -176,7 +176,7 @@ test('Bundling a function with poetry dependencies', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'cp -rTL /asset-input/ /asset-output/python && cd /asset-output/python && poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python', + 'cp -rTL /asset-input/ /asset-output/python && cd /asset-output/python && poetry export --without-hashes --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python', ], }), })); From d42e780c399fe115e65329859e62f79d08e419c2 Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Wed, 5 Oct 2022 13:29:02 -0400 Subject: [PATCH 03/14] chore(aws-lambda-python): force new poetry integ test snapshots --- .../index.js | 103 ++++++-- .../integ-lambda-python-poetry.assets.json | 22 +- .../integ-lambda-python-poetry.template.json | 6 +- .../manifest.json | 34 +-- ...efaultTestDeployAssertE9C9CB8F.assets.json | 10 +- ...aultTestDeployAssertE9C9CB8F.template.json | 92 ++------ .../function.poetry.integ.snapshot/tree.json | 220 ++++-------------- 7 files changed, 164 insertions(+), 323 deletions(-) rename packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/{asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle => asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle}/index.js (88%) diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle/index.js similarity index 88% rename from packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js rename to packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle/index.js index ba956d47f51fe..a9e7e7241efc7 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle/index.js @@ -404,20 +404,11 @@ var CustomResourceHandler = class { } async handle() { try { - console.log(`Event: ${JSON.stringify({ ...this.event, ResponseURL: "..." })}`); const response = await this.processEvent(this.event.ResourceProperties); - console.log(`Event output : ${JSON.stringify(response)}`); - await this.respond({ - status: "SUCCESS", - reason: "OK", - data: response - }); + return response; } catch (e) { console.log(e); - await this.respond({ - status: "FAILED", - reason: e.message ?? "Internal Error" - }); + throw e; } finally { clearTimeout(this.timeout); } @@ -479,7 +470,8 @@ var AssertionHandler = class extends CustomResourceHandler { matchResult.finished(); if (matchResult.hasFailed()) { result = { - data: JSON.stringify({ + failed: true, + assertion: JSON.stringify({ status: "fail", message: [ ...matchResult.toHumanStrings(), @@ -488,11 +480,11 @@ var AssertionHandler = class extends CustomResourceHandler { }) }; if (request2.failDeployment) { - throw new Error(result.data); + throw new Error(result.assertion); } } else { result = { - data: JSON.stringify({ + assertion: JSON.stringify({ status: "success" }) }; @@ -562,7 +554,10 @@ function flatten(object) { {}, ...function _flatten(child, path = []) { return [].concat(...Object.keys(child).map((key) => { - const childKey = Buffer.isBuffer(child[key]) ? child[key].toString("utf8") : child[key]; + let childKey = Buffer.isBuffer(child[key]) ? child[key].toString("utf8") : child[key]; + if (typeof childKey === "string") { + childKey = isJsonString(childKey); + } return typeof childKey === "object" && childKey !== null ? _flatten(childKey, path.concat([key])) : { [path.concat([key]).join(".")]: childKey }; })); }(object) @@ -572,6 +567,9 @@ var AwsApiCallHandler = class extends CustomResourceHandler { async processEvent(request2) { const AWS = require("aws-sdk"); console.log(`AWS SDK VERSION: ${AWS.VERSION}`); + if (!Object.prototype.hasOwnProperty.call(AWS, request2.service)) { + throw Error(`Service ${request2.service} does not exist in AWS SDK version ${AWS.VERSION}.`); + } const service = new AWS[request2.service](); const response = await service[request2.api](request2.parameters && decode(request2.parameters)).promise(); console.log(`SDK response received ${JSON.stringify(response)}`); @@ -582,9 +580,18 @@ var AwsApiCallHandler = class extends CustomResourceHandler { const flatData = { ...flatten(respond) }; - return request2.flattenResponse === "true" ? flatData : respond; + const resp = request2.flattenResponse === "true" ? flatData : respond; + console.log(`Returning result ${JSON.stringify(resp)}`); + return resp; } }; +function isJsonString(value) { + try { + return JSON.parse(value); + } catch { + return value; + } +} // lib/assertions/providers/lambda-handler/types.ts var ASSERT_RESOURCE_TYPE = "Custom::DeployAssert@AssertEquals"; @@ -592,18 +599,68 @@ var SDK_RESOURCE_TYPE_PREFIX = "Custom::DeployAssert@SdkCall"; // lib/assertions/providers/lambda-handler/index.ts async function handler(event, context) { + console.log(`Event: ${JSON.stringify({ ...event, ResponseURL: "..." })}`); const provider = createResourceHandler(event, context); - await provider.handle(); + try { + if (event.RequestType === "Delete") { + await provider.respond({ + status: "SUCCESS", + reason: "OK" + }); + return; + } + const result = await provider.handle(); + const actualPath = event.ResourceProperties.actualPath; + const actual = actualPath ? result[`apiCallResponse.${actualPath}`] : result.apiCallResponse; + if ("expected" in event.ResourceProperties) { + const assertion = new AssertionHandler({ + ...event, + ResourceProperties: { + ServiceToken: event.ServiceToken, + actual, + expected: event.ResourceProperties.expected + } + }, context); + try { + const assertionResult = await assertion.handle(); + await provider.respond({ + status: "SUCCESS", + reason: "OK", + data: { + ...assertionResult, + ...result + } + }); + return; + } catch (e) { + await provider.respond({ + status: "FAILED", + reason: e.message ?? "Internal Error" + }); + return; + } + } + await provider.respond({ + status: "SUCCESS", + reason: "OK", + data: result + }); + } catch (e) { + await provider.respond({ + status: "FAILED", + reason: e.message ?? "Internal Error" + }); + return; + } + return; } function createResourceHandler(event, context) { if (event.ResourceType.startsWith(SDK_RESOURCE_TYPE_PREFIX)) { return new AwsApiCallHandler(event, context); - } - switch (event.ResourceType) { - case ASSERT_RESOURCE_TYPE: - return new AssertionHandler(event, context); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); + } else if (event.ResourceType.startsWith(ASSERT_RESOURCE_TYPE)) { + return new AssertionHandler(event, context); + } else { + throw new Error(`Unsupported resource type "${event.ResourceType}`); } } // Annotate the CommonJS export names for ESM import in node: diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json index 1b2daf3089b55..ee3e31e86093f 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json @@ -1,46 +1,46 @@ { "version": "21.0.0", "files": { - "c61e0f11a70b8ae390550b4477f611d7548cddc58c9a1808b8fa738c84e8849a": { + "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3": { "source": { - "path": "asset.c61e0f11a70b8ae390550b4477f611d7548cddc58c9a1808b8fa738c84e8849a", + "path": "asset.9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "c61e0f11a70b8ae390550b4477f611d7548cddc58c9a1808b8fa738c84e8849a.zip", + "objectKey": "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "6d591f099499066675f839dee783892f055c6748cad3ec707031bfb839a7dcf6": { + "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d": { "source": { - "path": "asset.6d591f099499066675f839dee783892f055c6748cad3ec707031bfb839a7dcf6", + "path": "asset.f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "6d591f099499066675f839dee783892f055c6748cad3ec707031bfb839a7dcf6.zip", + "objectKey": "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "bc90fc78bab5daff01b73ec5433b085e4324b6956f1c77d320a2d54fb8eb03f1": { + "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec": { "source": { - "path": "asset.bc90fc78bab5daff01b73ec5433b085e4324b6956f1c77d320a2d54fb8eb03f1", + "path": "asset.e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "bc90fc78bab5daff01b73ec5433b085e4324b6956f1c77d320a2d54fb8eb03f1.zip", + "objectKey": "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "8112ad5508e2643bdc358860414feb34c0375b34b86dfdaec27fab32c38ea900": { + "82b489749eaabed0e009eb9fff1d35a4c9fc7bc4b1614c788a84481f99032f73": { "source": { "path": "integ-lambda-python-poetry.template.json", "packaging": "file" @@ -48,7 +48,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8112ad5508e2643bdc358860414feb34c0375b34b86dfdaec27fab32c38ea900.json", + "objectKey": "82b489749eaabed0e009eb9fff1d35a4c9fc7bc4b1614c788a84481f99032f73.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json index c9954042be36b..b63d60d7d8497 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json @@ -38,7 +38,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "c61e0f11a70b8ae390550b4477f611d7548cddc58c9a1808b8fa738c84e8849a.zip" + "S3Key": "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3.zip" }, "Role": { "Fn::GetAtt": [ @@ -91,7 +91,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "6d591f099499066675f839dee783892f055c6748cad3ec707031bfb839a7dcf6.zip" + "S3Key": "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d.zip" }, "Role": { "Fn::GetAtt": [ @@ -144,7 +144,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "bc90fc78bab5daff01b73ec5433b085e4324b6956f1c77d320a2d54fb8eb03f1.zip" + "S3Key": "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec.zip" }, "Role": { "Fn::GetAtt": [ diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json index ca49d8411e8cf..f8fd909788fa8 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8112ad5508e2643bdc358860414feb34c0375b34b86dfdaec27fab32c38ea900.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/82b489749eaabed0e009eb9fff1d35a4c9fc7bc4b1614c788a84481f99032f73.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -124,7 +124,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/6124f12c447c253e12d289b2cbb005676d5dd3f56d70cb3213d2c534caae16cc.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dbf8a3a98e250321c8158725e3c55158815b3610f42e036de4a1d9e1cd8f89d1.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -153,16 +153,10 @@ "data": "LambdaInvoke81c9998b1b428b309c8501e21b919d3dInvokeEBA46CA4" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke/Default/Default": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "LambdaInvoke81c9998b1b428b309c8501e21b919d3dAssertEqualsLambdainvoke0BDD9934" - } - ], - "/poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke/AssertionResults": [ - { - "type": "aws:cdk:logicalId", - "data": "AssertionResultsAssertEqualsLambdainvoke7418f30d48b25a0240557aece0f9bcb3" + "data": "AssertionResultsLambdaInvoke81c9998b1b428b309c8501e21b919d3d" } ], "/poetry/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role": [ @@ -189,16 +183,10 @@ "data": "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292InvokeFD76DE7B" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke/Default/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292AssertEqualsLambdainvoke3F6858A2" - } - ], - "/poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke/AssertionResults": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "AssertionResultsAssertEqualsLambdainvoke3a1682daaa67c2d3f1c57ad30bb121be" + "data": "AssertionResultsLambdaInvoke9a0beb4ea6cc38db92e9ff664c085292" } ], "/poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/Default/Default": [ @@ -213,16 +201,10 @@ "data": "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75Invoke11F9A252" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke/Default/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75AssertEqualsLambdainvoke2346EE1F" - } - ], - "/poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke/AssertionResults": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "AssertionResultsAssertEqualsLambdainvoke71fd18c839842d08b4fd70cd8691cb1f" + "data": "AssertionResultsLambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75" } ], "/poetry/DefaultTest/DeployAssert/BootstrapVersion": [ diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json index 1d5bf07a5344f..61d7d28e30860 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json @@ -1,20 +1,20 @@ { "version": "21.0.0", "files": { - "84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7": { + "d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb": { "source": { - "path": "asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle", + "path": "asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.zip", + "objectKey": "d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "6124f12c447c253e12d289b2cbb005676d5dd3f56d70cb3213d2c534caae16cc": { + "dbf8a3a98e250321c8158725e3c55158815b3610f42e036de4a1d9e1cd8f89d1": { "source": { "path": "poetryDefaultTestDeployAssertE9C9CB8F.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "6124f12c447c253e12d289b2cbb005676d5dd3f56d70cb3213d2c534caae16cc.json", + "objectKey": "dbf8a3a98e250321c8158725e3c55158815b3610f42e036de4a1d9e1cd8f89d1.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json index 634e3f92ddaf6..c0d79c49eb3ad 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json @@ -11,13 +11,14 @@ }, "service": "Lambda", "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", "parameters": { "FunctionName": { "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinline53D120C7B0898676" } }, "flattenResponse": "false", - "salt": "1662643425337" + "salt": "1664990286225" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -37,27 +38,6 @@ } } }, - "LambdaInvoke81c9998b1b428b309c8501e21b919d3dAssertEqualsLambdainvoke0BDD9934": { - "Type": "Custom::DeployAssert@AssertEquals", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", - "Arn" - ] - }, - "actual": { - "Fn::GetAtt": [ - "LambdaInvoke81c9998b1b428b309c8501e21b919d3d", - "apiCallResponse" - ] - }, - "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", - "salt": "1662643425338" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": { "Type": "AWS::IAM::Role", "Properties": { @@ -218,7 +198,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.zip" + "S3Key": "d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.zip" }, "Timeout": 120, "Handler": "index.handler", @@ -241,13 +221,14 @@ }, "service": "Lambda", "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", "parameters": { "FunctionName": { "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython384D62BBB58AA8B940" } }, "flattenResponse": "false", - "salt": "1662643425339" + "salt": "1664990286226" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -267,27 +248,6 @@ } } }, - "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292AssertEqualsLambdainvoke3F6858A2": { - "Type": "Custom::DeployAssert@AssertEquals", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", - "Arn" - ] - }, - "actual": { - "Fn::GetAtt": [ - "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292", - "apiCallResponse" - ] - }, - "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", - "salt": "1662643425339" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75": { "Type": "Custom::DeployAssert@SdkCallLambdainvoke", "Properties": { @@ -299,13 +259,14 @@ }, "service": "Lambda", "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", "parameters": { "FunctionName": { "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37C34039A7BB71D94D" } }, "flattenResponse": "false", - "salt": "1662643425339" + "salt": "1664990286226" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -324,51 +285,30 @@ ] } } - }, - "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75AssertEqualsLambdainvoke2346EE1F": { - "Type": "Custom::DeployAssert@AssertEquals", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", - "Arn" - ] - }, - "actual": { - "Fn::GetAtt": [ - "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75", - "apiCallResponse" - ] - }, - "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", - "salt": "1662643425339" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" } }, "Outputs": { - "AssertionResultsAssertEqualsLambdainvoke7418f30d48b25a0240557aece0f9bcb3": { + "AssertionResultsLambdaInvoke81c9998b1b428b309c8501e21b919d3d": { "Value": { "Fn::GetAtt": [ - "LambdaInvoke81c9998b1b428b309c8501e21b919d3dAssertEqualsLambdainvoke0BDD9934", - "data" + "LambdaInvoke81c9998b1b428b309c8501e21b919d3d", + "assertion" ] } }, - "AssertionResultsAssertEqualsLambdainvoke3a1682daaa67c2d3f1c57ad30bb121be": { + "AssertionResultsLambdaInvoke9a0beb4ea6cc38db92e9ff664c085292": { "Value": { "Fn::GetAtt": [ - "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292AssertEqualsLambdainvoke3F6858A2", - "data" + "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292", + "assertion" ] } }, - "AssertionResultsAssertEqualsLambdainvoke71fd18c839842d08b4fd70cd8691cb1f": { + "AssertionResultsLambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75": { "Value": { "Fn::GetAtt": [ - "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75AssertEqualsLambdainvoke2346EE1F", - "data" + "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75", + "assertion" ] } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json index 79fdc9449e9f8..33eb64c918561 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.95" + "version": "10.1.108" } }, "integ-lambda-python-poetry": { @@ -105,7 +105,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "c61e0f11a70b8ae390550b4477f611d7548cddc58c9a1808b8fa738c84e8849a.zip" + "s3Key": "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3.zip" }, "role": { "Fn::GetAtt": [ @@ -217,7 +217,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "6d591f099499066675f839dee783892f055c6748cad3ec707031bfb839a7dcf6.zip" + "s3Key": "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d.zip" }, "role": { "Fn::GetAtt": [ @@ -329,7 +329,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "bc90fc78bab5daff01b73ec5433b085e4324b6956f1c77d320a2d54fb8eb03f1.zip" + "s3Key": "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec.zip" }, "role": { "Fn::GetAtt": [ @@ -383,7 +383,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.95" + "version": "10.1.108" } } }, @@ -405,7 +405,7 @@ "path": "poetry/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.95" + "version": "10.1.108" } }, "DeployAssert": { @@ -425,13 +425,13 @@ "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.95" + "version": "10.1.108" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" } }, "Default": { @@ -460,64 +460,18 @@ "version": "0.0.0" } }, - "AssertEqualsLambdainvoke": { - "id": "AssertEqualsLambdainvoke", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke", - "children": { - "AssertionProvider": { - "id": "AssertionProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke/AssertionProvider", - "children": { - "AssertionsProvider": { - "id": "AssertionsProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke/AssertionProvider/AssertionsProvider", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" - } - }, - "Default": { - "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke/Default", - "children": { - "Default": { - "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke/Default/Default", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CustomResource", - "version": "0.0.0" - } - }, - "AssertionResults": { - "id": "AssertionResults", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertEqualsLambdainvoke/AssertionResults", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - } - }, + "AssertionResults": { + "id": "AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/AssertionResults", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" } }, "SingletonFunction1488541a7b23466481b69b4408076b81": { @@ -551,7 +505,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.95" + "version": "10.1.108" } }, "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292": { @@ -567,13 +521,13 @@ "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.95" + "version": "10.1.108" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" } }, "Default": { @@ -602,64 +556,18 @@ "version": "0.0.0" } }, - "AssertEqualsLambdainvoke": { - "id": "AssertEqualsLambdainvoke", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke", - "children": { - "AssertionProvider": { - "id": "AssertionProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke/AssertionProvider", - "children": { - "AssertionsProvider": { - "id": "AssertionsProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke/AssertionProvider/AssertionsProvider", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" - } - }, - "Default": { - "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke/Default", - "children": { - "Default": { - "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke/Default/Default", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CustomResource", - "version": "0.0.0" - } - }, - "AssertionResults": { - "id": "AssertionResults", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertEqualsLambdainvoke/AssertionResults", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - } - }, + "AssertionResults": { + "id": "AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/AssertionResults", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" } }, "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75": { @@ -675,13 +583,13 @@ "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.95" + "version": "10.1.108" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" } }, "Default": { @@ -710,64 +618,18 @@ "version": "0.0.0" } }, - "AssertEqualsLambdainvoke": { - "id": "AssertEqualsLambdainvoke", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke", - "children": { - "AssertionProvider": { - "id": "AssertionProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke/AssertionProvider", - "children": { - "AssertionsProvider": { - "id": "AssertionsProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke/AssertionProvider/AssertionsProvider", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" - } - }, - "Default": { - "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke/Default", - "children": { - "Default": { - "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke/Default/Default", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CustomResource", - "version": "0.0.0" - } - }, - "AssertionResults": { - "id": "AssertionResults", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertEqualsLambdainvoke/AssertionResults", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - } - }, + "AssertionResults": { + "id": "AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/AssertionResults", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" } } }, @@ -778,14 +640,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.95" + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" } } }, From 0bf70c0680b87d382b14a22e513b873b7a10f1a9 Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Wed, 5 Oct 2022 15:28:40 -0400 Subject: [PATCH 04/14] feat(aws-lambda-python): add bundling option for excluding hashes when exporting with poetry --- .../@aws-cdk/aws-lambda-python/lib/bundling.ts | 5 ++++- .../@aws-cdk/aws-lambda-python/lib/packaging.ts | 16 +++++++++++++--- packages/@aws-cdk/aws-lambda-python/lib/types.ts | 10 ++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts b/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts index 4790b8f08e0eb..e58d5bc094afa 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts @@ -67,6 +67,7 @@ export class Bundling implements CdkBundlingOptions { architecture = Architecture.X86_64, outputPathSuffix = '', image, + poetryExcludeHashes, } = props; const outputPath = path.posix.join(AssetStaging.BUNDLING_OUTPUT_DIR, outputPathSuffix); @@ -75,6 +76,7 @@ export class Bundling implements CdkBundlingOptions { entry, inputDir: AssetStaging.BUNDLING_INPUT_DIR, outputDir: outputPath, + poetryExcludeHashes, }); this.image = image ?? DockerImage.fromBuild(path.join(__dirname, '../lib'), { @@ -89,7 +91,7 @@ export class Bundling implements CdkBundlingOptions { } private createBundlingCommand(options: BundlingCommandOptions): string[] { - const packaging = Packaging.fromEntry(options.entry); + const packaging = Packaging.fromEntry(options.entry, options.poetryExcludeHashes); let bundlingCommands: string[] = []; bundlingCommands.push(`cp -rTL ${options.inputDir}/ ${options.outputDir}`); bundlingCommands.push(`cd ${options.outputDir}`); @@ -105,6 +107,7 @@ interface BundlingCommandOptions { readonly entry: string; readonly inputDir: string; readonly outputDir: string; + readonly poetryExcludeHashes?: boolean; } /** diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index bc221000c6251..1d4f5103c79fc 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -45,7 +45,17 @@ export class Packaging { */ public static readonly POETRY = new Packaging({ dependenciesFile: DependenciesFile.POETRY, - // Export dependencies with credentials avaiable in the bundling image. + // Export dependencies with credentials available in the bundling image. + exportCommand: `poetry export --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, + }); + + /** + * Packaging with `poetry`. + */ + public static readonly POETRY_EXCLUDE_HASHES = new Packaging({ + dependenciesFile: DependenciesFile.POETRY, + // Export dependencies with credentials available in the bundling image, without dependency hashes + // This prevents pip failures when not all dependencies come with a hash exportCommand: `poetry export --without-hashes --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, }); @@ -54,11 +64,11 @@ export class Packaging { */ public static readonly NONE = new Packaging({ dependenciesFile: DependenciesFile.NONE }); - public static fromEntry(entry: string): Packaging { + public static fromEntry(entry: string, poetryExcludeHashes?: boolean): Packaging { if (fs.existsSync(path.join(entry, DependenciesFile.PIPENV))) { return Packaging.PIPENV; } if (fs.existsSync(path.join(entry, DependenciesFile.POETRY))) { - return Packaging.POETRY; + return poetryExcludeHashes ? Packaging.POETRY_EXCLUDE_HASHES : Packaging.POETRY; } else if (fs.existsSync(path.join(entry, DependenciesFile.PIP))) { return Packaging.PIP; } else { diff --git a/packages/@aws-cdk/aws-lambda-python/lib/types.ts b/packages/@aws-cdk/aws-lambda-python/lib/types.ts index e818eadc4401b..9492ebeecdc81 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/types.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/types.ts @@ -5,6 +5,16 @@ import { AssetHashType, DockerImage } from '@aws-cdk/core'; * Options for bundling */ export interface BundlingOptions { + + /** + * Whether to export Poetry dependencies without hashes. This can fix build issues when some dependencies are exporting + * with hashes and others are not, causing pip to fail the build. + * + * @see https://github.com/aws/aws-cdk/issues/19232 + * @default Hashes are included in the exported `requirements.txt` file + */ + readonly poetryExcludeHashes?: boolean; + /** * Output path suffix: the suffix for the directory into which the bundled output is written. * From 37b9af3f0bafeab9d1a086d8086351153ef4de8f Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Wed, 5 Oct 2022 15:29:23 -0400 Subject: [PATCH 05/14] tests(aws-lambda-python): add unit and integ tests for poetry lambdas with hashes excluded --- .../aws-lambda-python/test/bundling.test.ts | 28 + .../integ-lambda-python-poetry.assets.json | 61 +- .../integ-lambda-python-poetry.template.json | 189 +++++- .../manifest.json | 112 +++- ...efaultTestDeployAssertE9C9CB8F.assets.json | 4 +- ...aultTestDeployAssertE9C9CB8F.template.json | 264 ++++++++- .../function.poetry.integ.snapshot/tree.json | 552 +++++++++++++++++- .../test/integ.function.poetry.ts | 27 + 8 files changed, 1213 insertions(+), 24 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts index e49f2ebe914cf..6f76361508fe8 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts @@ -172,6 +172,34 @@ test('Bundling a function with poetry dependencies', () => { outputPathSuffix: 'python', }); + expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({ + bundling: expect.objectContaining({ + command: [ + 'bash', '-c', + 'cp -rTL /asset-input/ /asset-output/python && cd /asset-output/python && poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python', + ], + }), + })); + + const files = fs.readdirSync(assetCode.path); + expect(files).toContain('index.py'); + expect(files).toContain('pyproject.toml'); + expect(files).toContain('poetry.lock'); + // Contains hidden files. + expect(files).toContain('.ignorefile'); +}); + +test('Bundling a function with poetry dependencies, without hashes', () => { + const entry = path.join(__dirname, 'lambda-handler-poetry'); + + const assetCode = Bundling.bundle({ + entry: path.join(entry, '.'), + runtime: Runtime.PYTHON_3_9, + architecture: Architecture.X86_64, + outputPathSuffix: 'python', + poetryExcludeHashes: true, + }); + expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({ bundling: expect.objectContaining({ command: [ diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json index ee3e31e86093f..e3f82ad107124 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json @@ -1,46 +1,85 @@ { "version": "21.0.0", "files": { - "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3": { + "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306": { "source": { - "path": "asset.9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3", + "path": "asset.21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3.zip", + "objectKey": "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d": { + "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2": { "source": { - "path": "asset.f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d", + "path": "asset.5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d.zip", + "objectKey": "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec": { + "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3": { "source": { - "path": "asset.e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec", + "path": "asset.26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec.zip", + "objectKey": "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "82b489749eaabed0e009eb9fff1d35a4c9fc7bc4b1614c788a84481f99032f73": { + "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e": { + "source": { + "path": "asset.5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98": { + "source": { + "path": "asset.a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090": { + "source": { + "path": "asset.65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "06f17b3fd0ffcc68036b625750d48216e4364fa18ec482d23e28017d608e1023": { "source": { "path": "integ-lambda-python-poetry.template.json", "packaging": "file" @@ -48,7 +87,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "82b489749eaabed0e009eb9fff1d35a4c9fc7bc4b1614c788a84481f99032f73.json", + "objectKey": "06f17b3fd0ffcc68036b625750d48216e4364fa18ec482d23e28017d608e1023.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json index b63d60d7d8497..031483dc49b31 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json @@ -38,7 +38,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3.zip" + "S3Key": "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306.zip" }, "Role": { "Fn::GetAtt": [ @@ -53,6 +53,59 @@ "myhandlerinlineServiceRole10C681F6" ] }, + "myhandlerinlinenohashesServiceRole792CBFEE": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "myhandlerinlinenohashes9F4AC298": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2.zip" + }, + "Role": { + "Fn::GetAtt": [ + "myhandlerinlinenohashesServiceRole792CBFEE", + "Arn" + ] + }, + "Handler": "index.handler", + "Runtime": "python3.9" + }, + "DependsOn": [ + "myhandlerinlinenohashesServiceRole792CBFEE" + ] + }, "myhandlerpython38ServiceRole2049AFF7": { "Type": "AWS::IAM::Role", "Properties": { @@ -91,7 +144,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d.zip" + "S3Key": "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3.zip" }, "Role": { "Fn::GetAtt": [ @@ -106,6 +159,59 @@ "myhandlerpython38ServiceRole2049AFF7" ] }, + "myhandlerpython38nohashesServiceRole95183D41": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "myhandlerpython38nohashesAC448740": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e.zip" + }, + "Role": { + "Fn::GetAtt": [ + "myhandlerpython38nohashesServiceRole95183D41", + "Arn" + ] + }, + "Handler": "index.handler", + "Runtime": "python3.8" + }, + "DependsOn": [ + "myhandlerpython38nohashesServiceRole95183D41" + ] + }, "myhandlerpython37ServiceRole45CBD18D": { "Type": "AWS::IAM::Role", "Properties": { @@ -144,7 +250,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec.zip" + "S3Key": "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98.zip" }, "Role": { "Fn::GetAtt": [ @@ -158,6 +264,59 @@ "DependsOn": [ "myhandlerpython37ServiceRole45CBD18D" ] + }, + "myhandlerpython37nohashesServiceRoleCB0A268B": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "myhandlerpython37nohashes751F0455": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090.zip" + }, + "Role": { + "Fn::GetAtt": [ + "myhandlerpython37nohashesServiceRoleCB0A268B", + "Arn" + ] + }, + "Handler": "index.handler", + "Runtime": "python3.7" + }, + "DependsOn": [ + "myhandlerpython37nohashesServiceRoleCB0A268B" + ] } }, "Outputs": { @@ -169,6 +328,14 @@ "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinline53D120C7B0898676" } }, + "ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785": { + "Value": { + "Ref": "myhandlerinlinenohashes9F4AC298" + }, + "Export": { + "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + } + }, "ExportsOutputRefmyhandlerpython384D62BBB58AA8B940": { "Value": { "Ref": "myhandlerpython384D62BBB5" @@ -177,6 +344,14 @@ "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython384D62BBB58AA8B940" } }, + "ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056": { + "Value": { + "Ref": "myhandlerpython38nohashesAC448740" + }, + "Export": { + "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + } + }, "ExportsOutputRefmyhandlerpython37C34039A7BB71D94D": { "Value": { "Ref": "myhandlerpython37C34039A7" @@ -184,6 +359,14 @@ "Export": { "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37C34039A7BB71D94D" } + }, + "ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78": { + "Value": { + "Ref": "myhandlerpython37nohashes751F0455" + }, + "Export": { + "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json index f8fd909788fa8..3595557c51cec 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/82b489749eaabed0e009eb9fff1d35a4c9fc7bc4b1614c788a84481f99032f73.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/06f17b3fd0ffcc68036b625750d48216e4364fa18ec482d23e28017d608e1023.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -51,6 +51,18 @@ "data": "myhandlerinline53D120C7" } ], + "/integ-lambda-python-poetry/my_handler_inline_no_hashes/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerinlinenohashesServiceRole792CBFEE" + } + ], + "/integ-lambda-python-poetry/my_handler_inline_no_hashes/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerinlinenohashes9F4AC298" + } + ], "/integ-lambda-python-poetry/my_handler_python_38/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -63,6 +75,18 @@ "data": "myhandlerpython384D62BBB5" } ], + "/integ-lambda-python-poetry/my_handler_python_38_no_hashes/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython38nohashesServiceRole95183D41" + } + ], + "/integ-lambda-python-poetry/my_handler_python_38_no_hashes/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython38nohashesAC448740" + } + ], "/integ-lambda-python-poetry/my_handler_python_37/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -75,24 +99,54 @@ "data": "myhandlerpython37C34039A7" } ], + "/integ-lambda-python-poetry/my_handler_python_37_no_hashes/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython37nohashesServiceRoleCB0A268B" + } + ], + "/integ-lambda-python-poetry/my_handler_python_37_no_hashes/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython37nohashes751F0455" + } + ], "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinline53D120C7\"}": [ { "type": "aws:cdk:logicalId", "data": "ExportsOutputRefmyhandlerinline53D120C7B0898676" } ], + "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + } + ], "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython384D62BBB5\"}": [ { "type": "aws:cdk:logicalId", "data": "ExportsOutputRefmyhandlerpython384D62BBB58AA8B940" } ], + "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + } + ], "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37C34039A7\"}": [ { "type": "aws:cdk:logicalId", "data": "ExportsOutputRefmyhandlerpython37C34039A7BB71D94D" } ], + "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + } + ], "/integ-lambda-python-poetry/BootstrapVersion": [ { "type": "aws:cdk:logicalId", @@ -124,7 +178,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dbf8a3a98e250321c8158725e3c55158815b3610f42e036de4a1d9e1cd8f89d1.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d94d2b97300a82da4fcd999e4a83fcfda5ebb8d5e1ef5d68135b6d788691a322.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -171,6 +225,24 @@ "data": "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F" } ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d" + } + ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65dInvoke1653CFA5" + } + ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsLambdaInvokeff9d3b9c27e73458461b1c6f128cc65d" + } + ], "/poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/Default/Default": [ { "type": "aws:cdk:logicalId", @@ -189,6 +261,24 @@ "data": "AssertionResultsLambdaInvoke9a0beb4ea6cc38db92e9ff664c085292" } ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98" + } + ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98InvokeB52CEE1F" + } + ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsLambdaInvokec3ebca5091a904043cfed0bbe6b24f98" + } + ], "/poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/Default/Default": [ { "type": "aws:cdk:logicalId", @@ -207,6 +297,24 @@ "data": "AssertionResultsLambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75" } ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokebd494a15c91a04f89bd0def3dba88362" + } + ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokebd494a15c91a04f89bd0def3dba88362Invoke27A04B5A" + } + ], + "/poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsLambdaInvokebd494a15c91a04f89bd0def3dba88362" + } + ], "/poetry/DefaultTest/DeployAssert/BootstrapVersion": [ { "type": "aws:cdk:logicalId", diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json index 61d7d28e30860..0be149dcad51b 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json @@ -14,7 +14,7 @@ } } }, - "dbf8a3a98e250321c8158725e3c55158815b3610f42e036de4a1d9e1cd8f89d1": { + "d94d2b97300a82da4fcd999e4a83fcfda5ebb8d5e1ef5d68135b6d788691a322": { "source": { "path": "poetryDefaultTestDeployAssertE9C9CB8F.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "dbf8a3a98e250321c8158725e3c55158815b3610f42e036de4a1d9e1cd8f89d1.json", + "objectKey": "d94d2b97300a82da4fcd999e4a83fcfda5ebb8d5e1ef5d68135b6d788691a322.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json index c0d79c49eb3ad..c1821ec957ae3 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json @@ -18,7 +18,7 @@ } }, "flattenResponse": "false", - "salt": "1664990286225" + "salt": "1664997544568" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -113,6 +113,46 @@ "*" ] }, + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:", + { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + } + ] + ] + } + ] + }, + { + "Action": [ + "lambda:Invoke" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, { "Action": [ "lambda:InvokeFunction" @@ -153,6 +193,46 @@ "*" ] }, + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:", + { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + } + ] + ] + } + ] + }, + { + "Action": [ + "lambda:Invoke" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, { "Action": [ "lambda:InvokeFunction" @@ -183,6 +263,46 @@ ] } ] + }, + { + "Action": [ + "lambda:Invoke" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:", + { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + } + ] + ] + } + ] } ] } @@ -210,6 +330,44 @@ } } }, + "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d": { + "Type": "Custom::DeployAssert@SdkCallLambdainvoke", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", + "parameters": { + "FunctionName": { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + } + }, + "flattenResponse": "false", + "salt": "1664997544569" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65dInvoke1653CFA5": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + }, + "Principal": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + }, "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292": { "Type": "Custom::DeployAssert@SdkCallLambdainvoke", "Properties": { @@ -228,7 +386,7 @@ } }, "flattenResponse": "false", - "salt": "1664990286226" + "salt": "1664997544569" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -248,6 +406,44 @@ } } }, + "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98": { + "Type": "Custom::DeployAssert@SdkCallLambdainvoke", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", + "parameters": { + "FunctionName": { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + } + }, + "flattenResponse": "false", + "salt": "1664997544569" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98InvokeB52CEE1F": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + }, + "Principal": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + }, "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75": { "Type": "Custom::DeployAssert@SdkCallLambdainvoke", "Properties": { @@ -266,7 +462,7 @@ } }, "flattenResponse": "false", - "salt": "1664990286226" + "salt": "1664997544570" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -285,6 +481,44 @@ ] } } + }, + "LambdaInvokebd494a15c91a04f89bd0def3dba88362": { + "Type": "Custom::DeployAssert@SdkCallLambdainvoke", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", + "parameters": { + "FunctionName": { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + } + }, + "flattenResponse": "false", + "salt": "1664997544570" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "LambdaInvokebd494a15c91a04f89bd0def3dba88362Invoke27A04B5A": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + }, + "Principal": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } } }, "Outputs": { @@ -296,6 +530,14 @@ ] } }, + "AssertionResultsLambdaInvokeff9d3b9c27e73458461b1c6f128cc65d": { + "Value": { + "Fn::GetAtt": [ + "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d", + "assertion" + ] + } + }, "AssertionResultsLambdaInvoke9a0beb4ea6cc38db92e9ff664c085292": { "Value": { "Fn::GetAtt": [ @@ -304,6 +546,14 @@ ] } }, + "AssertionResultsLambdaInvokec3ebca5091a904043cfed0bbe6b24f98": { + "Value": { + "Fn::GetAtt": [ + "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98", + "assertion" + ] + } + }, "AssertionResultsLambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75": { "Value": { "Fn::GetAtt": [ @@ -311,6 +561,14 @@ "assertion" ] } + }, + "AssertionResultsLambdaInvokebd494a15c91a04f89bd0def3dba88362": { + "Value": { + "Fn::GetAtt": [ + "LambdaInvokebd494a15c91a04f89bd0def3dba88362", + "assertion" + ] + } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json index 33eb64c918561..8d528b9cac994 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json @@ -105,7 +105,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "9e6b794c2a232add13573f23a515a9a3d05ef1dba07083c34fe424063bc0d5d3.zip" + "s3Key": "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306.zip" }, "role": { "Fn::GetAtt": [ @@ -128,6 +128,118 @@ "version": "0.0.0" } }, + "my_handler_inline_no_hashes": { + "id": "my_handler_inline_no_hashes", + "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/ServiceRole", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Code": { + "id": "Code", + "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Code/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Code/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-s3-assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2.zip" + }, + "role": { + "Fn::GetAtt": [ + "myhandlerinlinenohashesServiceRole792CBFEE", + "Arn" + ] + }, + "handler": "index.handler", + "runtime": "python3.9" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda-python.PythonFunction", + "version": "0.0.0" + } + }, "my_handler_python_38": { "id": "my_handler_python_38", "path": "integ-lambda-python-poetry/my_handler_python_38", @@ -217,7 +329,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "f92929a7c4f10c8811fc7b81ba33d765b587d0adf0bf7c9ae3c463eac0c1a92d.zip" + "s3Key": "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3.zip" }, "role": { "Fn::GetAtt": [ @@ -240,6 +352,118 @@ "version": "0.0.0" } }, + "my_handler_python_38_no_hashes": { + "id": "my_handler_python_38_no_hashes", + "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/ServiceRole", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Code": { + "id": "Code", + "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Code/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Code/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-s3-assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e.zip" + }, + "role": { + "Fn::GetAtt": [ + "myhandlerpython38nohashesServiceRole95183D41", + "Arn" + ] + }, + "handler": "index.handler", + "runtime": "python3.8" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda-python.PythonFunction", + "version": "0.0.0" + } + }, "my_handler_python_37": { "id": "my_handler_python_37", "path": "integ-lambda-python-poetry/my_handler_python_37", @@ -329,7 +553,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "e6b44d16c900a2b58812725066bbf393e311e43c9f2255854afafcff1aa624ec.zip" + "s3Key": "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98.zip" }, "role": { "Fn::GetAtt": [ @@ -352,6 +576,118 @@ "version": "0.0.0" } }, + "my_handler_python_37_no_hashes": { + "id": "my_handler_python_37_no_hashes", + "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/ServiceRole", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Code": { + "id": "Code", + "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Code/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Code/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-s3-assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090.zip" + }, + "role": { + "Fn::GetAtt": [ + "myhandlerpython37nohashesServiceRoleCB0A268B", + "Arn" + ] + }, + "handler": "index.handler", + "runtime": "python3.7" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda-python.PythonFunction", + "version": "0.0.0" + } + }, "Exports": { "id": "Exports", "path": "integ-lambda-python-poetry/Exports", @@ -364,6 +700,14 @@ "version": "0.0.0" } }, + "Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}": { + "id": "Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}", + "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, "Output{\"Ref\":\"myhandlerpython384D62BBB5\"}": { "id": "Output{\"Ref\":\"myhandlerpython384D62BBB5\"}", "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython384D62BBB5\"}", @@ -372,6 +716,14 @@ "version": "0.0.0" } }, + "Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}": { + "id": "Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}", + "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, "Output{\"Ref\":\"myhandlerpython37C34039A7\"}": { "id": "Output{\"Ref\":\"myhandlerpython37C34039A7\"}", "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37C34039A7\"}", @@ -379,6 +731,14 @@ "fqn": "@aws-cdk/core.CfnOutput", "version": "0.0.0" } + }, + "Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}": { + "id": "Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}", + "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } } }, "constructInfo": { @@ -508,6 +868,68 @@ "version": "10.1.108" } }, + "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d": { + "id": "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Default", + "children": { + "Default": { + "id": "Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Invoke", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" + } + }, "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292": { "id": "LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292", "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292", @@ -570,6 +992,68 @@ "version": "0.0.0" } }, + "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98": { + "id": "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Default", + "children": { + "Default": { + "id": "Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Invoke", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" + } + }, "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75": { "id": "LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75", "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75", @@ -631,6 +1115,68 @@ "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", "version": "0.0.0" } + }, + "LambdaInvokebd494a15c91a04f89bd0def3dba88362": { + "id": "LambdaInvokebd494a15c91a04f89bd0def3dba88362", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Default", + "children": { + "Default": { + "id": "Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Invoke", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts b/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts index 162edff2db14c..5b1edfd7b898d 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts +++ b/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts @@ -21,18 +21,45 @@ class TestStack extends Stack { }); this.functionNames.push(pythonFunction39.functionName); + const pythonFunction39NoHashes = new lambda.PythonFunction(this, 'my_handler_inline_no_hashes', { + entry: path.join(__dirname, 'lambda-handler-poetry'), + runtime: Runtime.PYTHON_3_9, + bundling: { + poetryExcludeHashes: true, + }, + }); + this.functionNames.push(pythonFunction39NoHashes.functionName); + const pythonFunction38 = new lambda.PythonFunction(this, 'my_handler_python_38', { entry: path.join(__dirname, 'lambda-handler-poetry'), runtime: Runtime.PYTHON_3_8, }); this.functionNames.push(pythonFunction38.functionName); + const pythonFunction38NoHashes = new lambda.PythonFunction(this, 'my_handler_python_38_no_hashes', { + entry: path.join(__dirname, 'lambda-handler-poetry'), + runtime: Runtime.PYTHON_3_8, + bundling: { + poetryExcludeHashes: true, + }, + }); + this.functionNames.push(pythonFunction38NoHashes.functionName); + const pythonFunction37 = new lambda.PythonFunction(this, 'my_handler_python_37', { entry: path.join(__dirname, 'lambda-handler-poetry'), runtime: Runtime.PYTHON_3_7, }); this.functionNames.push(pythonFunction37.functionName); + const pythonFunction37NoHashes = new lambda.PythonFunction(this, 'my_handler_python_37_no_hashes', { + entry: path.join(__dirname, 'lambda-handler-poetry'), + runtime: Runtime.PYTHON_3_7, + bundling: { + poetryExcludeHashes: true, + }, + }); + this.functionNames.push(pythonFunction37NoHashes.functionName); + } } From 8091c4954f64a48e0f247c59f903cffbfb75375b Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Thu, 6 Oct 2022 09:39:57 -0400 Subject: [PATCH 06/14] refactor(aws-lambda-python): use static methods for packaging choices --- .../aws-lambda-python/lib/packaging.ts | 69 +++++++++++-------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index 1d4f5103c79fc..928482972c9e7 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -21,58 +21,69 @@ export interface PackagingProps { readonly exportCommand?: string; } +class PoetryPackagingProps { + /** + * Whether to export Poetry dependencies without hashes. This can fix build issues when some dependencies are exporting + * with hashes and others are not, causing pip to fail the build. + * + * @see https://github.com/aws/aws-cdk/issues/19232 + * @default Hashes are included in the exported `requirements.txt` file + */ + readonly poetryExcludeHashes?: boolean; +} + export class Packaging { /** * Standard packaging with `pip`. */ - public static readonly PIP = new Packaging({ - dependenciesFile: DependenciesFile.PIP, - }); + public static withPip(): Packaging { + return new Packaging({ + dependenciesFile: DependenciesFile.PIP, + }); + } /** * Packaging with `pipenv`. */ - public static readonly PIPENV = new Packaging({ - dependenciesFile: DependenciesFile.PIPENV, - // By default, pipenv creates a virtualenv in `/.local`, so we force it to create one in the package directory. - // At the end, we remove the virtualenv to avoid creating a duplicate copy in the Lambda package. - exportCommand: `PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > ${DependenciesFile.PIP} && rm -rf .venv`, - }); - - /** - * Packaging with `poetry`. - */ - public static readonly POETRY = new Packaging({ - dependenciesFile: DependenciesFile.POETRY, - // Export dependencies with credentials available in the bundling image. - exportCommand: `poetry export --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, - }); + public static withPipenv(): Packaging { + return new Packaging({ + dependenciesFile: DependenciesFile.PIPENV, + // By default, pipenv creates a virtualenv in `/.local`, so we force it to create one in the package directory. + // At the end, we remove the virtualenv to avoid creating a duplicate copy in the Lambda package. + exportCommand: `PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > ${DependenciesFile.PIP} && rm -rf .venv`, + }); + } /** * Packaging with `poetry`. */ - public static readonly POETRY_EXCLUDE_HASHES = new Packaging({ - dependenciesFile: DependenciesFile.POETRY, - // Export dependencies with credentials available in the bundling image, without dependency hashes - // This prevents pip failures when not all dependencies come with a hash - exportCommand: `poetry export --without-hashes --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, - }); + public static withPoetry(props?: PoetryPackagingProps) { + return new Packaging({ + dependenciesFile: DependenciesFile.POETRY, + // Export dependencies with credentials available in the bundling image. + exportCommand: props?.poetryExcludeHashes ? + `poetry export --without-hashes --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}` : + `poetry export --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, + }); + } /** * No dependencies or packaging. */ - public static readonly NONE = new Packaging({ dependenciesFile: DependenciesFile.NONE }); + public static withNoPackaging(): Packaging { + return new Packaging({ dependenciesFile: DependenciesFile.NONE }); + } public static fromEntry(entry: string, poetryExcludeHashes?: boolean): Packaging { if (fs.existsSync(path.join(entry, DependenciesFile.PIPENV))) { - return Packaging.PIPENV; + return this.withPipenv(); } if (fs.existsSync(path.join(entry, DependenciesFile.POETRY))) { - return poetryExcludeHashes ? Packaging.POETRY_EXCLUDE_HASHES : Packaging.POETRY; + return this.withPoetry({ poetryExcludeHashes }); } else if (fs.existsSync(path.join(entry, DependenciesFile.PIP))) { - return Packaging.PIP; + return this.withPip(); } else { - return Packaging.NONE; + return this.withNoPackaging(); } } From 9badf55b465e26622bc4b3702dee14231bc77959 Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Thu, 6 Oct 2022 09:40:28 -0400 Subject: [PATCH 07/14] test(aws-lambda-python): expect packaging to match static packaging methods --- .../@aws-cdk/aws-lambda-python/test/packaging.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/test/packaging.test.ts b/packages/@aws-cdk/aws-lambda-python/test/packaging.test.ts index 5cedd42b941bc..4054bd082f131 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/packaging.test.ts +++ b/packages/@aws-cdk/aws-lambda-python/test/packaging.test.ts @@ -6,7 +6,7 @@ test('Packging with no dependencies', () => { const packaging = Packaging.fromEntry(entry); // pip packaging identified. - expect(packaging).toEqual(Packaging.NONE); + expect(packaging).toEqual(Packaging.withNoPackaging()); }); test('Packging with requirements.txt', () => { @@ -14,7 +14,7 @@ test('Packging with requirements.txt', () => { const packaging = Packaging.fromEntry(entry); // pip packaging identified. - expect(packaging).toEqual(Packaging.PIP); + expect(packaging).toEqual(Packaging.withPip()); }); test('Packging with pipenv', () => { @@ -22,7 +22,7 @@ test('Packging with pipenv', () => { const packaging = Packaging.fromEntry(entry); // pip packaging identified. - expect(packaging).toEqual(Packaging.PIPENV); + expect(packaging).toEqual(Packaging.withPipenv()); }); test('Packging with poetry', () => { @@ -30,5 +30,5 @@ test('Packging with poetry', () => { const packaging = Packaging.fromEntry(entry); // pip packaging identified. - expect(packaging).toEqual(Packaging.POETRY); + expect(packaging).toEqual(Packaging.withPoetry()); }); From bb3d52422927485229ee0258f528b37987d49999 Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Thu, 6 Oct 2022 10:47:22 -0400 Subject: [PATCH 08/14] refactor(aws-lambda-python): use an interface for PoetryPackagingProps instead of an IDE-generated class --- packages/@aws-cdk/aws-lambda-python/lib/packaging.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index 928482972c9e7..ee4d26f85981f 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -21,7 +21,7 @@ export interface PackagingProps { readonly exportCommand?: string; } -class PoetryPackagingProps { +export interface PoetryPackagingProps { /** * Whether to export Poetry dependencies without hashes. This can fix build issues when some dependencies are exporting * with hashes and others are not, causing pip to fail the build. From 3acbcde3a92cd80904f8ade9815af92cbe724b27 Mon Sep 17 00:00:00 2001 From: Adam Bigelow <58624145+a-bigelow@users.noreply.github.com> Date: Fri, 7 Oct 2022 09:05:23 -0400 Subject: [PATCH 09/14] refactor(aws-lambda-python): reformat poetry export command Co-authored-by: Cory Hall <43035978+corymhall@users.noreply.github.com> --- packages/@aws-cdk/aws-lambda-python/lib/packaging.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index ee4d26f85981f..27f6575c151f0 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -62,10 +62,13 @@ export class Packaging { return new Packaging({ dependenciesFile: DependenciesFile.POETRY, // Export dependencies with credentials available in the bundling image. - exportCommand: props?.poetryExcludeHashes ? - `poetry export --without-hashes --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}` : - `poetry export --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, - }); + exportCommand: [ + 'poetry', 'export', + ...props?.poetryExcludeHashes ? ['--without-hashes'] : [], + '--with-credentials', + '--format', DependenciesFile.PIP, + '--output', DependenciesFile.PIP, + ].join(' '); } /** From 284454edff3c3e7b8583b0cafc39bf29b4e3b31d Mon Sep 17 00:00:00 2001 From: Adam Bigelow <58624145+a-bigelow@users.noreply.github.com> Date: Fri, 7 Oct 2022 09:05:23 -0400 Subject: [PATCH 10/14] refactor(aws-lambda-python): reformat poetry export command Co-authored-by: Cory Hall <43035978+corymhall@users.noreply.github.com> --- packages/@aws-cdk/aws-lambda-python/lib/packaging.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index ee4d26f85981f..f61e44fffc390 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -62,9 +62,13 @@ export class Packaging { return new Packaging({ dependenciesFile: DependenciesFile.POETRY, // Export dependencies with credentials available in the bundling image. - exportCommand: props?.poetryExcludeHashes ? - `poetry export --without-hashes --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}` : - `poetry export --with-credentials --format ${DependenciesFile.PIP} --output ${DependenciesFile.PIP}`, + exportCommand: [ + 'poetry', 'export', + ...props?.poetryExcludeHashes ? ['--without-hashes'] : [], + '--with-credentials', + '--format', DependenciesFile.PIP, + '--output', DependenciesFile.PIP, + ].join(' '), }); } From 445bf60704279d6f2865494c782a9c1ed0f87e93 Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Fri, 7 Oct 2022 10:17:24 -0400 Subject: [PATCH 11/14] refactor(aws-lambda-python): use --without-hashes as default argument --- packages/@aws-cdk/aws-lambda-python/lib/bundling.ts | 8 ++++---- packages/@aws-cdk/aws-lambda-python/lib/packaging.ts | 12 ++++++------ packages/@aws-cdk/aws-lambda-python/lib/types.ts | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts b/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts index e58d5bc094afa..726b72c5bc2b8 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts @@ -67,7 +67,7 @@ export class Bundling implements CdkBundlingOptions { architecture = Architecture.X86_64, outputPathSuffix = '', image, - poetryExcludeHashes, + poetryIncludeHashes, } = props; const outputPath = path.posix.join(AssetStaging.BUNDLING_OUTPUT_DIR, outputPathSuffix); @@ -76,7 +76,7 @@ export class Bundling implements CdkBundlingOptions { entry, inputDir: AssetStaging.BUNDLING_INPUT_DIR, outputDir: outputPath, - poetryExcludeHashes, + poetryIncludeHashes, }); this.image = image ?? DockerImage.fromBuild(path.join(__dirname, '../lib'), { @@ -91,7 +91,7 @@ export class Bundling implements CdkBundlingOptions { } private createBundlingCommand(options: BundlingCommandOptions): string[] { - const packaging = Packaging.fromEntry(options.entry, options.poetryExcludeHashes); + const packaging = Packaging.fromEntry(options.entry, options.poetryIncludeHashes); let bundlingCommands: string[] = []; bundlingCommands.push(`cp -rTL ${options.inputDir}/ ${options.outputDir}`); bundlingCommands.push(`cd ${options.outputDir}`); @@ -107,7 +107,7 @@ interface BundlingCommandOptions { readonly entry: string; readonly inputDir: string; readonly outputDir: string; - readonly poetryExcludeHashes?: boolean; + readonly poetryIncludeHashes?: boolean; } /** diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index f61e44fffc390..3402dd15c4b82 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -23,13 +23,13 @@ export interface PackagingProps { export interface PoetryPackagingProps { /** - * Whether to export Poetry dependencies without hashes. This can fix build issues when some dependencies are exporting - * with hashes and others are not, causing pip to fail the build. + * Whether to export Poetry dependencies with hashes. Note that this can cause builds to fail if not all dependencies + * export with a hash. * * @see https://github.com/aws/aws-cdk/issues/19232 - * @default Hashes are included in the exported `requirements.txt` file + * @default Hashes are NOT included in the exported `requirements.txt` file */ - readonly poetryExcludeHashes?: boolean; + readonly poetryIncludeHashes?: boolean; } export class Packaging { @@ -64,7 +64,7 @@ export class Packaging { // Export dependencies with credentials available in the bundling image. exportCommand: [ 'poetry', 'export', - ...props?.poetryExcludeHashes ? ['--without-hashes'] : [], + ...props?.poetryIncludeHashes ? [] : ['--without-hashes'], '--with-credentials', '--format', DependenciesFile.PIP, '--output', DependenciesFile.PIP, @@ -83,7 +83,7 @@ export class Packaging { if (fs.existsSync(path.join(entry, DependenciesFile.PIPENV))) { return this.withPipenv(); } if (fs.existsSync(path.join(entry, DependenciesFile.POETRY))) { - return this.withPoetry({ poetryExcludeHashes }); + return this.withPoetry({ poetryIncludeHashes: poetryExcludeHashes }); } else if (fs.existsSync(path.join(entry, DependenciesFile.PIP))) { return this.withPip(); } else { diff --git a/packages/@aws-cdk/aws-lambda-python/lib/types.ts b/packages/@aws-cdk/aws-lambda-python/lib/types.ts index 9492ebeecdc81..3689c43335959 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/types.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/types.ts @@ -7,13 +7,13 @@ import { AssetHashType, DockerImage } from '@aws-cdk/core'; export interface BundlingOptions { /** - * Whether to export Poetry dependencies without hashes. This can fix build issues when some dependencies are exporting - * with hashes and others are not, causing pip to fail the build. + * Whether to export Poetry dependencies with hashes. Note that this can cause builds to fail if not all dependencies + * export with a hash. * * @see https://github.com/aws/aws-cdk/issues/19232 - * @default Hashes are included in the exported `requirements.txt` file + * @default Hashes are NOT included in the exported `requirements.txt` file */ - readonly poetryExcludeHashes?: boolean; + readonly poetryIncludeHashes?: boolean; /** * Output path suffix: the suffix for the directory into which the bundled output is written. From d72bb877f7a3592657cf74ad8f4eb8935c151683 Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Fri, 7 Oct 2022 10:18:10 -0400 Subject: [PATCH 12/14] tests(aws-lambda-python): Test for new default --without-hashes poetry argument --- .../aws-lambda-python/test/bundling.test.ts | 8 ++++---- .../test/integ.function.poetry.ts | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts index 6f76361508fe8..5626a3f02d2a4 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts @@ -176,7 +176,7 @@ test('Bundling a function with poetry dependencies', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'cp -rTL /asset-input/ /asset-output/python && cd /asset-output/python && poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python', + 'cp -rTL /asset-input/ /asset-output/python && cd /asset-output/python && poetry export --without-hashes --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python', ], }), })); @@ -189,7 +189,7 @@ test('Bundling a function with poetry dependencies', () => { expect(files).toContain('.ignorefile'); }); -test('Bundling a function with poetry dependencies, without hashes', () => { +test('Bundling a function with poetry dependencies, with hashes', () => { const entry = path.join(__dirname, 'lambda-handler-poetry'); const assetCode = Bundling.bundle({ @@ -197,14 +197,14 @@ test('Bundling a function with poetry dependencies, without hashes', () => { runtime: Runtime.PYTHON_3_9, architecture: Architecture.X86_64, outputPathSuffix: 'python', - poetryExcludeHashes: true, + poetryIncludeHashes: true, }); expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({ bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'cp -rTL /asset-input/ /asset-output/python && cd /asset-output/python && poetry export --without-hashes --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python', + 'cp -rTL /asset-input/ /asset-output/python && cd /asset-output/python && poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python', ], }), })); diff --git a/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts b/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts index 5b1edfd7b898d..64ef3a8da3a70 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts +++ b/packages/@aws-cdk/aws-lambda-python/test/integ.function.poetry.ts @@ -21,14 +21,14 @@ class TestStack extends Stack { }); this.functionNames.push(pythonFunction39.functionName); - const pythonFunction39NoHashes = new lambda.PythonFunction(this, 'my_handler_inline_no_hashes', { + const pythonFunction39WithHashes = new lambda.PythonFunction(this, 'my_handler_inline_with_hashes', { entry: path.join(__dirname, 'lambda-handler-poetry'), runtime: Runtime.PYTHON_3_9, bundling: { - poetryExcludeHashes: true, + poetryIncludeHashes: true, }, }); - this.functionNames.push(pythonFunction39NoHashes.functionName); + this.functionNames.push(pythonFunction39WithHashes.functionName); const pythonFunction38 = new lambda.PythonFunction(this, 'my_handler_python_38', { entry: path.join(__dirname, 'lambda-handler-poetry'), @@ -36,14 +36,14 @@ class TestStack extends Stack { }); this.functionNames.push(pythonFunction38.functionName); - const pythonFunction38NoHashes = new lambda.PythonFunction(this, 'my_handler_python_38_no_hashes', { + const pythonFunction38WithHashes = new lambda.PythonFunction(this, 'my_handler_python_38_with_hashes', { entry: path.join(__dirname, 'lambda-handler-poetry'), runtime: Runtime.PYTHON_3_8, bundling: { - poetryExcludeHashes: true, + poetryIncludeHashes: true, }, }); - this.functionNames.push(pythonFunction38NoHashes.functionName); + this.functionNames.push(pythonFunction38WithHashes.functionName); const pythonFunction37 = new lambda.PythonFunction(this, 'my_handler_python_37', { entry: path.join(__dirname, 'lambda-handler-poetry'), @@ -51,14 +51,14 @@ class TestStack extends Stack { }); this.functionNames.push(pythonFunction37.functionName); - const pythonFunction37NoHashes = new lambda.PythonFunction(this, 'my_handler_python_37_no_hashes', { + const pythonFunction37WithHashes = new lambda.PythonFunction(this, 'my_handler_python_37_with_hashes', { entry: path.join(__dirname, 'lambda-handler-poetry'), runtime: Runtime.PYTHON_3_7, bundling: { - poetryExcludeHashes: true, + poetryIncludeHashes: true, }, }); - this.functionNames.push(pythonFunction37NoHashes.functionName); + this.functionNames.push(pythonFunction37WithHashes.functionName); } } From b41369fc9ef514cf9371b562af5da8dc9fe8d9cc Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Fri, 7 Oct 2022 10:49:17 -0400 Subject: [PATCH 13/14] tests(aws-lambda-python): Update poetry function snapshots --- .../integ-lambda-python-poetry.assets.json | 40 ++--- .../integ-lambda-python-poetry.template.json | 54 +++--- .../manifest.json | 130 ++++++++++---- ...efaultTestDeployAssertE9C9CB8F.assets.json | 4 +- ...aultTestDeployAssertE9C9CB8F.template.json | 54 +++--- .../function.poetry.integ.snapshot/tree.json | 164 +++++++++--------- 6 files changed, 250 insertions(+), 196 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json index e3f82ad107124..c1f2d26c393c1 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.assets.json @@ -1,85 +1,85 @@ { "version": "21.0.0", "files": { - "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306": { + "08c3ae261768dd649ee56933737731af6e347329cb3e1faae2d767714e16c4ca": { "source": { - "path": "asset.21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306", + "path": "asset.08c3ae261768dd649ee56933737731af6e347329cb3e1faae2d767714e16c4ca", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306.zip", + "objectKey": "08c3ae261768dd649ee56933737731af6e347329cb3e1faae2d767714e16c4ca.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2": { + "14d630e3e802caab7154afce187aade52a56a39aa16c7e510afbfdd6e1e7594e": { "source": { - "path": "asset.5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2", + "path": "asset.14d630e3e802caab7154afce187aade52a56a39aa16c7e510afbfdd6e1e7594e", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2.zip", + "objectKey": "14d630e3e802caab7154afce187aade52a56a39aa16c7e510afbfdd6e1e7594e.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3": { + "1b8c70cb81031c22ef2063a87fcf090a5ce97ad10dcd400e98b01d902760ed35": { "source": { - "path": "asset.26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3", + "path": "asset.1b8c70cb81031c22ef2063a87fcf090a5ce97ad10dcd400e98b01d902760ed35", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3.zip", + "objectKey": "1b8c70cb81031c22ef2063a87fcf090a5ce97ad10dcd400e98b01d902760ed35.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e": { + "b973a843566f0b8fcccb1188a899a6ee551a5a57d9460ee11c6270226fa2c745": { "source": { - "path": "asset.5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e", + "path": "asset.b973a843566f0b8fcccb1188a899a6ee551a5a57d9460ee11c6270226fa2c745", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e.zip", + "objectKey": "b973a843566f0b8fcccb1188a899a6ee551a5a57d9460ee11c6270226fa2c745.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98": { + "65a6feb33ba221a1468300006b7fd9b123b8894e7eeb1be0e63ef23f6cf9b63e": { "source": { - "path": "asset.a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98", + "path": "asset.65a6feb33ba221a1468300006b7fd9b123b8894e7eeb1be0e63ef23f6cf9b63e", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98.zip", + "objectKey": "65a6feb33ba221a1468300006b7fd9b123b8894e7eeb1be0e63ef23f6cf9b63e.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090": { + "12b313bdc8543ea07689a76b42fb9faa74b6dfb6775de53df4e33d1041b8fe12": { "source": { - "path": "asset.65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090", + "path": "asset.12b313bdc8543ea07689a76b42fb9faa74b6dfb6775de53df4e33d1041b8fe12", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090.zip", + "objectKey": "12b313bdc8543ea07689a76b42fb9faa74b6dfb6775de53df4e33d1041b8fe12.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "06f17b3fd0ffcc68036b625750d48216e4364fa18ec482d23e28017d608e1023": { + "531f02a0310a61f667b94d14b955adbdc98e5290659054cb1039dc4e3a147271": { "source": { "path": "integ-lambda-python-poetry.template.json", "packaging": "file" @@ -87,7 +87,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "06f17b3fd0ffcc68036b625750d48216e4364fa18ec482d23e28017d608e1023.json", + "objectKey": "531f02a0310a61f667b94d14b955adbdc98e5290659054cb1039dc4e3a147271.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json index 031483dc49b31..572bc92550af7 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/integ-lambda-python-poetry.template.json @@ -38,7 +38,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306.zip" + "S3Key": "08c3ae261768dd649ee56933737731af6e347329cb3e1faae2d767714e16c4ca.zip" }, "Role": { "Fn::GetAtt": [ @@ -53,7 +53,7 @@ "myhandlerinlineServiceRole10C681F6" ] }, - "myhandlerinlinenohashesServiceRole792CBFEE": { + "myhandlerinlinewithhashesServiceRoleDC418F75": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -84,18 +84,18 @@ ] } }, - "myhandlerinlinenohashes9F4AC298": { + "myhandlerinlinewithhashes352ED54D": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2.zip" + "S3Key": "14d630e3e802caab7154afce187aade52a56a39aa16c7e510afbfdd6e1e7594e.zip" }, "Role": { "Fn::GetAtt": [ - "myhandlerinlinenohashesServiceRole792CBFEE", + "myhandlerinlinewithhashesServiceRoleDC418F75", "Arn" ] }, @@ -103,7 +103,7 @@ "Runtime": "python3.9" }, "DependsOn": [ - "myhandlerinlinenohashesServiceRole792CBFEE" + "myhandlerinlinewithhashesServiceRoleDC418F75" ] }, "myhandlerpython38ServiceRole2049AFF7": { @@ -144,7 +144,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3.zip" + "S3Key": "1b8c70cb81031c22ef2063a87fcf090a5ce97ad10dcd400e98b01d902760ed35.zip" }, "Role": { "Fn::GetAtt": [ @@ -159,7 +159,7 @@ "myhandlerpython38ServiceRole2049AFF7" ] }, - "myhandlerpython38nohashesServiceRole95183D41": { + "myhandlerpython38withhashesServiceRoleFE19CA7C": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -190,18 +190,18 @@ ] } }, - "myhandlerpython38nohashesAC448740": { + "myhandlerpython38withhashesF2275091": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e.zip" + "S3Key": "b973a843566f0b8fcccb1188a899a6ee551a5a57d9460ee11c6270226fa2c745.zip" }, "Role": { "Fn::GetAtt": [ - "myhandlerpython38nohashesServiceRole95183D41", + "myhandlerpython38withhashesServiceRoleFE19CA7C", "Arn" ] }, @@ -209,7 +209,7 @@ "Runtime": "python3.8" }, "DependsOn": [ - "myhandlerpython38nohashesServiceRole95183D41" + "myhandlerpython38withhashesServiceRoleFE19CA7C" ] }, "myhandlerpython37ServiceRole45CBD18D": { @@ -250,7 +250,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98.zip" + "S3Key": "65a6feb33ba221a1468300006b7fd9b123b8894e7eeb1be0e63ef23f6cf9b63e.zip" }, "Role": { "Fn::GetAtt": [ @@ -265,7 +265,7 @@ "myhandlerpython37ServiceRole45CBD18D" ] }, - "myhandlerpython37nohashesServiceRoleCB0A268B": { + "myhandlerpython37withhashesServiceRoleD9828997": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -296,18 +296,18 @@ ] } }, - "myhandlerpython37nohashes751F0455": { + "myhandlerpython37withhashesE95C48AC": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090.zip" + "S3Key": "12b313bdc8543ea07689a76b42fb9faa74b6dfb6775de53df4e33d1041b8fe12.zip" }, "Role": { "Fn::GetAtt": [ - "myhandlerpython37nohashesServiceRoleCB0A268B", + "myhandlerpython37withhashesServiceRoleD9828997", "Arn" ] }, @@ -315,7 +315,7 @@ "Runtime": "python3.7" }, "DependsOn": [ - "myhandlerpython37nohashesServiceRoleCB0A268B" + "myhandlerpython37withhashesServiceRoleD9828997" ] } }, @@ -328,12 +328,12 @@ "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinline53D120C7B0898676" } }, - "ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785": { + "ExportsOutputRefmyhandlerinlinewithhashes352ED54DCDE8C1A6": { "Value": { - "Ref": "myhandlerinlinenohashes9F4AC298" + "Ref": "myhandlerinlinewithhashes352ED54D" }, "Export": { - "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinewithhashes352ED54DCDE8C1A6" } }, "ExportsOutputRefmyhandlerpython384D62BBB58AA8B940": { @@ -344,12 +344,12 @@ "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython384D62BBB58AA8B940" } }, - "ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056": { + "ExportsOutputRefmyhandlerpython38withhashesF2275091B829511A": { "Value": { - "Ref": "myhandlerpython38nohashesAC448740" + "Ref": "myhandlerpython38withhashesF2275091" }, "Export": { - "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38withhashesF2275091B829511A" } }, "ExportsOutputRefmyhandlerpython37C34039A7BB71D94D": { @@ -360,12 +360,12 @@ "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37C34039A7BB71D94D" } }, - "ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78": { + "ExportsOutputRefmyhandlerpython37withhashesE95C48AC15D1F7B4": { "Value": { - "Ref": "myhandlerpython37nohashes751F0455" + "Ref": "myhandlerpython37withhashesE95C48AC" }, "Export": { - "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + "Name": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37withhashesE95C48AC15D1F7B4" } } }, diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json index 3595557c51cec..3ed278b19b21d 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/manifest.json @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/06f17b3fd0ffcc68036b625750d48216e4364fa18ec482d23e28017d608e1023.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/531f02a0310a61f667b94d14b955adbdc98e5290659054cb1039dc4e3a147271.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -51,16 +51,16 @@ "data": "myhandlerinline53D120C7" } ], - "/integ-lambda-python-poetry/my_handler_inline_no_hashes/ServiceRole/Resource": [ + "/integ-lambda-python-poetry/my_handler_inline_with_hashes/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "myhandlerinlinenohashesServiceRole792CBFEE" + "data": "myhandlerinlinewithhashesServiceRoleDC418F75" } ], - "/integ-lambda-python-poetry/my_handler_inline_no_hashes/Resource": [ + "/integ-lambda-python-poetry/my_handler_inline_with_hashes/Resource": [ { "type": "aws:cdk:logicalId", - "data": "myhandlerinlinenohashes9F4AC298" + "data": "myhandlerinlinewithhashes352ED54D" } ], "/integ-lambda-python-poetry/my_handler_python_38/ServiceRole/Resource": [ @@ -75,16 +75,16 @@ "data": "myhandlerpython384D62BBB5" } ], - "/integ-lambda-python-poetry/my_handler_python_38_no_hashes/ServiceRole/Resource": [ + "/integ-lambda-python-poetry/my_handler_python_38_with_hashes/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "myhandlerpython38nohashesServiceRole95183D41" + "data": "myhandlerpython38withhashesServiceRoleFE19CA7C" } ], - "/integ-lambda-python-poetry/my_handler_python_38_no_hashes/Resource": [ + "/integ-lambda-python-poetry/my_handler_python_38_with_hashes/Resource": [ { "type": "aws:cdk:logicalId", - "data": "myhandlerpython38nohashesAC448740" + "data": "myhandlerpython38withhashesF2275091" } ], "/integ-lambda-python-poetry/my_handler_python_37/ServiceRole/Resource": [ @@ -99,16 +99,16 @@ "data": "myhandlerpython37C34039A7" } ], - "/integ-lambda-python-poetry/my_handler_python_37_no_hashes/ServiceRole/Resource": [ + "/integ-lambda-python-poetry/my_handler_python_37_with_hashes/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "myhandlerpython37nohashesServiceRoleCB0A268B" + "data": "myhandlerpython37withhashesServiceRoleD9828997" } ], - "/integ-lambda-python-poetry/my_handler_python_37_no_hashes/Resource": [ + "/integ-lambda-python-poetry/my_handler_python_37_with_hashes/Resource": [ { "type": "aws:cdk:logicalId", - "data": "myhandlerpython37nohashes751F0455" + "data": "myhandlerpython37withhashesE95C48AC" } ], "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinline53D120C7\"}": [ @@ -117,10 +117,10 @@ "data": "ExportsOutputRefmyhandlerinline53D120C7B0898676" } ], - "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}": [ + "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinlinewithhashes352ED54D\"}": [ { "type": "aws:cdk:logicalId", - "data": "ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + "data": "ExportsOutputRefmyhandlerinlinewithhashes352ED54DCDE8C1A6" } ], "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython384D62BBB5\"}": [ @@ -129,10 +129,10 @@ "data": "ExportsOutputRefmyhandlerpython384D62BBB58AA8B940" } ], - "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}": [ + "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython38withhashesF2275091\"}": [ { "type": "aws:cdk:logicalId", - "data": "ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + "data": "ExportsOutputRefmyhandlerpython38withhashesF2275091B829511A" } ], "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37C34039A7\"}": [ @@ -141,10 +141,10 @@ "data": "ExportsOutputRefmyhandlerpython37C34039A7BB71D94D" } ], - "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}": [ + "/integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37withhashesE95C48AC\"}": [ { "type": "aws:cdk:logicalId", - "data": "ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + "data": "ExportsOutputRefmyhandlerpython37withhashesE95C48AC15D1F7B4" } ], "/integ-lambda-python-poetry/BootstrapVersion": [ @@ -158,6 +158,60 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "myhandlerinlinenohashesServiceRole792CBFEE": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerinlinenohashesServiceRole792CBFEE", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "myhandlerinlinenohashes9F4AC298": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerinlinenohashes9F4AC298", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "myhandlerpython38nohashesServiceRole95183D41": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython38nohashesServiceRole95183D41", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "myhandlerpython38nohashesAC448740": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython38nohashesAC448740", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "myhandlerpython37nohashesServiceRoleCB0A268B": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython37nohashesServiceRoleCB0A268B", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "myhandlerpython37nohashes751F0455": [ + { + "type": "aws:cdk:logicalId", + "data": "myhandlerpython37nohashes751F0455", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "integ-lambda-python-poetry" @@ -178,7 +232,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d94d2b97300a82da4fcd999e4a83fcfda5ebb8d5e1ef5d68135b6d788691a322.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/01462ebb52e8f49b3e2b2706bba447690a46e44b6f000448dac39836d7ccdd8f.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -225,22 +279,22 @@ "data": "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Default/Default": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/Default/Default": [ { "type": "aws:cdk:logicalId", - "data": "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d" + "data": "LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Invoke": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/Invoke": [ { "type": "aws:cdk:logicalId", - "data": "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65dInvoke1653CFA5" + "data": "LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8InvokeEA59DC11" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/AssertionResults": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "AssertionResultsLambdaInvokeff9d3b9c27e73458461b1c6f128cc65d" + "data": "AssertionResultsLambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8" } ], "/poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/Default/Default": [ @@ -261,22 +315,22 @@ "data": "AssertionResultsLambdaInvoke9a0beb4ea6cc38db92e9ff664c085292" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Default/Default": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/Default/Default": [ { "type": "aws:cdk:logicalId", - "data": "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98" + "data": "LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Invoke": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/Invoke": [ { "type": "aws:cdk:logicalId", - "data": "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98InvokeB52CEE1F" + "data": "LambdaInvoke26497bb1c12c14ed3deada8d7d76b39eInvoke930611A4" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/AssertionResults": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "AssertionResultsLambdaInvokec3ebca5091a904043cfed0bbe6b24f98" + "data": "AssertionResultsLambdaInvoke26497bb1c12c14ed3deada8d7d76b39e" } ], "/poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/Default/Default": [ @@ -297,22 +351,22 @@ "data": "AssertionResultsLambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Default/Default": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/Default/Default": [ { "type": "aws:cdk:logicalId", - "data": "LambdaInvokebd494a15c91a04f89bd0def3dba88362" + "data": "LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Invoke": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/Invoke": [ { "type": "aws:cdk:logicalId", - "data": "LambdaInvokebd494a15c91a04f89bd0def3dba88362Invoke27A04B5A" + "data": "LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89Invoke884F6CA8" } ], - "/poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/AssertionResults": [ + "/poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "AssertionResultsLambdaInvokebd494a15c91a04f89bd0def3dba88362" + "data": "AssertionResultsLambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89" } ], "/poetry/DefaultTest/DeployAssert/BootstrapVersion": [ diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json index 0be149dcad51b..c1f5ffea39539 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.assets.json @@ -14,7 +14,7 @@ } } }, - "d94d2b97300a82da4fcd999e4a83fcfda5ebb8d5e1ef5d68135b6d788691a322": { + "01462ebb52e8f49b3e2b2706bba447690a46e44b6f000448dac39836d7ccdd8f": { "source": { "path": "poetryDefaultTestDeployAssertE9C9CB8F.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d94d2b97300a82da4fcd999e4a83fcfda5ebb8d5e1ef5d68135b6d788691a322.json", + "objectKey": "01462ebb52e8f49b3e2b2706bba447690a46e44b6f000448dac39836d7ccdd8f.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json index c1821ec957ae3..14f2e1c399cea 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/poetryDefaultTestDeployAssertE9C9CB8F.template.json @@ -18,7 +18,7 @@ } }, "flattenResponse": "false", - "salt": "1664997544568" + "salt": "1665153703471" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -137,7 +137,7 @@ }, ":function:", { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinewithhashes352ED54DCDE8C1A6" } ] ] @@ -217,7 +217,7 @@ }, ":function:", { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38withhashesF2275091B829511A" } ] ] @@ -297,7 +297,7 @@ }, ":function:", { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37withhashesE95C48AC15D1F7B4" } ] ] @@ -330,7 +330,7 @@ } } }, - "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d": { + "LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8": { "Type": "Custom::DeployAssert@SdkCallLambdainvoke", "Properties": { "ServiceToken": { @@ -344,21 +344,21 @@ "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", "parameters": { "FunctionName": { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinewithhashes352ED54DCDE8C1A6" } }, "flattenResponse": "false", - "salt": "1664997544569" + "salt": "1665153703472" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65dInvoke1653CFA5": { + "LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8InvokeEA59DC11": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinenohashes9F4AC298FEB39785" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerinlinewithhashes352ED54DCDE8C1A6" }, "Principal": { "Fn::GetAtt": [ @@ -386,7 +386,7 @@ } }, "flattenResponse": "false", - "salt": "1664997544569" + "salt": "1665153703472" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -406,7 +406,7 @@ } } }, - "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98": { + "LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e": { "Type": "Custom::DeployAssert@SdkCallLambdainvoke", "Properties": { "ServiceToken": { @@ -420,21 +420,21 @@ "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", "parameters": { "FunctionName": { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38withhashesF2275091B829511A" } }, "flattenResponse": "false", - "salt": "1664997544569" + "salt": "1665153703472" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98InvokeB52CEE1F": { + "LambdaInvoke26497bb1c12c14ed3deada8d7d76b39eInvoke930611A4": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38nohashesAC4487400C75D056" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython38withhashesF2275091B829511A" }, "Principal": { "Fn::GetAtt": [ @@ -462,7 +462,7 @@ } }, "flattenResponse": "false", - "salt": "1664997544570" + "salt": "1665153703472" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -482,7 +482,7 @@ } } }, - "LambdaInvokebd494a15c91a04f89bd0def3dba88362": { + "LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89": { "Type": "Custom::DeployAssert@SdkCallLambdainvoke", "Properties": { "ServiceToken": { @@ -496,21 +496,21 @@ "expected": "{\"$ObjectLike\":{\"Payload\":\"200\"}}", "parameters": { "FunctionName": { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37withhashesE95C48AC15D1F7B4" } }, "flattenResponse": "false", - "salt": "1664997544570" + "salt": "1665153703472" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "LambdaInvokebd494a15c91a04f89bd0def3dba88362Invoke27A04B5A": { + "LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89Invoke884F6CA8": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { - "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37nohashes751F0455248FFA78" + "Fn::ImportValue": "integ-lambda-python-poetry:ExportsOutputRefmyhandlerpython37withhashesE95C48AC15D1F7B4" }, "Principal": { "Fn::GetAtt": [ @@ -530,10 +530,10 @@ ] } }, - "AssertionResultsLambdaInvokeff9d3b9c27e73458461b1c6f128cc65d": { + "AssertionResultsLambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8": { "Value": { "Fn::GetAtt": [ - "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d", + "LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8", "assertion" ] } @@ -546,10 +546,10 @@ ] } }, - "AssertionResultsLambdaInvokec3ebca5091a904043cfed0bbe6b24f98": { + "AssertionResultsLambdaInvoke26497bb1c12c14ed3deada8d7d76b39e": { "Value": { "Fn::GetAtt": [ - "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98", + "LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e", "assertion" ] } @@ -562,10 +562,10 @@ ] } }, - "AssertionResultsLambdaInvokebd494a15c91a04f89bd0def3dba88362": { + "AssertionResultsLambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89": { "Value": { "Fn::GetAtt": [ - "LambdaInvokebd494a15c91a04f89bd0def3dba88362", + "LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89", "assertion" ] } diff --git a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json index 8d528b9cac994..3d1428fb4d593 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-lambda-python/test/function.poetry.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } }, "integ-lambda-python-poetry": { @@ -105,7 +105,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "21e30b22c7168c8dec59d20a9f06d44d9e17a2c36d03709a0af9a2328400f306.zip" + "s3Key": "08c3ae261768dd649ee56933737731af6e347329cb3e1faae2d767714e16c4ca.zip" }, "role": { "Fn::GetAtt": [ @@ -128,17 +128,17 @@ "version": "0.0.0" } }, - "my_handler_inline_no_hashes": { - "id": "my_handler_inline_no_hashes", - "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes", + "my_handler_inline_with_hashes": { + "id": "my_handler_inline_with_hashes", + "path": "integ-lambda-python-poetry/my_handler_inline_with_hashes", "children": { "ServiceRole": { "id": "ServiceRole", - "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/ServiceRole", + "path": "integ-lambda-python-poetry/my_handler_inline_with_hashes/ServiceRole", "children": { "Resource": { "id": "Resource", - "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/ServiceRole/Resource", + "path": "integ-lambda-python-poetry/my_handler_inline_with_hashes/ServiceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -183,11 +183,11 @@ }, "Code": { "id": "Code", - "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Code", + "path": "integ-lambda-python-poetry/my_handler_inline_with_hashes/Code", "children": { "Stage": { "id": "Stage", - "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Code/Stage", + "path": "integ-lambda-python-poetry/my_handler_inline_with_hashes/Code/Stage", "constructInfo": { "fqn": "@aws-cdk/core.AssetStaging", "version": "0.0.0" @@ -195,7 +195,7 @@ }, "AssetBucket": { "id": "AssetBucket", - "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Code/AssetBucket", + "path": "integ-lambda-python-poetry/my_handler_inline_with_hashes/Code/AssetBucket", "constructInfo": { "fqn": "@aws-cdk/aws-s3.BucketBase", "version": "0.0.0" @@ -209,7 +209,7 @@ }, "Resource": { "id": "Resource", - "path": "integ-lambda-python-poetry/my_handler_inline_no_hashes/Resource", + "path": "integ-lambda-python-poetry/my_handler_inline_with_hashes/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { @@ -217,11 +217,11 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "5d8aec29e1a55133e2497923f2cc45b503fbf1db121bdeded08e5e855fef7df2.zip" + "s3Key": "14d630e3e802caab7154afce187aade52a56a39aa16c7e510afbfdd6e1e7594e.zip" }, "role": { "Fn::GetAtt": [ - "myhandlerinlinenohashesServiceRole792CBFEE", + "myhandlerinlinewithhashesServiceRoleDC418F75", "Arn" ] }, @@ -329,7 +329,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "26306a158d3fd4f738a430c4db1add105eb5b89fe9434560566d5476f16a93a3.zip" + "s3Key": "1b8c70cb81031c22ef2063a87fcf090a5ce97ad10dcd400e98b01d902760ed35.zip" }, "role": { "Fn::GetAtt": [ @@ -352,17 +352,17 @@ "version": "0.0.0" } }, - "my_handler_python_38_no_hashes": { - "id": "my_handler_python_38_no_hashes", - "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes", + "my_handler_python_38_with_hashes": { + "id": "my_handler_python_38_with_hashes", + "path": "integ-lambda-python-poetry/my_handler_python_38_with_hashes", "children": { "ServiceRole": { "id": "ServiceRole", - "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/ServiceRole", + "path": "integ-lambda-python-poetry/my_handler_python_38_with_hashes/ServiceRole", "children": { "Resource": { "id": "Resource", - "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/ServiceRole/Resource", + "path": "integ-lambda-python-poetry/my_handler_python_38_with_hashes/ServiceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -407,11 +407,11 @@ }, "Code": { "id": "Code", - "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Code", + "path": "integ-lambda-python-poetry/my_handler_python_38_with_hashes/Code", "children": { "Stage": { "id": "Stage", - "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Code/Stage", + "path": "integ-lambda-python-poetry/my_handler_python_38_with_hashes/Code/Stage", "constructInfo": { "fqn": "@aws-cdk/core.AssetStaging", "version": "0.0.0" @@ -419,7 +419,7 @@ }, "AssetBucket": { "id": "AssetBucket", - "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Code/AssetBucket", + "path": "integ-lambda-python-poetry/my_handler_python_38_with_hashes/Code/AssetBucket", "constructInfo": { "fqn": "@aws-cdk/aws-s3.BucketBase", "version": "0.0.0" @@ -433,7 +433,7 @@ }, "Resource": { "id": "Resource", - "path": "integ-lambda-python-poetry/my_handler_python_38_no_hashes/Resource", + "path": "integ-lambda-python-poetry/my_handler_python_38_with_hashes/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { @@ -441,11 +441,11 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "5451c865a017738b75f52d105dbb15407b9e7441f4ebcf636e3770ef6551578e.zip" + "s3Key": "b973a843566f0b8fcccb1188a899a6ee551a5a57d9460ee11c6270226fa2c745.zip" }, "role": { "Fn::GetAtt": [ - "myhandlerpython38nohashesServiceRole95183D41", + "myhandlerpython38withhashesServiceRoleFE19CA7C", "Arn" ] }, @@ -553,7 +553,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "a4cab839dbe6bd7204b2b731036c4c4538acc47d0b6fb8576fbebe97f8f38d98.zip" + "s3Key": "65a6feb33ba221a1468300006b7fd9b123b8894e7eeb1be0e63ef23f6cf9b63e.zip" }, "role": { "Fn::GetAtt": [ @@ -576,17 +576,17 @@ "version": "0.0.0" } }, - "my_handler_python_37_no_hashes": { - "id": "my_handler_python_37_no_hashes", - "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes", + "my_handler_python_37_with_hashes": { + "id": "my_handler_python_37_with_hashes", + "path": "integ-lambda-python-poetry/my_handler_python_37_with_hashes", "children": { "ServiceRole": { "id": "ServiceRole", - "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/ServiceRole", + "path": "integ-lambda-python-poetry/my_handler_python_37_with_hashes/ServiceRole", "children": { "Resource": { "id": "Resource", - "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/ServiceRole/Resource", + "path": "integ-lambda-python-poetry/my_handler_python_37_with_hashes/ServiceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -631,11 +631,11 @@ }, "Code": { "id": "Code", - "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Code", + "path": "integ-lambda-python-poetry/my_handler_python_37_with_hashes/Code", "children": { "Stage": { "id": "Stage", - "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Code/Stage", + "path": "integ-lambda-python-poetry/my_handler_python_37_with_hashes/Code/Stage", "constructInfo": { "fqn": "@aws-cdk/core.AssetStaging", "version": "0.0.0" @@ -643,7 +643,7 @@ }, "AssetBucket": { "id": "AssetBucket", - "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Code/AssetBucket", + "path": "integ-lambda-python-poetry/my_handler_python_37_with_hashes/Code/AssetBucket", "constructInfo": { "fqn": "@aws-cdk/aws-s3.BucketBase", "version": "0.0.0" @@ -657,7 +657,7 @@ }, "Resource": { "id": "Resource", - "path": "integ-lambda-python-poetry/my_handler_python_37_no_hashes/Resource", + "path": "integ-lambda-python-poetry/my_handler_python_37_with_hashes/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { @@ -665,11 +665,11 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "65c6cb219fd3f30358284256483c54826d81439db866744fee59706d158b3090.zip" + "s3Key": "12b313bdc8543ea07689a76b42fb9faa74b6dfb6775de53df4e33d1041b8fe12.zip" }, "role": { "Fn::GetAtt": [ - "myhandlerpython37nohashesServiceRoleCB0A268B", + "myhandlerpython37withhashesServiceRoleD9828997", "Arn" ] }, @@ -700,9 +700,9 @@ "version": "0.0.0" } }, - "Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}": { - "id": "Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}", - "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinlinenohashes9F4AC298\"}", + "Output{\"Ref\":\"myhandlerinlinewithhashes352ED54D\"}": { + "id": "Output{\"Ref\":\"myhandlerinlinewithhashes352ED54D\"}", + "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerinlinewithhashes352ED54D\"}", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "0.0.0" @@ -716,9 +716,9 @@ "version": "0.0.0" } }, - "Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}": { - "id": "Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}", - "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython38nohashesAC448740\"}", + "Output{\"Ref\":\"myhandlerpython38withhashesF2275091\"}": { + "id": "Output{\"Ref\":\"myhandlerpython38withhashesF2275091\"}", + "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython38withhashesF2275091\"}", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "0.0.0" @@ -732,9 +732,9 @@ "version": "0.0.0" } }, - "Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}": { - "id": "Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}", - "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37nohashes751F0455\"}", + "Output{\"Ref\":\"myhandlerpython37withhashesE95C48AC\"}": { + "id": "Output{\"Ref\":\"myhandlerpython37withhashesE95C48AC\"}", + "path": "integ-lambda-python-poetry/Exports/Output{\"Ref\":\"myhandlerpython37withhashesE95C48AC\"}", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "0.0.0" @@ -743,7 +743,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } } }, @@ -765,7 +765,7 @@ "path": "poetry/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } }, "DeployAssert": { @@ -785,7 +785,7 @@ "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke81c9998b1b428b309c8501e21b919d3d/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } } }, @@ -865,23 +865,23 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } }, - "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d": { - "id": "LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d", + "LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8": { + "id": "LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8", "children": { "SdkProvider": { "id": "SdkProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/SdkProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/SdkProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/SdkProvider/AssertionsProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } } }, @@ -892,11 +892,11 @@ }, "Default": { "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/Default", "children": { "Default": { "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Default/Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/Default/Default", "constructInfo": { "fqn": "@aws-cdk/core.CfnResource", "version": "0.0.0" @@ -910,7 +910,7 @@ }, "Invoke": { "id": "Invoke", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/Invoke", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/Invoke", "constructInfo": { "fqn": "@aws-cdk/core.CfnResource", "version": "0.0.0" @@ -918,7 +918,7 @@ }, "AssertionResults": { "id": "AssertionResults", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokeff9d3b9c27e73458461b1c6f128cc65d/AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke82a73e0d5d0fdcb04565e4d81ef342b8/AssertionResults", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "0.0.0" @@ -943,7 +943,7 @@ "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke9a0beb4ea6cc38db92e9ff664c085292/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } } }, @@ -992,20 +992,20 @@ "version": "0.0.0" } }, - "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98": { - "id": "LambdaInvokec3ebca5091a904043cfed0bbe6b24f98", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98", + "LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e": { + "id": "LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e", "children": { "SdkProvider": { "id": "SdkProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/SdkProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/SdkProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/SdkProvider/AssertionsProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } } }, @@ -1016,11 +1016,11 @@ }, "Default": { "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/Default", "children": { "Default": { "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Default/Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/Default/Default", "constructInfo": { "fqn": "@aws-cdk/core.CfnResource", "version": "0.0.0" @@ -1034,7 +1034,7 @@ }, "Invoke": { "id": "Invoke", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/Invoke", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/Invoke", "constructInfo": { "fqn": "@aws-cdk/core.CfnResource", "version": "0.0.0" @@ -1042,7 +1042,7 @@ }, "AssertionResults": { "id": "AssertionResults", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokec3ebca5091a904043cfed0bbe6b24f98/AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke26497bb1c12c14ed3deada8d7d76b39e/AssertionResults", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "0.0.0" @@ -1067,7 +1067,7 @@ "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke631dde0680edf7d2f0eea8d9b9c06c75/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } } }, @@ -1116,20 +1116,20 @@ "version": "0.0.0" } }, - "LambdaInvokebd494a15c91a04f89bd0def3dba88362": { - "id": "LambdaInvokebd494a15c91a04f89bd0def3dba88362", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362", + "LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89": { + "id": "LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89", "children": { "SdkProvider": { "id": "SdkProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/SdkProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/SdkProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/SdkProvider/AssertionsProvider", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.108" + "version": "10.1.123" } } }, @@ -1140,11 +1140,11 @@ }, "Default": { "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/Default", "children": { "Default": { "id": "Default", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Default/Default", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/Default/Default", "constructInfo": { "fqn": "@aws-cdk/core.CfnResource", "version": "0.0.0" @@ -1158,7 +1158,7 @@ }, "Invoke": { "id": "Invoke", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/Invoke", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/Invoke", "constructInfo": { "fqn": "@aws-cdk/core.CfnResource", "version": "0.0.0" @@ -1166,7 +1166,7 @@ }, "AssertionResults": { "id": "AssertionResults", - "path": "poetry/DefaultTest/DeployAssert/LambdaInvokebd494a15c91a04f89bd0def3dba88362/AssertionResults", + "path": "poetry/DefaultTest/DeployAssert/LambdaInvoke8cbaf98b5be6e4f6f81f5f10b5b8dc89/AssertionResults", "constructInfo": { "fqn": "@aws-cdk/core.CfnOutput", "version": "0.0.0" From a8ee8d0bba073292d6ab8a99fc36b9128a491f3f Mon Sep 17 00:00:00 2001 From: a-bigelow Date: Fri, 7 Oct 2022 10:58:04 -0400 Subject: [PATCH 14/14] fix prop name on Packaging.fromEntry() --- packages/@aws-cdk/aws-lambda-python/lib/packaging.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts index 3402dd15c4b82..53cc9f9a23570 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/packaging.ts @@ -79,11 +79,11 @@ export class Packaging { return new Packaging({ dependenciesFile: DependenciesFile.NONE }); } - public static fromEntry(entry: string, poetryExcludeHashes?: boolean): Packaging { + public static fromEntry(entry: string, poetryIncludeHashes?: boolean): Packaging { if (fs.existsSync(path.join(entry, DependenciesFile.PIPENV))) { return this.withPipenv(); } if (fs.existsSync(path.join(entry, DependenciesFile.POETRY))) { - return this.withPoetry({ poetryIncludeHashes: poetryExcludeHashes }); + return this.withPoetry({ poetryIncludeHashes }); } else if (fs.existsSync(path.join(entry, DependenciesFile.PIP))) { return this.withPip(); } else {