Skip to content

Commit 91956e9

Browse files
authoredNov 14, 2024
Merge from aws/aws-sam-cli/develop
2 parents a1607b3 + e204a3d commit 91956e9

File tree

9 files changed

+46
-22
lines changed

9 files changed

+46
-22
lines changed
 

‎requirements/base.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ regex!=2021.10.8
3131
tzlocal==5.2
3232

3333
#Adding cfn-lint dependency for SAM validate
34-
cfn-lint~=1.18.4
34+
cfn-lint~=1.19.0
3535

3636
# Type checking boto3 objects
3737
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.35.56

‎requirements/reproducible-linux.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ cffi==1.17.1 \
129129
--hash=sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87 \
130130
--hash=sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b
131131
# via cryptography
132-
cfn-lint==1.18.4 \
133-
--hash=sha256:73dadc33d6a91c69651cb08fe919138ab4e2f6cf1be1e361f7c6dcbccd1527ba \
134-
--hash=sha256:76741e76fa26f31bfacc3eb465eddd93ad535838d84fbc6dd092817d8e22d57f
132+
cfn-lint==1.19.0 \
133+
--hash=sha256:63835e083f7831e54c512bce4808754df221b5895aed9a114c71879d1cc4ebff \
134+
--hash=sha256:9c43a6b866915df6d2ac5584000ef05e53c67624809808c2cebd3dc6154b7c14
135135
# via aws-sam-cli (setup.py)
136136
chardet==5.2.0 \
137137
--hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \

‎requirements/reproducible-mac.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ cffi==1.17.1 \
147147
--hash=sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87 \
148148
--hash=sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b
149149
# via cryptography
150-
cfn-lint==1.18.4 \
151-
--hash=sha256:73dadc33d6a91c69651cb08fe919138ab4e2f6cf1be1e361f7c6dcbccd1527ba \
152-
--hash=sha256:76741e76fa26f31bfacc3eb465eddd93ad535838d84fbc6dd092817d8e22d57f
150+
cfn-lint==1.19.0 \
151+
--hash=sha256:63835e083f7831e54c512bce4808754df221b5895aed9a114c71879d1cc4ebff \
152+
--hash=sha256:9c43a6b866915df6d2ac5584000ef05e53c67624809808c2cebd3dc6154b7c14
153153
# via aws-sam-cli (setup.py)
154154
chardet==5.2.0 \
155155
--hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \

‎requirements/reproducible-win.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ cffi==1.17.1 \
129129
--hash=sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87 \
130130
--hash=sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b
131131
# via cryptography
132-
cfn-lint==1.18.4 \
133-
--hash=sha256:73dadc33d6a91c69651cb08fe919138ab4e2f6cf1be1e361f7c6dcbccd1527ba \
134-
--hash=sha256:76741e76fa26f31bfacc3eb465eddd93ad535838d84fbc6dd092817d8e22d57f
132+
cfn-lint==1.19.0 \
133+
--hash=sha256:63835e083f7831e54c512bce4808754df221b5895aed9a114c71879d1cc4ebff \
134+
--hash=sha256:9c43a6b866915df6d2ac5584000ef05e53c67624809808c2cebd3dc6154b7c14
135135
# via aws-sam-cli (setup.py)
136136
chardet==5.2.0 \
137137
--hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \

‎samcli/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
SAM CLI version
33
"""
44

5-
__version__ = "1.128.0"
5+
__version__ = "1.129.0"

‎samcli/commands/init/init_templates.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,21 @@ def _get_manifest(self):
283283
"""
284284
try:
285285
response = requests.get(MANIFEST_URL, timeout=10)
286-
body = response.text
287-
# if the commit is not exist then MANIFEST_URL will be invalid, fall back to use manifest in latest commit
288-
if response.status_code == Status.NOT_FOUND.value:
289-
LOG.warning(
290-
"Request to MANIFEST_URL: %s failed, the commit hash in this url maybe invalid, "
291-
"Using manifest.json in the latest commit instead.",
292-
MANIFEST_URL,
293-
)
286+
if not response.ok:
287+
# if the commit is not exist then MANIFEST_URL will be invalid,
288+
# fall back to use manifest in latest commit
289+
if response.status_code == Status.NOT_FOUND.value:
290+
LOG.warning(
291+
"Request to MANIFEST_URL: %s failed, the commit hash in this url maybe invalid, "
292+
"Using manifest.json in the latest commit instead.",
293+
MANIFEST_URL,
294+
)
295+
else:
296+
LOG.debug(
297+
"Request to MANIFEST_URL: %s failed, with %s status code", MANIFEST_URL, response.status_code
298+
)
294299
raise ManifestNotFoundException()
295-
300+
body = response.text
296301
except (requests.Timeout, requests.ConnectionError, ManifestNotFoundException):
297302
LOG.debug("Request to get Manifest failed, attempting to clone the repository")
298303
self.clone_templates_repo()

‎samcli/runtime_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"app_template_repo_commit": "994ec01c08fa415ed20258d72cb7f750b8b8211d"
2+
"app_template_repo_commit": "a22d509a91e0ceca3eb596ab13d5ebe76ff0a894"
33
}

‎tests/integration/validate/test_validate_command.py

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def test_lint_supported_runtimes(self):
182182
"python3.10",
183183
"python3.11",
184184
"python3.12",
185+
"python3.13",
185186
"ruby3.2",
186187
"ruby3.3",
187188
]

‎tests/unit/commands/init/test_cli.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pathlib import Path
1010
from typing import Dict, Any
1111
from unittest import TestCase
12-
from unittest.mock import patch, ANY
12+
from unittest.mock import patch, ANY, Mock
1313

1414
import botocore.exceptions
1515
import click
@@ -2204,6 +2204,24 @@ def test_must_return_runtime_from_base_image_name(self):
22042204
runtime = get_runtime(IMAGE, base_image)
22052205
self.assertEqual(runtime, expected_runtime[index])
22062206

2207+
@patch("samcli.commands.init.init_templates.requests")
2208+
@patch.object(InitTemplates, "__init__", MockInitTemplates.__init__)
2209+
def test_must_fallback_for_non_ok_http_response(self, requests_mock):
2210+
requests_mock.get.return_value = Mock(ok=False)
2211+
requests_mock.Timeout = requests.Timeout
2212+
requests_mock.ConnectionError = requests.ConnectionError
2213+
2214+
template = InitTemplates()
2215+
with mock.patch.object(
2216+
template, "clone_templates_repo", wraps=template.clone_templates_repo
2217+
) as mocked_clone_templates_repo:
2218+
with mock.patch.object(
2219+
template, "get_manifest_path", wraps=template.get_manifest_path
2220+
) as mocked_get_manifest_path:
2221+
template.get_preprocessed_manifest()
2222+
mocked_clone_templates_repo.assert_called_once()
2223+
mocked_get_manifest_path.assert_called_once()
2224+
22072225
@patch("samcli.commands.init.init_templates.InitTemplates._get_manifest")
22082226
@patch.object(InitTemplates, "__init__", MockInitTemplates.__init__)
22092227
def test_must_process_manifest(self, _get_manifest_mock):

0 commit comments

Comments
 (0)
Failed to load comments.