Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws_lambda_builders/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def main(): # pylint: disable=too-many-statements
architecture=params.get("architecture", X86_64),
is_building_layer=params.get("is_building_layer", False),
experimental_flags=params.get("experimental_flags", []),
build_in_source=params.get("build_in_source", None),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default is None because some workflows are built in source by default and some are not. Planning to leave it up to each workflow to handle defaults.

)

# Return a success response
Expand Down
7 changes: 7 additions & 0 deletions aws_lambda_builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def build(
architecture=X86_64,
is_building_layer=False,
experimental_flags=None,
build_in_source=None,
):
# pylint: disable-msg=too-many-locals
"""
Expand Down Expand Up @@ -138,6 +139,11 @@ def build(
:type experimental_flags: list
:param experimental_flags:
List of strings, which will indicate enabled experimental flags for the current build session

:type build_in_source: Optional[bool]
:param build_in_source:
Optional, will execute the build operation in the source directory if True.

"""

if not os.path.exists(scratch_dir):
Expand All @@ -159,6 +165,7 @@ def build(
architecture=architecture,
is_building_layer=is_building_layer,
experimental_flags=experimental_flags,
build_in_source=build_in_source,
)

return workflow.run()
Expand Down
5 changes: 5 additions & 0 deletions aws_lambda_builders/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def __init__(
architecture=X86_64,
is_building_layer=False,
experimental_flags=None,
build_in_source=None,
):
# pylint: disable-msg=too-many-locals
"""
Expand Down Expand Up @@ -208,6 +209,9 @@ def __init__(

experimental_flags: list, optional
List of strings, which will indicate enabled experimental flags for the current build session

build_in_source: Optional[bool]
Optional, will execute the build operation in the source directory if True.
"""

self.source_dir = source_dir
Expand All @@ -225,6 +229,7 @@ def __init__(
self.architecture = architecture
self.is_building_layer = is_building_layer
self.experimental_flags = experimental_flags if experimental_flags else []
self.build_in_source = build_in_source

# Actions are registered by the subclasses as they seem fit
self.actions = []
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def test_run_hello_workflow_with_backcompat(self, flavor, protocol_version):
"architecture": "x86_64",
"is_building_layer": False,
"experimental_flags": ["experimental"],
"build_in_source": False,
},
}

Expand Down Expand Up @@ -149,6 +150,7 @@ def test_run_hello_workflow_incompatible(self, flavor):
"combine_dependencies": False,
"is_building_layer": False,
"experimental_flags": ["experimental"],
"build_in_source": False,
},
}
)
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def setUp(self):
[True, False], # combine_dependencies
[True, False], # is_building_layer
[None, [], ["a", "b"]], # experimental flags
[True, False], # build_in_source
)
)
@patch("aws_lambda_builders.builder.os")
Expand All @@ -139,6 +140,7 @@ def test_with_mocks(
combine_dependencies,
is_building_layer,
experimental_flags,
build_in_source,
get_workflow_mock,
os_mock,
):
Expand Down Expand Up @@ -167,6 +169,7 @@ def test_with_mocks(
combine_dependencies=combine_dependencies,
is_building_layer=is_building_layer,
experimental_flags=experimental_flags,
build_in_source=build_in_source,
)

workflow_cls.assert_called_with(
Expand All @@ -185,6 +188,7 @@ def test_with_mocks(
combine_dependencies=combine_dependencies,
is_building_layer=is_building_layer,
experimental_flags=experimental_flags,
build_in_source=build_in_source,
)
workflow_instance.run.assert_called_once()
os_mock.path.exists.assert_called_once_with("scratch_dir")
Expand Down