From fc50463f7e2f177dc759baee94ae1b7feea74413 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 08:57:37 +0000 Subject: [PATCH 01/17] chore(deps): bump cfn-lint from 0.87.7 to 1.4.2 in /requirements Bumps [cfn-lint](https://github.com/aws-cloudformation/cfn-lint) from 0.87.7 to 1.4.2. - [Release notes](https://github.com/aws-cloudformation/cfn-lint/releases) - [Changelog](https://github.com/aws-cloudformation/cfn-lint/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws-cloudformation/cfn-lint/compare/v0.87.7...v1.4.2) --- updated-dependencies: - dependency-name: cfn-lint dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- requirements/reproducible-linux.txt | 6 +++--- requirements/reproducible-mac.txt | 6 +++--- requirements/reproducible-win.txt | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index b0bbffc0eb..d8839171ab 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -28,7 +28,7 @@ regex!=2021.10.8 tzlocal==5.2 #Adding cfn-lint dependency for SAM validate -cfn-lint~=0.87.7 +cfn-lint~=1.4.2 # Type checking boto3 objects boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.134 diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt index 30021ce110..ed57109851 100644 --- a/requirements/reproducible-linux.txt +++ b/requirements/reproducible-linux.txt @@ -116,9 +116,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==0.87.7 \ - --hash=sha256:85f6b7f32cf155a74d670d53f86b39f99cfc282b02158d98fdab9fc1dba0809e \ - --hash=sha256:ac6ac86dde1ba3d0fb0e217a4d329239a98f00af7862e4fa5ace6c416c4e056c +cfn-lint==1.4.2 \ + --hash=sha256:5f70df127c438117bb7f6da73e2310cebcf1901ba5ed001c6fbb0715c09efdde \ + --hash=sha256:7b884d0c79b7f3b40212df42299211e2c4f37e1598ac9f5d36c7e2142d23702c # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ diff --git a/requirements/reproducible-mac.txt b/requirements/reproducible-mac.txt index 6ed42bb0f3..0f15d12e52 100644 --- a/requirements/reproducible-mac.txt +++ b/requirements/reproducible-mac.txt @@ -134,9 +134,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==0.87.7 \ - --hash=sha256:85f6b7f32cf155a74d670d53f86b39f99cfc282b02158d98fdab9fc1dba0809e \ - --hash=sha256:ac6ac86dde1ba3d0fb0e217a4d329239a98f00af7862e4fa5ace6c416c4e056c +cfn-lint==1.4.2 \ + --hash=sha256:5f70df127c438117bb7f6da73e2310cebcf1901ba5ed001c6fbb0715c09efdde \ + --hash=sha256:7b884d0c79b7f3b40212df42299211e2c4f37e1598ac9f5d36c7e2142d23702c # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ diff --git a/requirements/reproducible-win.txt b/requirements/reproducible-win.txt index e82b71ee41..cc2e4712da 100644 --- a/requirements/reproducible-win.txt +++ b/requirements/reproducible-win.txt @@ -116,9 +116,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==0.87.7 \ - --hash=sha256:85f6b7f32cf155a74d670d53f86b39f99cfc282b02158d98fdab9fc1dba0809e \ - --hash=sha256:ac6ac86dde1ba3d0fb0e217a4d329239a98f00af7862e4fa5ace6c416c4e056c +cfn-lint==1.4.2 \ + --hash=sha256:5f70df127c438117bb7f6da73e2310cebcf1901ba5ed001c6fbb0715c09efdde \ + --hash=sha256:7b884d0c79b7f3b40212df42299211e2c4f37e1598ac9f5d36c7e2142d23702c # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ From 2ef1bcccfaec7a9f4703e06bb271d2d6e05ad706 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 28 Jun 2024 08:58:35 +0000 Subject: [PATCH 02/17] Update reproducibles: update-reproducible-linux-reqs --- requirements/reproducible-linux.txt | 30 ++--------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt index ed57109851..1cd5d7c05a 100644 --- a/requirements/reproducible-linux.txt +++ b/requirements/reproducible-linux.txt @@ -16,10 +16,8 @@ attrs==23.2.0 \ --hash=sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30 \ --hash=sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1 # via - # jschema-to-python # jsonschema # referencing - # sarif-om aws-lambda-builders==1.50.0 \ --hash=sha256:40a613ecb19fbf0b64a47bae14bd252ea5da32ea71fde9808d596e2dbc011baf \ --hash=sha256:ad95ed55359c399872f5825582896500dfc1c5564eccf2a6ab8d0e9f6c1ae385 @@ -298,18 +296,10 @@ jmespath==1.0.1 \ # aws-sam-cli (setup.py) # boto3 # botocore -jschema-to-python==1.2.3 \ - --hash=sha256:76ff14fe5d304708ccad1284e4b11f96a658949a31ee7faed9e0995279549b91 \ - --hash=sha256:8a703ca7604d42d74b2815eecf99a33359a8dccbb80806cce386d5e2dd992b05 - # via cfn-lint jsonpatch==1.33 \ --hash=sha256:0ae28c0cd062bbd8b8ecc26d7d164fbbea9652a1a3693f3b956c1eae5145dade \ --hash=sha256:9fcd4009c41e6d12348b4a0ff2563ba56a2923a7dfee731d004e212e1ee5030c # via cfn-lint -jsonpickle==3.2.2 \ - --hash=sha256:87cd82d237fd72c5a34970e7222dddc0accc13fddf49af84111887ed9a9445aa \ - --hash=sha256:d425fd2b8afe9f5d7d57205153403fbf897782204437882a477e8eed60930f8c - # via jschema-to-python jsonpointer==3.0.0 \ --hash=sha256:13e088adc14fca8b6aa8177c044e12701e6ad4b28ff10e65f2267a90109c9942 \ --hash=sha256:2b2d729f2091522d61c3b31f82e11870f60b68f43fbc705cb76bf4b832af59ef @@ -320,15 +310,10 @@ jsonschema==4.22.0 \ # via # aws-sam-cli (setup.py) # aws-sam-translator - # cfn-lint jsonschema-specifications==2023.12.1 \ --hash=sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc \ --hash=sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c # via jsonschema -junit-xml==1.9 \ - --hash=sha256:de16a051990d4e25a3982b2dd9e89d671067548718866416faec14d9de56db9f \ - --hash=sha256:ec5ca1a55aefdd76d28fcc0b135251d156c7106fa979686a4b48d62b761b4732 - # via cfn-lint markdown-it-py==3.0.0 \ --hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \ --hash=sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb @@ -465,12 +450,6 @@ networkx==3.3 \ --hash=sha256:0c127d8b2f4865f59ae9cb8aafcd60b5c70f3241ebd66f7defad7c4ab90126c9 \ --hash=sha256:28575580c6ebdaf4505b22c6256a2b9de86b316dc63ba9e93abde3d78dfdbcf2 # via cfn-lint -pbr==6.0.0 \ - --hash=sha256:4a7317d5e3b17a3dccb6a8cfe67dab65b20551404c52c8ed41279fa4f0cb4cda \ - --hash=sha256:d1377122a5a00e2f940ee482999518efe16d745d423a670c27773dfbc3c9a7d9 - # via - # jschema-to-python - # sarif-om pycparser==2.22 \ --hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \ --hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc @@ -894,16 +873,10 @@ s3transfer==0.10.1 \ --hash=sha256:5683916b4c724f799e600f41dd9e10a9ff19871bf87623cc8f491cb4f5fa0a19 \ --hash=sha256:ceb252b11bcf87080fb7850a224fb6e05c8a776bab8f2b64b7f25b969464839d # via boto3 -sarif-om==1.0.4 \ - --hash=sha256:539ef47a662329b1c8502388ad92457425e95dc0aaaf995fe46f4984c4771911 \ - --hash=sha256:cd5f416b3083e00d402a92e449a7ff67af46f11241073eea0461802a3b5aef98 - # via cfn-lint six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.12.1 \ --hash=sha256:2877b03f998cd8c08f07cd0de5b767119cd3ef40d09f41c30d722f6686b0fb88 \ --hash=sha256:9b2cbc7f1a640289430e13d2a56f02f867a1da0190f2f99d8968c2f74da0e515 @@ -935,6 +908,7 @@ typing-extensions==4.12.2 \ # aws-sam-cli (setup.py) # aws-sam-translator # boto3-stubs + # cfn-lint # mypy-boto3-apigateway # mypy-boto3-cloudformation # mypy-boto3-ecr From 64c3753b9b95a09be6298c57fd114e5acb735397 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 28 Jun 2024 09:00:16 +0000 Subject: [PATCH 03/17] Update reproducibles: update-reproducible-mac-reqs --- requirements/reproducible-mac.txt | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/requirements/reproducible-mac.txt b/requirements/reproducible-mac.txt index 0f15d12e52..abeab4772e 100644 --- a/requirements/reproducible-mac.txt +++ b/requirements/reproducible-mac.txt @@ -16,10 +16,8 @@ attrs==23.2.0 \ --hash=sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30 \ --hash=sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1 # via - # jschema-to-python # jsonschema # referencing - # sarif-om aws-lambda-builders==1.50.0 \ --hash=sha256:40a613ecb19fbf0b64a47bae14bd252ea5da32ea71fde9808d596e2dbc011baf \ --hash=sha256:ad95ed55359c399872f5825582896500dfc1c5564eccf2a6ab8d0e9f6c1ae385 @@ -326,18 +324,10 @@ jmespath==1.0.1 \ # aws-sam-cli (setup.py) # boto3 # botocore -jschema-to-python==1.2.3 \ - --hash=sha256:76ff14fe5d304708ccad1284e4b11f96a658949a31ee7faed9e0995279549b91 \ - --hash=sha256:8a703ca7604d42d74b2815eecf99a33359a8dccbb80806cce386d5e2dd992b05 - # via cfn-lint jsonpatch==1.33 \ --hash=sha256:0ae28c0cd062bbd8b8ecc26d7d164fbbea9652a1a3693f3b956c1eae5145dade \ --hash=sha256:9fcd4009c41e6d12348b4a0ff2563ba56a2923a7dfee731d004e212e1ee5030c # via cfn-lint -jsonpickle==3.2.2 \ - --hash=sha256:87cd82d237fd72c5a34970e7222dddc0accc13fddf49af84111887ed9a9445aa \ - --hash=sha256:d425fd2b8afe9f5d7d57205153403fbf897782204437882a477e8eed60930f8c - # via jschema-to-python jsonpointer==3.0.0 \ --hash=sha256:13e088adc14fca8b6aa8177c044e12701e6ad4b28ff10e65f2267a90109c9942 \ --hash=sha256:2b2d729f2091522d61c3b31f82e11870f60b68f43fbc705cb76bf4b832af59ef @@ -348,15 +338,10 @@ jsonschema==4.22.0 \ # via # aws-sam-cli (setup.py) # aws-sam-translator - # cfn-lint jsonschema-specifications==2023.12.1 \ --hash=sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc \ --hash=sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c # via jsonschema -junit-xml==1.9 \ - --hash=sha256:de16a051990d4e25a3982b2dd9e89d671067548718866416faec14d9de56db9f \ - --hash=sha256:ec5ca1a55aefdd76d28fcc0b135251d156c7106fa979686a4b48d62b761b4732 - # via cfn-lint markdown-it-py==3.0.0 \ --hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \ --hash=sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb @@ -493,12 +478,6 @@ networkx==3.1 \ --hash=sha256:4f33f68cb2afcf86f28a45f43efc27a9386b535d567d2127f8f61d51dec58d36 \ --hash=sha256:de346335408f84de0eada6ff9fafafff9bcda11f0a0dfaa931133debb146ab61 # via cfn-lint -pbr==6.0.0 \ - --hash=sha256:4a7317d5e3b17a3dccb6a8cfe67dab65b20551404c52c8ed41279fa4f0cb4cda \ - --hash=sha256:d1377122a5a00e2f940ee482999518efe16d745d423a670c27773dfbc3c9a7d9 - # via - # jschema-to-python - # sarif-om pkgutil-resolve-name==1.3.10 \ --hash=sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174 \ --hash=sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e @@ -926,16 +905,10 @@ s3transfer==0.10.1 \ --hash=sha256:5683916b4c724f799e600f41dd9e10a9ff19871bf87623cc8f491cb4f5fa0a19 \ --hash=sha256:ceb252b11bcf87080fb7850a224fb6e05c8a776bab8f2b64b7f25b969464839d # via boto3 -sarif-om==1.0.4 \ - --hash=sha256:539ef47a662329b1c8502388ad92457425e95dc0aaaf995fe46f4984c4771911 \ - --hash=sha256:cd5f416b3083e00d402a92e449a7ff67af46f11241073eea0461802a3b5aef98 - # via cfn-lint six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.12.1 \ --hash=sha256:2877b03f998cd8c08f07cd0de5b767119cd3ef40d09f41c30d722f6686b0fb88 \ --hash=sha256:9b2cbc7f1a640289430e13d2a56f02f867a1da0190f2f99d8968c2f74da0e515 @@ -969,6 +942,7 @@ typing-extensions==4.12.2 \ # aws-sam-translator # boto3-stubs # botocore-stubs + # cfn-lint # mypy-boto3-apigateway # mypy-boto3-cloudformation # mypy-boto3-ecr From 157b3341f6057cf4d3439d2826f49ccefeda43d4 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 28 Jun 2024 09:03:01 +0000 Subject: [PATCH 04/17] Update reproducibles: update-reproducible-win-reqs --- requirements/reproducible-win.txt | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/requirements/reproducible-win.txt b/requirements/reproducible-win.txt index cc2e4712da..e0a34a46e2 100644 --- a/requirements/reproducible-win.txt +++ b/requirements/reproducible-win.txt @@ -16,10 +16,8 @@ attrs==23.2.0 \ --hash=sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30 \ --hash=sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1 # via - # jschema-to-python # jsonschema # referencing - # sarif-om aws-lambda-builders==1.50.0 \ --hash=sha256:40a613ecb19fbf0b64a47bae14bd252ea5da32ea71fde9808d596e2dbc011baf \ --hash=sha256:ad95ed55359c399872f5825582896500dfc1c5564eccf2a6ab8d0e9f6c1ae385 @@ -302,18 +300,10 @@ jmespath==1.0.1 \ # aws-sam-cli (setup.py) # boto3 # botocore -jschema-to-python==1.2.3 \ - --hash=sha256:76ff14fe5d304708ccad1284e4b11f96a658949a31ee7faed9e0995279549b91 \ - --hash=sha256:8a703ca7604d42d74b2815eecf99a33359a8dccbb80806cce386d5e2dd992b05 - # via cfn-lint jsonpatch==1.33 \ --hash=sha256:0ae28c0cd062bbd8b8ecc26d7d164fbbea9652a1a3693f3b956c1eae5145dade \ --hash=sha256:9fcd4009c41e6d12348b4a0ff2563ba56a2923a7dfee731d004e212e1ee5030c # via cfn-lint -jsonpickle==3.2.2 \ - --hash=sha256:87cd82d237fd72c5a34970e7222dddc0accc13fddf49af84111887ed9a9445aa \ - --hash=sha256:d425fd2b8afe9f5d7d57205153403fbf897782204437882a477e8eed60930f8c - # via jschema-to-python jsonpointer==3.0.0 \ --hash=sha256:13e088adc14fca8b6aa8177c044e12701e6ad4b28ff10e65f2267a90109c9942 \ --hash=sha256:2b2d729f2091522d61c3b31f82e11870f60b68f43fbc705cb76bf4b832af59ef @@ -324,15 +314,10 @@ jsonschema==4.22.0 \ # via # aws-sam-cli (setup.py) # aws-sam-translator - # cfn-lint jsonschema-specifications==2023.12.1 \ --hash=sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc \ --hash=sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c # via jsonschema -junit-xml==1.9 \ - --hash=sha256:de16a051990d4e25a3982b2dd9e89d671067548718866416faec14d9de56db9f \ - --hash=sha256:ec5ca1a55aefdd76d28fcc0b135251d156c7106fa979686a4b48d62b761b4732 - # via cfn-lint markdown-it-py==3.0.0 \ --hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \ --hash=sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb @@ -469,12 +454,6 @@ networkx==3.3 \ --hash=sha256:0c127d8b2f4865f59ae9cb8aafcd60b5c70f3241ebd66f7defad7c4ab90126c9 \ --hash=sha256:28575580c6ebdaf4505b22c6256a2b9de86b316dc63ba9e93abde3d78dfdbcf2 # via cfn-lint -pbr==6.0.0 \ - --hash=sha256:4a7317d5e3b17a3dccb6a8cfe67dab65b20551404c52c8ed41279fa4f0cb4cda \ - --hash=sha256:d1377122a5a00e2f940ee482999518efe16d745d423a670c27773dfbc3c9a7d9 - # via - # jschema-to-python - # sarif-om pycparser==2.22 \ --hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \ --hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc @@ -914,16 +893,10 @@ s3transfer==0.10.1 \ --hash=sha256:5683916b4c724f799e600f41dd9e10a9ff19871bf87623cc8f491cb4f5fa0a19 \ --hash=sha256:ceb252b11bcf87080fb7850a224fb6e05c8a776bab8f2b64b7f25b969464839d # via boto3 -sarif-om==1.0.4 \ - --hash=sha256:539ef47a662329b1c8502388ad92457425e95dc0aaaf995fe46f4984c4771911 \ - --hash=sha256:cd5f416b3083e00d402a92e449a7ff67af46f11241073eea0461802a3b5aef98 - # via cfn-lint six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.12.1 \ --hash=sha256:2877b03f998cd8c08f07cd0de5b767119cd3ef40d09f41c30d722f6686b0fb88 \ --hash=sha256:9b2cbc7f1a640289430e13d2a56f02f867a1da0190f2f99d8968c2f74da0e515 @@ -955,6 +928,7 @@ typing-extensions==4.12.2 \ # aws-sam-cli (setup.py) # aws-sam-translator # boto3-stubs + # cfn-lint # mypy-boto3-apigateway # mypy-boto3-cloudformation # mypy-boto3-ecr From dbb51d9abcd47152ecea9e5c912670c2f8d96ec4 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 22 Jul 2024 18:35:08 +0000 Subject: [PATCH 05/17] Update reproducibles: update-reproducible-linux-reqs --- requirements/reproducible-linux.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt index 78b27be4bc..e66562535a 100644 --- a/requirements/reproducible-linux.txt +++ b/requirements/reproducible-linux.txt @@ -886,9 +886,7 @@ s3transfer==0.10.2 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.13.0 \ --hash=sha256:3b6af8f4d008b9a1a6a4268b335b984b23835f26d1d60b0526ebc71d48a25f57 \ --hash=sha256:6b0b32a4673fb91bd3cac3b55406c8e01d53ae22780be467301cc452f6680c92 From 1d962c556e9b0143fe1d8e4cec5f58083addb095 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 22 Jul 2024 18:37:18 +0000 Subject: [PATCH 06/17] Update reproducibles: update-reproducible-mac-reqs --- requirements/reproducible-mac.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/requirements/reproducible-mac.txt b/requirements/reproducible-mac.txt index 4d5b44451f..ceb4deeeb8 100644 --- a/requirements/reproducible-mac.txt +++ b/requirements/reproducible-mac.txt @@ -918,9 +918,7 @@ s3transfer==0.10.2 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.13.0 \ --hash=sha256:3b6af8f4d008b9a1a6a4268b335b984b23835f26d1d60b0526ebc71d48a25f57 \ --hash=sha256:6b0b32a4673fb91bd3cac3b55406c8e01d53ae22780be467301cc452f6680c92 From 361d8e77c3ee15595a742af0aecb3f4ef659f5da Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 22 Jul 2024 18:39:31 +0000 Subject: [PATCH 07/17] Update reproducibles: update-reproducible-win-reqs --- requirements/reproducible-win.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/requirements/reproducible-win.txt b/requirements/reproducible-win.txt index 411c65fdad..93d73b120a 100644 --- a/requirements/reproducible-win.txt +++ b/requirements/reproducible-win.txt @@ -906,9 +906,7 @@ s3transfer==0.10.2 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.13.0 \ --hash=sha256:3b6af8f4d008b9a1a6a4268b335b984b23835f26d1d60b0526ebc71d48a25f57 \ --hash=sha256:6b0b32a4673fb91bd3cac3b55406c8e01d53ae22780be467301cc452f6680c92 From c4a47353ef934405e8021685964a2d131963b147 Mon Sep 17 00:00:00 2001 From: Daniel Mil Date: Tue, 30 Jul 2024 14:24:56 -0700 Subject: [PATCH 08/17] Update sam validate to use cnf-lint v1 --- Makefile | 2 +- mypy.ini | 3 + requirements/base.txt | 14 ++- samcli/commands/validate/validate.py | 91 +++++++++---------- .../validate/test_validate_command.py | 19 ++-- tests/unit/commands/validate/test_cli.py | 77 ++++++---------- 6 files changed, 100 insertions(+), 106 deletions(-) diff --git a/Makefile b/Makefile index dc2cc11778..5083326961 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ black-check: black --check setup.py samcli tests schema format: black - ruff samcli --fix + ruff check samcli --fix schema: python -m schema.make_schema diff --git a/mypy.ini b/mypy.ini index ba4e3fa9d1..68ba89944e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -49,6 +49,9 @@ ignore_missing_imports=True [mypy-watchdog,watchdog.*] ignore_missing_imports=True +[mypy-cfnlint,cfnlint.*] +ignore_missing_imports=True + # progressive add typechecks and these modules already complete the process, let's keep them clean [mypy-samcli.lib.iac.plugins_interfaces,samcli.commands.build,samcli.lib.build.*,samcli.commands.local.cli_common.invoke_context,samcli.commands.local.lib.local_lambda,samcli.lib.providers.*,samcli.lib.utils.git_repo.py,samcli.lib.cookiecutter.*,samcli.lib.pipeline.*,samcli.commands.pipeline.*] disallow_untyped_defs=True diff --git a/requirements/base.txt b/requirements/base.txt index 60db91ed1a..47ddf2b726 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -28,7 +28,19 @@ regex!=2021.10.8 tzlocal==5.2 #Adding cfn-lint dependency for SAM validate -cfn-lint~=1.4.2 +cfn-lint~=1.9.0 # Type checking boto3 objects boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.145 + +parameterized~=0.9.0 +botocore~=1.34.34 +pytest~=8.2.1 +Werkzeug~=2.3.4 +filelock~=3.15.4 +psutil~=6.0.0 +numpy~=1.25.1 +six~=1.16.0 +packaging~=23.1 +attrs~=23.1.0 +setuptools~=65.5.0 \ No newline at end of file diff --git a/samcli/commands/validate/validate.py b/samcli/commands/validate/validate.py index db0a130b24..1f283b56c7 100644 --- a/samcli/commands/validate/validate.py +++ b/samcli/commands/validate/validate.py @@ -2,7 +2,9 @@ CLI Command for Validating a SAM Template """ +import logging import os +from dataclasses import dataclass import boto3 import click @@ -26,6 +28,14 @@ Verify and Lint an AWS SAM Template being valid. """ +CNT_LINT_LOGGER_NAME = "cfnlint" + + +@dataclass +class SamTemplate: + serialized: str + deserialized: dict + @click.command( "validate", @@ -71,14 +81,14 @@ def do_cli(ctx, template, lint): from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException from samcli.lib.translate.sam_template_validator import SamTemplateValidator + sam_template = _read_sam_file(template) + if lint: - _lint(ctx, template) + _lint(ctx, sam_template.serialized, template) else: - sam_template = _read_sam_file(template) - iam_client = boto3.client("iam") validator = SamTemplateValidator( - sam_template, ManagedPolicyLoader(iam_client), profile=ctx.profile, region=ctx.region + sam_template.deserialized, ManagedPolicyLoader(iam_client), profile=ctx.profile, region=ctx.region ) try: @@ -103,7 +113,7 @@ def do_cli(ctx, template, lint): ) -def _read_sam_file(template): +def _read_sam_file(template) -> SamTemplate: """ Reads the file (json and yaml supported) provided and returns the dictionary representation of the file. @@ -120,12 +130,13 @@ def _read_sam_file(template): raise SamTemplateNotFoundException("Template at {} is not found".format(template)) with click.open_file(template, "r", encoding="utf-8") as sam_file: - sam_template = yaml_parse(sam_file.read()) + template_string = sam_file.read() + sam_template = yaml_parse(template_string) - return sam_template + return SamTemplate(serialized=template_string, deserialized=sam_template) -def _lint(ctx: Context, template: str) -> None: +def _lint(ctx: Context, template: str, template_path: str) -> None: """ Parses provided SAM template and maps errors from CloudFormation template back to SAM template. @@ -139,52 +150,32 @@ def _lint(ctx: Context, template: str) -> None: ctx Click context object template - Path to the template file - + Contents of sam template as a string + template_path + Path to the sam template """ - import logging - - import cfnlint.core # type: ignore + from cfnlint.api import ManualArgs, lint - from samcli.commands.exceptions import UserException - - cfn_lint_logger = logging.getLogger("cfnlint") + cfn_lint_logger = logging.getLogger(CNT_LINT_LOGGER_NAME) cfn_lint_logger.propagate = False + EventTracker.track_event("UsedFeature", "CFNLint") - try: - lint_args = [template] - if ctx.debug: - lint_args.append("--debug") - if ctx.region: - lint_args.append("--region") - lint_args.append(ctx.region) - - (args, filenames, formatter) = cfnlint.core.get_args_filenames(lint_args) - cfn_lint_logger.setLevel(logging.WARNING) - matches = list(cfnlint.core.get_matches(filenames, args)) - if not matches: - click.secho("{} is a valid SAM Template".format(template), fg="green") - return - - rules = cfnlint.core.get_used_rules() - matches_output = formatter.print_matches(matches, rules, filenames) - - if matches_output: - click.secho(matches_output) - - raise LinterRuleMatchedException( - "Linting failed. At least one linting rule was matched to the provided template." - ) + linter_config = {} + if ctx.region: + linter_config["region"] = ctx.region + if ctx.debug: + cfn_lint_logger.propagate = True + cfn_lint_logger.setLevel(logging.DEBUG) + + config = ManualArgs(**linter_config) + matches = lint(template, config=config) + + if not matches: + click.secho("{} is a valid SAM Template".format(template_path), fg="green") + return + + click.secho(matches) - except cfnlint.core.InvalidRegionException as e: - raise UserException( - "AWS Region was not found. Please configure your region through the --region option", - wrapped_from=e.__class__.__name__, - ) from e - except cfnlint.core.CfnLintExitException as lint_error: - raise UserException( - lint_error, - wrapped_from=lint_error.__class__.__name__, - ) from lint_error + raise LinterRuleMatchedException("Linting failed. At least one linting rule was matched to the provided template.") diff --git a/tests/integration/validate/test_validate_command.py b/tests/integration/validate/test_validate_command.py index b74ded8f56..e1b8ad0a23 100644 --- a/tests/integration/validate/test_validate_command.py +++ b/tests/integration/validate/test_validate_command.py @@ -9,7 +9,7 @@ from enum import Enum, auto from pathlib import Path from typing import List, Optional -from unittest import TestCase +from unittest import TestCase, skip from unittest.case import skipIf from parameterized import parameterized @@ -155,7 +155,11 @@ def test_lint_deprecated_runtimes(self, runtime): output = command_result.stdout.decode("utf-8") self.assertEqual(command_result.process.returncode, 1) - self.assertRegex(output, f"W2531 Runtime \\({runtime}\\)") + self.assertRegex( + output, + f"\\[\\[W2531: Check if EOL Lambda Function Runtimes are used] " + f"\\(Runtime \\'{runtime}'\\ was deprecated on.*", + ) def test_lint_supported_runtimes(self): template = { @@ -216,6 +220,7 @@ def test_lint_error_no_region(self): self.assertIn(error_message, output) + @skip("Skip test until https://github.com/aws-cloudformation/cfn-lint/pull/3545 is released") def test_lint_error_invalid_region(self): test_data_path = Path(__file__).resolve().parents[2] / "integration" / "testdata" / "validate" / "default_json" template_file = "template.json" @@ -223,7 +228,7 @@ def test_lint_error_invalid_region(self): command_result = run_command(self.command_list(lint=True, region="us-north-5", template_file=template_path)) output = command_result.stderr.decode("utf-8") - error_message = f"Error: AWS Region was not found. Please configure your region through the --region option" + error_message = f"ERROR - Regions ['us-north-5'] are unsupported. Supported regions are" self.assertIn(error_message, output) @@ -237,10 +242,10 @@ def test_lint_invalid_template(self): output = output.replace("\r", "") warning_message = ( - 'E0000 Duplicate found "HelloWorldFunction" (line 5)\n' - f'{os.path.join(test_data_path, "templateError.yaml")}:5:3\n\n' - 'E0000 Duplicate found "HelloWorldFunction" (line 12)\n' - f'{os.path.join(test_data_path, "templateError.yaml")}:12:3\n\n' + "[[E0000: Parsing error found when parsing the template] " + '(Duplicate found "HelloWorldFunction" (line 5)) matched 5, ' + "[E0000: Parsing error found when parsing the template] " + '(Duplicate found "HelloWorldFunction" (line 12)) matched 12]\n' ) self.assertIn(warning_message, output) diff --git a/tests/unit/commands/validate/test_cli.py b/tests/unit/commands/validate/test_cli.py index c19f5d0377..ea2bdc10fc 100644 --- a/tests/unit/commands/validate/test_cli.py +++ b/tests/unit/commands/validate/test_cli.py @@ -4,12 +4,10 @@ from botocore.exceptions import NoCredentialsError -from cfnlint.core import CfnLintExitException, InvalidRegionException # type: ignore - from samcli.commands.exceptions import UserException, LinterRuleMatchedException from samcli.commands.local.cli_common.user_exceptions import SamTemplateNotFoundException, InvalidSamTemplateException from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException -from samcli.commands.validate.validate import do_cli, _read_sam_file, _lint +from samcli.commands.validate.validate import do_cli, _read_sam_file, _lint, SamTemplate ctx_mock = namedtuple("ctx_mock", ["profile", "region"]) ctx_lint_mock = namedtuple("ctx_lint_mock", ["debug", "region"]) @@ -38,19 +36,19 @@ def test_file_parsed(self, path_exists_patch, click_patch, yaml_parse_patch): actual_template = _read_sam_file(template_path) - self.assertEqual(actual_template, {"a": "b"}) + self.assertEqual(actual_template.deserialized, {"a": "b"}) @patch("samcli.lib.translate.sam_template_validator.SamTemplateValidator") @patch("samcli.commands.validate.validate.click") @patch("samcli.commands.validate.validate._read_sam_file") @patch("boto3.client") - def test_template_fails_validation(self, patched_boto, read_sam_file_patch, click_patch, template_valiadator): + def test_template_fails_validation(self, patched_boto, read_sam_file_patch, click_patch, template_validator): template_path = "path_to_template" - read_sam_file_patch.return_value = {"a": "b"} + read_sam_file_patch.return_value = SamTemplate(deserialized={"a": "b"}, serialized="") get_translated_template_if_valid_mock = Mock() get_translated_template_if_valid_mock.get_translated_template_if_valid.side_effect = InvalidSamDocumentException - template_valiadator.return_value = get_translated_template_if_valid_mock + template_validator.return_value = get_translated_template_if_valid_mock with self.assertRaises(InvalidSamTemplateException): do_cli(ctx=ctx_mock(profile="profile", region="region"), template=template_path, lint=False) @@ -59,13 +57,13 @@ def test_template_fails_validation(self, patched_boto, read_sam_file_patch, clic @patch("samcli.commands.validate.validate.click") @patch("samcli.commands.validate.validate._read_sam_file") @patch("boto3.client") - def test_no_credentials_provided(self, patched_boto, read_sam_file_patch, click_patch, template_valiadator): + def test_no_credentials_provided(self, patched_boto, read_sam_file_patch, click_patch, template_validator): template_path = "path_to_template" - read_sam_file_patch.return_value = {"a": "b"} + read_sam_file_patch.return_value = SamTemplate(deserialized={"a": "b"}, serialized="") get_translated_template_if_valid_mock = Mock() get_translated_template_if_valid_mock.get_translated_template_if_valid.side_effect = NoCredentialsError - template_valiadator.return_value = get_translated_template_if_valid_mock + template_validator.return_value = get_translated_template_if_valid_mock with self.assertRaises(UserException): do_cli(ctx=ctx_mock(profile="profile", region="region"), template=template_path, lint=False) @@ -74,69 +72,54 @@ def test_no_credentials_provided(self, patched_boto, read_sam_file_patch, click_ @patch("samcli.commands.validate.validate.click") @patch("samcli.commands.validate.validate._read_sam_file") @patch("boto3.client") - def test_template_passes_validation(self, patched_boto, read_sam_file_patch, click_patch, template_valiadator): + def test_template_passes_validation(self, patched_boto, read_sam_file_patch, click_patch, template_validator): template_path = "path_to_template" - read_sam_file_patch.return_value = {"a": "b"} + read_sam_file_patch.return_value = SamTemplate(deserialized={"a": "b"}, serialized="") get_translated_template_if_valid_mock = Mock() get_translated_template_if_valid_mock.get_translated_template_if_valid.return_value = True - template_valiadator.return_value = get_translated_template_if_valid_mock + template_validator.return_value = get_translated_template_if_valid_mock do_cli(ctx=ctx_mock(profile="profile", region="region"), template=template_path, lint=False) + @patch("samcli.commands.validate.validate._read_sam_file") @patch("samcli.commands.validate.validate.click") @patch("samcli.commands.validate.validate._lint") - def test_lint_template_passes(self, click_patch, lint_patch): + def test_lint_template_passes(self, click_patch, lint_patch, read_sam_file_patch): template_path = "path_to_template" + read_sam_file_patch.return_value = SamTemplate(serialized="{}", deserialized={}) lint_patch.return_value = True do_cli(ctx=ctx_lint_mock(debug=False, region="region"), template=template_path, lint=True) - @patch("cfnlint.core.get_args_filenames") - @patch("cfnlint.core.get_matches") - @patch("samcli.commands.validate.validate.click") - def test_lint_invalid_region_argument_fails(self, click_patch, matches_patch, args_patch): - template_path = "path_to_template" - - args_patch.return_value = ("A", "B", "C") - - matches_patch.side_effect = InvalidRegionException - - with self.assertRaises(UserException): - _lint(ctx=ctx_lint_mock(debug=False, region="region"), template=template_path) - - @patch("cfnlint.core.get_args_filenames") - @patch("cfnlint.core.get_matches") - @patch("samcli.commands.validate.validate.click") - def test_lint_exception_fails(self, click_patch, matches_patch, args_patch): - template_path = "path_to_template" - - args_patch.return_value = ("A", "B", "C") - - matches_patch.side_effect = CfnLintExitException - - with self.assertRaises(UserException): - _lint(ctx=ctx_lint_mock(debug=False, region="region"), template=template_path) - @patch("samcli.commands.validate.validate.click") def test_lint_event_recorded(self, click_patch): template_path = "path_to_template" + template_contents = "{}" with patch("samcli.lib.telemetry.event.EventTracker.track_event") as track_patch: with self.assertRaises(LinterRuleMatchedException): - _lint(ctx=ctx_lint_mock(debug=False, region="region"), template=template_path) + _lint( + ctx=ctx_lint_mock(debug=False, region="region"), + template=template_contents, + template_path=template_path, + ) track_patch.assert_called_with("UsedFeature", "CFNLint") - @patch("cfnlint.core.get_args_filenames") - @patch("cfnlint.core.get_matches") + @patch("cfnlint.api.lint") @patch("samcli.commands.validate.validate.click") - def test_linter_raises_exception_if_matches_found(self, click_patch, matches_patch, args_patch): + def test_linter_raises_exception_if_matches_found(self, click_patch, lint_patch): template_path = "path_to_template" - args_patch.return_value = ("A", "B", Mock()) - matches_patch.return_value = ["Failed rule A", "Failed rule B"] + template_contents = "{}" + + lint_patch.return_value = ["Failed rule A", "Failed rule B"] + with self.assertRaises(LinterRuleMatchedException) as ex: - _lint(ctx=ctx_lint_mock(debug=False, region="region"), template=template_path) + _lint( + ctx=ctx_lint_mock(debug=False, region="region"), template=template_contents, template_path=template_path + ) + self.assertEqual( ex.exception.message, "Linting failed. At least one linting rule was matched to the provided template." ) From 84fc0b7be00d566c9445730ff75c4a88218ca9fa Mon Sep 17 00:00:00 2001 From: Daniel Mil Date: Tue, 30 Jul 2024 14:26:55 -0700 Subject: [PATCH 09/17] Remove unused imports --- requirements/base.txt | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 47ddf2b726..4a4ab58eaa 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -32,15 +32,3 @@ cfn-lint~=1.9.0 # Type checking boto3 objects boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.145 - -parameterized~=0.9.0 -botocore~=1.34.34 -pytest~=8.2.1 -Werkzeug~=2.3.4 -filelock~=3.15.4 -psutil~=6.0.0 -numpy~=1.25.1 -six~=1.16.0 -packaging~=23.1 -attrs~=23.1.0 -setuptools~=65.5.0 \ No newline at end of file From d4713005a0572c5b3a404e5691acd7ad7d47269d Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 30 Jul 2024 21:29:52 +0000 Subject: [PATCH 10/17] Update reproducibles: update-reproducible-linux-reqs --- requirements/reproducible-linux.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt index 220ae09e7c..aec1c42705 100644 --- a/requirements/reproducible-linux.txt +++ b/requirements/reproducible-linux.txt @@ -114,9 +114,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==1.4.2 \ - --hash=sha256:5f70df127c438117bb7f6da73e2310cebcf1901ba5ed001c6fbb0715c09efdde \ - --hash=sha256:7b884d0c79b7f3b40212df42299211e2c4f37e1598ac9f5d36c7e2142d23702c +cfn-lint==1.9.1 \ + --hash=sha256:751034d9aeedb303e1dbd0f7fc68b2a1b8d475335ae7695b33dab3cb12d28c48 \ + --hash=sha256:ed0a1c49fa5a01e8c345816be899078774cffb3c75200f15249c311410d9241a # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ @@ -890,9 +890,7 @@ s3transfer==0.10.2 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.13.1 \ --hash=sha256:9cebf7e04ff162015ce31c9c6c9144daa34a93bd082f54fd8f12deca4f47515f \ --hash=sha256:db36cdc64bf61b9b24578b6f7bab1ecdd2452cf008f34faa33776680c26d66f8 From 2ce20a8191f6aeb0d7e0773566f10dc4e6225f02 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 30 Jul 2024 21:31:58 +0000 Subject: [PATCH 11/17] Update reproducibles: update-reproducible-mac-reqs --- requirements/reproducible-mac.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/requirements/reproducible-mac.txt b/requirements/reproducible-mac.txt index 0fc7b4370c..c33921e4ca 100644 --- a/requirements/reproducible-mac.txt +++ b/requirements/reproducible-mac.txt @@ -132,9 +132,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==1.4.2 \ - --hash=sha256:5f70df127c438117bb7f6da73e2310cebcf1901ba5ed001c6fbb0715c09efdde \ - --hash=sha256:7b884d0c79b7f3b40212df42299211e2c4f37e1598ac9f5d36c7e2142d23702c +cfn-lint==1.9.1 \ + --hash=sha256:751034d9aeedb303e1dbd0f7fc68b2a1b8d475335ae7695b33dab3cb12d28c48 \ + --hash=sha256:ed0a1c49fa5a01e8c345816be899078774cffb3c75200f15249c311410d9241a # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ @@ -922,9 +922,7 @@ s3transfer==0.10.2 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.13.1 \ --hash=sha256:9cebf7e04ff162015ce31c9c6c9144daa34a93bd082f54fd8f12deca4f47515f \ --hash=sha256:db36cdc64bf61b9b24578b6f7bab1ecdd2452cf008f34faa33776680c26d66f8 From a13e298fecf2f72d7f106c8e7def11879352fd0b Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 30 Jul 2024 21:34:55 +0000 Subject: [PATCH 12/17] Update reproducibles: update-reproducible-win-reqs --- requirements/reproducible-win.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/requirements/reproducible-win.txt b/requirements/reproducible-win.txt index d57fa70085..f0faef8624 100644 --- a/requirements/reproducible-win.txt +++ b/requirements/reproducible-win.txt @@ -114,9 +114,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==1.4.2 \ - --hash=sha256:5f70df127c438117bb7f6da73e2310cebcf1901ba5ed001c6fbb0715c09efdde \ - --hash=sha256:7b884d0c79b7f3b40212df42299211e2c4f37e1598ac9f5d36c7e2142d23702c +cfn-lint==1.9.1 \ + --hash=sha256:751034d9aeedb303e1dbd0f7fc68b2a1b8d475335ae7695b33dab3cb12d28c48 \ + --hash=sha256:ed0a1c49fa5a01e8c345816be899078774cffb3c75200f15249c311410d9241a # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ @@ -910,9 +910,7 @@ s3transfer==0.10.2 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # junit-xml - # python-dateutil + # via python-dateutil sympy==1.13.1 \ --hash=sha256:9cebf7e04ff162015ce31c9c6c9144daa34a93bd082f54fd8f12deca4f47515f \ --hash=sha256:db36cdc64bf61b9b24578b6f7bab1ecdd2452cf008f34faa33776680c26d66f8 From cc28ef525472690d09d1040fbe178bc5a9cad2f3 Mon Sep 17 00:00:00 2001 From: Daniel Mil Date: Wed, 31 Jul 2024 16:26:51 -0700 Subject: [PATCH 13/17] Catch InvalidRegionException --- requirements/base.txt | 2 +- samcli/commands/validate/validate.py | 14 +++++++++++--- .../integration/validate/test_validate_command.py | 6 ++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 5324bd8a6b..032bf6ea8b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -28,7 +28,7 @@ regex!=2021.10.8 tzlocal==5.2 #Adding cfn-lint dependency for SAM validate -cfn-lint~=1.9.0 +cfn-lint~=1.9.2 # Type checking boto3 objects boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.149 diff --git a/samcli/commands/validate/validate.py b/samcli/commands/validate/validate.py index 1f283b56c7..cf317b8bfe 100644 --- a/samcli/commands/validate/validate.py +++ b/samcli/commands/validate/validate.py @@ -18,7 +18,7 @@ from samcli.commands._utils.cdk_support_decorators import unsupported_command_cdk from samcli.commands._utils.command_exception_handler import command_exception_handler from samcli.commands._utils.options import template_option_without_build -from samcli.commands.exceptions import LinterRuleMatchedException +from samcli.commands.exceptions import LinterRuleMatchedException, UserException from samcli.commands.validate.core.command import ValidateCommand from samcli.lib.telemetry.event import EventTracker from samcli.lib.telemetry.metric import track_command @@ -156,6 +156,7 @@ def _lint(ctx: Context, template: str, template_path: str) -> None: """ from cfnlint.api import ManualArgs, lint + from cfnlint.runner import InvalidRegionException cfn_lint_logger = logging.getLogger(CNT_LINT_LOGGER_NAME) cfn_lint_logger.propagate = False @@ -164,13 +165,20 @@ def _lint(ctx: Context, template: str, template_path: str) -> None: linter_config = {} if ctx.region: - linter_config["region"] = ctx.region + linter_config["regions"] = [ctx.region] if ctx.debug: cfn_lint_logger.propagate = True cfn_lint_logger.setLevel(logging.DEBUG) config = ManualArgs(**linter_config) - matches = lint(template, config=config) + + try: + matches = lint(template, config=config) + except InvalidRegionException as ex: + raise UserException( + f"AWS Region was not found. Please configure your region through the --region option.\n{ex}", + wrapped_from=ex.__class__.__name__, + ) from ex if not matches: click.secho("{} is a valid SAM Template".format(template_path), fg="green") diff --git a/tests/integration/validate/test_validate_command.py b/tests/integration/validate/test_validate_command.py index e1b8ad0a23..50624a2965 100644 --- a/tests/integration/validate/test_validate_command.py +++ b/tests/integration/validate/test_validate_command.py @@ -220,7 +220,6 @@ def test_lint_error_no_region(self): self.assertIn(error_message, output) - @skip("Skip test until https://github.com/aws-cloudformation/cfn-lint/pull/3545 is released") def test_lint_error_invalid_region(self): test_data_path = Path(__file__).resolve().parents[2] / "integration" / "testdata" / "validate" / "default_json" template_file = "template.json" @@ -228,7 +227,10 @@ def test_lint_error_invalid_region(self): command_result = run_command(self.command_list(lint=True, region="us-north-5", template_file=template_path)) output = command_result.stderr.decode("utf-8") - error_message = f"ERROR - Regions ['us-north-5'] are unsupported. Supported regions are" + error_message = ( + f"Error: AWS Region was not found. Please configure your region through the --region option.\n" + f"Regions ['us-north-5'] are unsupported. Supported regions are" + ) self.assertIn(error_message, output) From 8782e5b86ef6a3fdeeabf4c1726f11d209c26d2e Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 31 Jul 2024 23:28:34 +0000 Subject: [PATCH 14/17] Update reproducibles: update-reproducible-linux-reqs --- requirements/reproducible-linux.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt index aec1c42705..074e487a72 100644 --- a/requirements/reproducible-linux.txt +++ b/requirements/reproducible-linux.txt @@ -114,9 +114,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==1.9.1 \ - --hash=sha256:751034d9aeedb303e1dbd0f7fc68b2a1b8d475335ae7695b33dab3cb12d28c48 \ - --hash=sha256:ed0a1c49fa5a01e8c345816be899078774cffb3c75200f15249c311410d9241a +cfn-lint==1.9.2 \ + --hash=sha256:6920bd71875e76b36f244bd2ac70975a843e4e859a390625c60d16eaa0e3f3f3 \ + --hash=sha256:cc540882762e1545c37a08b23849f13f2034acfe5ae46079a8815c740bbdcfa2 # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ From 94b5ceab079e93c9d00ce7f70778d2c95a5abd26 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 31 Jul 2024 23:30:18 +0000 Subject: [PATCH 15/17] Update reproducibles: update-reproducible-mac-reqs --- requirements/reproducible-mac.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/reproducible-mac.txt b/requirements/reproducible-mac.txt index c33921e4ca..9cc6f94714 100644 --- a/requirements/reproducible-mac.txt +++ b/requirements/reproducible-mac.txt @@ -132,9 +132,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==1.9.1 \ - --hash=sha256:751034d9aeedb303e1dbd0f7fc68b2a1b8d475335ae7695b33dab3cb12d28c48 \ - --hash=sha256:ed0a1c49fa5a01e8c345816be899078774cffb3c75200f15249c311410d9241a +cfn-lint==1.9.2 \ + --hash=sha256:6920bd71875e76b36f244bd2ac70975a843e4e859a390625c60d16eaa0e3f3f3 \ + --hash=sha256:cc540882762e1545c37a08b23849f13f2034acfe5ae46079a8815c740bbdcfa2 # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ From 903f30d574fca77fadf65a17c4fb3a8383e6c540 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 31 Jul 2024 23:32:28 +0000 Subject: [PATCH 16/17] Update reproducibles: update-reproducible-win-reqs --- requirements/reproducible-win.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/reproducible-win.txt b/requirements/reproducible-win.txt index f0faef8624..3ef106398a 100644 --- a/requirements/reproducible-win.txt +++ b/requirements/reproducible-win.txt @@ -114,9 +114,9 @@ cffi==1.16.0 \ --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 # via cryptography -cfn-lint==1.9.1 \ - --hash=sha256:751034d9aeedb303e1dbd0f7fc68b2a1b8d475335ae7695b33dab3cb12d28c48 \ - --hash=sha256:ed0a1c49fa5a01e8c345816be899078774cffb3c75200f15249c311410d9241a +cfn-lint==1.9.2 \ + --hash=sha256:6920bd71875e76b36f244bd2ac70975a843e4e859a390625c60d16eaa0e3f3f3 \ + --hash=sha256:cc540882762e1545c37a08b23849f13f2034acfe5ae46079a8815c740bbdcfa2 # via aws-sam-cli (setup.py) chardet==5.2.0 \ --hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \ From 860409ee3a7da28b59fe0ec035434a286b93e7c2 Mon Sep 17 00:00:00 2001 From: Daniel Mil Date: Wed, 31 Jul 2024 16:34:41 -0700 Subject: [PATCH 17/17] Fix unit test --- tests/unit/commands/validate/test_cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/commands/validate/test_cli.py b/tests/unit/commands/validate/test_cli.py index ea2bdc10fc..f77a4711e9 100644 --- a/tests/unit/commands/validate/test_cli.py +++ b/tests/unit/commands/validate/test_cli.py @@ -93,8 +93,9 @@ def test_lint_template_passes(self, click_patch, lint_patch, read_sam_file_patch do_cli(ctx=ctx_lint_mock(debug=False, region="region"), template=template_path, lint=True) + @patch("cfnlint.api.lint") @patch("samcli.commands.validate.validate.click") - def test_lint_event_recorded(self, click_patch): + def test_lint_event_recorded(self, click_patch, lint_patch): template_path = "path_to_template" template_contents = "{}"