Skip to content

Commit 89a29b8

Browse files
authored
chore: update log (#7371)
* chore: update log * fix log * black reformat * update test
1 parent 0d3d53b commit 89a29b8

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

samcli/lib/build/app_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def _build_lambda_image(self, function_name: str, metadata: Dict, architecture:
412412
docker_tag = "-".join([docker_tag, docker_build_args["SAM_BUILD_MODE"]])
413413

414414
if isinstance(docker_build_args, dict):
415-
LOG.info("Setting DockerBuildArgs: %s for %s function", docker_build_args, function_name)
415+
LOG.info("Setting DockerBuildArgs for %s function", function_name)
416416

417417
build_args = {
418418
"path": str(docker_context_dir),

samcli/lib/build/build_graph.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,14 @@ def _validate_functions(self) -> None:
648648
raise InvalidBuildGraphException("Build definition doesn't have any function definition to build")
649649

650650
def __str__(self) -> str:
651+
metadata = self.metadata.copy()
652+
if "DockerBuildArgs" in metadata:
653+
del metadata["DockerBuildArgs"]
654+
651655
return (
652656
"BuildDefinition("
653657
f"{self.runtime}, {self.codeuri}, {self.packagetype}, {self.source_hash}, "
654-
f"{self.uuid}, {self.metadata}, {self.env_vars}, {self.architecture}, "
658+
f"{self.uuid}, {metadata}, {self.env_vars}, {self.architecture}, "
655659
f"{[f.functionname for f in self.functions]})"
656660
)
657661

samcli/lib/build/build_strategy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,9 @@ def build_single_function_definition(self, build_definition: FunctionBuildDefini
146146
"""
147147
function_build_results = {}
148148
LOG.info(
149-
"Building codeuri: %s runtime: %s metadata: %s architecture: %s functions: %s",
149+
"Building codeuri: %s runtime: %s architecture: %s functions: %s",
150150
build_definition.codeuri,
151151
build_definition.runtime,
152-
build_definition.metadata,
153152
build_definition.architecture,
154153
build_definition.get_resource_full_paths(),
155154
)

samcli/lib/providers/provider.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ def architecture(self) -> str:
168168
)
169169
return str(arch_list[0])
170170

171+
def __str__(self) -> str:
172+
metadata = None if not self.metadata else self.metadata.copy()
173+
if metadata and "DockerBuildArgs" in metadata:
174+
del metadata["DockerBuildArgs"]
175+
176+
copy = self._asdict()
177+
if metadata:
178+
copy["metadata"] = metadata
179+
return f"Function({copy})"
180+
171181

172182
class ResourcesToBuildCollector:
173183
def __init__(self) -> None:

tests/integration/buildcmd/build_integ_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ def _verify_process_code_and_output(self, command_result):
921921
# check HelloWorld and HelloMars functions are built in the same build
922922
self.assertRegex(
923923
command_result.stderr.decode("utf-8"),
924-
"Building codeuri: .* runtime: .* metadata: .* functions: " "HelloWorldFunction, HelloMarsFunction",
924+
"Building codeuri: .* runtime: .* functions: " "HelloWorldFunction, HelloMarsFunction",
925925
)
926926

927927

@@ -959,7 +959,7 @@ def _verify_process_code_and_output(self, command_result, function_full_paths):
959959
for function_full_path in function_full_paths:
960960
self.assertRegex(
961961
command_result.stderr.decode("utf-8"),
962-
f"Building codeuri: .* runtime: .* metadata: .* functions: .*{function_full_path}.*",
962+
f"Building codeuri: .* runtime: .* functions: .*{function_full_path}.*",
963963
)
964964

965965
def _verify_invoke_built_functions(self, template_path, overrides, function_and_expected):
@@ -1004,7 +1004,7 @@ def _verify_process_code_and_output(self, command_result, function_full_paths, l
10041004
for function_full_path in function_full_paths:
10051005
self.assertRegex(
10061006
command_result.stderr.decode("utf-8"),
1007-
f"Building codeuri: .* runtime: .* metadata: .* functions:.*{function_full_path}.*",
1007+
f"Building codeuri: .* runtime: .* functions:.*{function_full_path}.*",
10081008
)
10091009
self.assertIn(
10101010
f"Building layer '{layer_full_path}'",

0 commit comments

Comments
 (0)