-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update lambda runtime validation to new data (#3297)
- Loading branch information
Showing
13 changed files
with
244 additions
and
93 deletions.
There are no files selected for viewing
125 changes: 73 additions & 52 deletions
125
src/cfnlint/data/AdditionalSpecs/LmbdRuntimeLifecycle.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,128 @@ | ||
{ | ||
"dotnet6": { | ||
"create-block": "2025-02-28", | ||
"deprecated": "2024-11-12", | ||
"eol": "2025-01-11", | ||
"successor": "dotnet8" | ||
"successor": "dotnet8", | ||
"update-block": "2025-05-31" | ||
}, | ||
"dotnet7": { | ||
"create-block": "2024-05-14", | ||
"deprecated": "2024-05-14", | ||
"eol": "2026-10-08", | ||
"successor": "dotnet8" | ||
"successor": "dotnet8", | ||
"update-block": "2024-05-14" | ||
}, | ||
"dotnetcore1.0": { | ||
"deprecated": "2019-07-31", | ||
"eol": "2019-06-27", | ||
"successor": "dotnet8" | ||
"create-block": "2019-07-30", | ||
"deprecated": "2019-06-27", | ||
"successor": "dotnet8", | ||
"update-block": "2019-07-30" | ||
}, | ||
"dotnetcore2.0": { | ||
"create-block": "2019-05-30", | ||
"deprecated": "2019-05-30", | ||
"eol": "2019-04-30", | ||
"successor": "dotnet8" | ||
"successor": "dotnet8", | ||
"update-block": "2019-05-30" | ||
}, | ||
"dotnetcore2.1": { | ||
"deprecated": "2021-09-23", | ||
"eol": "2021-08-23", | ||
"successor": "dotnet8" | ||
"create-block": "2022-01-05", | ||
"deprecated": "2022-01-05", | ||
"successor": "dotnet8", | ||
"update-block": "2022-04-13" | ||
}, | ||
"dotnetcore3.1": { | ||
"deprecated": "2023-02-20", | ||
"eol": "2023-01-20", | ||
"successor": "dotnet8" | ||
"create-block": "2023-04-03", | ||
"deprecated": "2023-04-03", | ||
"successor": "dotnet8", | ||
"update-block": "2023-05-03" | ||
}, | ||
"nodejs": { | ||
"create-block": "2016-10-31", | ||
"deprecated": "2016-10-31", | ||
"eol": "2016-10-31", | ||
"successor": "nodejs20.x" | ||
"successor": "nodejs20.x", | ||
"update-block": "2016-10-31" | ||
}, | ||
"nodejs10.x": { | ||
"deprecated": "2021-08-30", | ||
"eol": "2021-07-30", | ||
"successor": "nodejs20.x" | ||
"create-block": "2021-07-30", | ||
"deprecated": "2021-07-30", | ||
"successor": "nodejs20.x", | ||
"update-block": "2022-02-14" | ||
}, | ||
"nodejs12.x": { | ||
"deprecated": "2022-12-14", | ||
"eol": "2022-11-14", | ||
"successor": "nodejs20.x" | ||
"create-block": "2023-03-31", | ||
"deprecated": "2023-03-31", | ||
"successor": "nodejs20.x", | ||
"update-block": "2023-04-30" | ||
}, | ||
"nodejs14.x": { | ||
"create-block": "2024-07-09", | ||
"deprecated": "2023-12-04", | ||
"eol": "2024-01-09", | ||
"successor": "nodejs20.x" | ||
"successor": "nodejs20.x", | ||
"update-block": "2025-02-28" | ||
}, | ||
"nodejs16.x": { | ||
"create-block": "2025-02-28", | ||
"deprecated": "2024-06-12", | ||
"eol": "2024-07-15", | ||
"successor": "nodejs20.x" | ||
"successor": "nodejs20.x", | ||
"update-block": "2025-03-31" | ||
}, | ||
"nodejs4.3": { | ||
"deprecated": "2019-04-30", | ||
"eol": "2018-04-30", | ||
"successor": "nodejs20.x" | ||
"create-block": "2020-03-05", | ||
"deprecated": "2020-03-05", | ||
"successor": "nodejs20.x", | ||
"update-block": "2020-03-05" | ||
}, | ||
"nodejs4.3-edge": { | ||
"deprecated": "2019-04-30", | ||
"eol": "2018-04-30", | ||
"successor": "nodejs20.x" | ||
"create-block": "2019-04-30", | ||
"deprecated": "2020-03-05", | ||
"successor": "nodejs20.x", | ||
"update-block": "2019-04-30" | ||
}, | ||
"nodejs6.10": { | ||
"create-block": "2019-08-12", | ||
"deprecated": "2019-08-12", | ||
"eol": "2019-04-30", | ||
"successor": "nodejs20.x" | ||
"successor": "nodejs20.x", | ||
"update-block": "2019-08-12" | ||
}, | ||
"nodejs8.10": { | ||
"deprecated": "2020-02-03", | ||
"eol": "2019-12-31", | ||
"successor": "nodejs20.x" | ||
"create-block": "2020-03-06", | ||
"deprecated": "2020-03-06", | ||
"successor": "nodejs20.x", | ||
"update-block": "2020-03-06" | ||
}, | ||
"python2.7": { | ||
"deprecated": "2021-09-30", | ||
"eol": "2021-07-15", | ||
"successor": "python3.12" | ||
"create-block": "2021-07-15", | ||
"deprecated": "2021-07-15", | ||
"successor": "python3.12", | ||
"update-block": "2022-05-30" | ||
}, | ||
"python3.6": { | ||
"deprecated": "2022-08-17", | ||
"eol": "2022-07-18", | ||
"successor": "python3.12" | ||
"create-block": "2022-07-18", | ||
"deprecated": "2022-07-18", | ||
"successor": "python3.12", | ||
"update-block": "2022-08-29" | ||
}, | ||
"python3.7": { | ||
"create-block": "2024-01-09", | ||
"deprecated": "2023-12-04", | ||
"eol": "2024-01-09", | ||
"successor": "python3.12" | ||
"successor": "python3.12", | ||
"update-block": "2025-02-28" | ||
}, | ||
"python3.8": { | ||
"create-block": "2025-02-28", | ||
"deprecated": "2024-10-14", | ||
"eol": "2024-11-13", | ||
"successor": "python3.12" | ||
"successor": "python3.12", | ||
"update-block": "2025-03-31" | ||
}, | ||
"ruby2.5": { | ||
"create-block": "2021-07-30", | ||
"deprecated": "2021-07-30", | ||
"eol": "2021-07-30", | ||
"successor": "ruby3.2" | ||
"successor": "ruby3.2", | ||
"update-block": "2022-03-31" | ||
}, | ||
"ruby2.7": { | ||
"create-block": "2024-01-09", | ||
"deprecated": "2023-12-07", | ||
"eol": "2024-01-09", | ||
"successor": "ruby3.2" | ||
"successor": "ruby3.2", | ||
"update-block": "2025-02-28" | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/cfnlint/rules/resources/lmbd/DeprecatedRuntimeCreate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
SPDX-License-Identifier: MIT-0 | ||
""" | ||
|
||
from datetime import datetime | ||
|
||
from cfnlint.rules import RuleMatch | ||
from cfnlint.rules.resources.lmbd.DeprecatedRuntime import DeprecatedRuntime | ||
|
||
|
||
class DeprecatedRuntimeCreate(DeprecatedRuntime): | ||
"""Check if EOL Lambda Function Runtimes are used""" | ||
|
||
id = "E2531" | ||
shortdesc = "Check if Lambda Function Runtimes are creatable" | ||
description = ( | ||
"Check if an EOL Lambda Runtime is specified and you cannot create the function" | ||
) | ||
source_url = ( | ||
"https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html" | ||
) | ||
tags = ["resources", "lambda", "runtime"] | ||
|
||
def check_runtime(self, runtime_value, path): | ||
"""Check if the given runtime is valid""" | ||
matches = [] | ||
|
||
runtime = self.deprecated_runtimes.get(runtime_value) | ||
if runtime: | ||
if ( | ||
datetime.strptime(runtime["create-block"], "%Y-%m-%d") | ||
< self.current_date | ||
and datetime.strptime(runtime["update-block"], "%Y-%m-%d") | ||
> self.current_date | ||
): | ||
message = "Runtime ({0}) was deprecated on {1}. Creation disabled on {2} and update on {3}. Please consider updating to {3}" | ||
matches.append( | ||
RuleMatch( | ||
path, | ||
message.format( | ||
runtime_value, | ||
runtime["deprecated"], | ||
runtime["create-block"], | ||
runtime["update-block"], | ||
runtime["successor"], | ||
), | ||
) | ||
) | ||
return matches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.