From 9b106904fcabd58c378ac78f332026df3a63490b Mon Sep 17 00:00:00 2001 From: AJ Stuyvenberg Date: Tue, 1 Aug 2023 10:16:44 -0400 Subject: [PATCH] feat: support python 3.11 (#100) --- serverless/src/layer.ts | 3 +++ serverless/test/layer.spec.ts | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/serverless/src/layer.ts b/serverless/src/layer.ts index 3ee8c35..d8d5b56 100644 --- a/serverless/src/layer.ts +++ b/serverless/src/layer.ts @@ -48,6 +48,7 @@ export const runtimeLookup: { [key: string]: RuntimeType } = { "python3.8": RuntimeType.PYTHON, "python3.9": RuntimeType.PYTHON, "python3.10": RuntimeType.PYTHON, + "python3.11": RuntimeType.PYTHON, }; function runtimeToLayerName(runtime: string, architecture: string): string { @@ -65,12 +66,14 @@ function runtimeToLayerName(runtime: string, architecture: string): string { "python3.8": "Datadog-Python38", "python3.9": "Datadog-Python39", "python3.10": "Datadog-Python310", + "python3.11": "Datadog-Python311", }; const pythonArmLookup: { [key: string]: string } = { "python3.8": "Datadog-Python38-ARM", "python3.9": "Datadog-Python39-ARM", "python3.10": "Datadog-Python310-ARM", + "python3.11": "Datadog-Python311-ARM", }; if (runtimeLookup[runtime] === RuntimeType.NODE) { diff --git a/serverless/test/layer.spec.ts b/serverless/test/layer.spec.ts index da1ad9a..504eb79 100644 --- a/serverless/test/layer.spec.ts +++ b/serverless/test/layer.spec.ts @@ -60,6 +60,7 @@ describe("findLambdas", () => { Python38Function: mockFunctionResource("python3.8", ["x86_64"]), Python39Function: mockFunctionResource("python3.9", ["x86_64"]), Python310Function: mockFunctionResource("python3.10", ["x86_64"]), + Python311Function: mockFunctionResource("python3.11", ["x86_64"]), GoFunction: mockFunctionResource("go1.10", ["x86_64"]), RefFunction: mockFunctionResource({ Ref: "ValueRef" }, ["arm64"]), }; @@ -76,6 +77,7 @@ describe("findLambdas", () => { mockLambdaFunction("Python38Function", "python3.8", RuntimeType.PYTHON, "x86_64", ArchitectureType.x86_64), mockLambdaFunction("Python39Function", "python3.9", RuntimeType.PYTHON, "x86_64", ArchitectureType.x86_64), mockLambdaFunction("Python310Function", "python3.10", RuntimeType.PYTHON, "x86_64", ArchitectureType.x86_64), + mockLambdaFunction("Python311Function", "python3.11", RuntimeType.PYTHON, "x86_64", ArchitectureType.x86_64), mockLambdaFunction("GoFunction", "go1.10", RuntimeType.UNSUPPORTED, "x86_64", ArchitectureType.x86_64), mockLambdaFunction("RefFunction", "nodejs14.x", RuntimeType.NODE, "arm64", ArchitectureType.ARM64, { Ref: "ValueRef", @@ -188,7 +190,7 @@ describe("applyLayers", () => { }); it("applies the python and extension lambda layers for arm", () => { - const lambda = mockLambdaFunction("FunctionKey", "python3.10", RuntimeType.PYTHON, "arm64", ArchitectureType.ARM64); + const lambda = mockLambdaFunction("FunctionKey", "python3.11", RuntimeType.PYTHON, "arm64", ArchitectureType.ARM64); const region = "us-east-1"; const pythonLayerVersion = 25; const extensionLayerVersion = 6; @@ -196,7 +198,7 @@ describe("applyLayers", () => { expect(errors.length).toEqual(0); expect(lambda.properties.Layers).toEqual([ - `arn:aws:lambda:${region}:${DD_ACCOUNT_ID}:layer:Datadog-Python310-ARM:${pythonLayerVersion}`, + `arn:aws:lambda:${region}:${DD_ACCOUNT_ID}:layer:Datadog-Python311-ARM:${pythonLayerVersion}`, `arn:aws:lambda:${region}:${DD_ACCOUNT_ID}:layer:Datadog-Extension-ARM:${extensionLayerVersion}`, ]); });