Repository navigation
Conversation
Adds Finch container runtime support as an alternative to Docker for AWS SAM CLI local development and testing. Finch provides a lightweight, open-source container runtime that offers better performance and resource efficiency compared to Docker Desktop, especially inenterprise environments. This change enables SAM CLI users to leverage Finch for local Lambda function development, testing, and debugging without requiring Docker Desktop. How does it address the issue? - Container Runtime Abstraction: Implements a unified container client system that supports both Docker and Finch through a factory pattern - Automatic Detection: Adds enterprise detectionmechanism to automatically identify and configure Finch installations - API Compatibility: Ensures all existing SAM CLI container operations work seamlessly with Finch - Test Infrastructure: Updates integration and unit tests to support both container runtimes - Error Handling: Provides Finch-specific error messages and fallback mechanisms - Performance Optimizations: Implements file locking and build caching to prevent race conditions What side effects does this change have? - Users can now use Finch as a Docker alternative, potentially improving performance and reducing resource usage - Existing Docker workflows remain unchanged; Finch support is additive - New metrics track container runtime preferences for usage analytics
Issue with AppVeyor Windows instances that take longer to finishing building.
valerena
left a comment
There was a problem hiding this comment.
Just some small comments that can be taken as a follow-up. LGTM.
| def tearDown(self): | ||
| super(TestPackageImage, self).tearDown() | ||
|
|
||
| def _assert_finch_docker_success(self, stderr_text, error_message): |
There was a problem hiding this comment.
Probably we can change later, but isn't this just "Finch" success?
| self.assertEqual(result, {"ENV_VAR1": "2", "ENV_VAR2": "3"}) | ||
|
|
||
|
|
||
| class TestArchitectureDetection(TestCase): |
There was a problem hiding this comment.
To change as a follow-up.. all of these should be one test only, with parameterized
|
|
||
| # Verify telemetry was called | ||
| mock_telemetry.assert_called_once() | ||
| telemetry_instance = mock_telemetry.return_value |
There was a problem hiding this comment.
I feel like we should be setting the return_value instead of getting it.. But if it works, it works. (I see we do that a lot in other tests too, so I guess it works)
| self.assertEqual(result, "docker-default") | ||
| mock_env.assert_called_once() | ||
|
|
||
| @patch.dict("os.environ", {}, clear=True) |
There was a problem hiding this comment.
This can also be parameterized instead of individual tests
| self.assertFalse(self.client.is_available()) | ||
| mock_log.debug.assert_called_once() | ||
|
|
||
| def test_is_finch_when_runtime_is_finch(self): |
There was a problem hiding this comment.
Tests don't seem to relevant, but they can also be parameterized in pairs
| self.session_id = "test-session-id" | ||
|
|
||
|
|
||
| class TestContainerEngineMetrics(TestCase): |
There was a problem hiding this comment.
Most tests in this class should definitely be parameterized, or adding more things to the setUp, or with a utility function, so you don't have to put the exact same code multiple times in all tests.
Which issue(s) does this change fix?
Adds Finch container runtime support for AWS SAM CLI local development and testing.
Why is this change necessary?
This change enables SAM CLI users to leverage Finch as container engine for local Lambda function development, testing, and debugging without manual configuration of socket path from users. This PR also implement separate client wrappers for Finch and Docker client.
How does it address the issue?
What side effects does this change have?
reducing resource usage
Mandatory Checklist
PRs will only be reviewed after checklist is complete
• [ ] Add input/output [type hints](https://
docs.python.org/3/library/typing.html) to new
functions/methods
• [ ] Write design document if needed ([Do I need to
write a design document?](https://github.com/aws/
aws-sam-cli/blob/develop/DEVELOPMENT_GUIDE.md#design
-document))
• [x] Write/update unit tests
• [x] Write/update integration tests
• [ ] Write/update functional tests if needed
• [x] make pr passes
• [ ] make update-reproducible-reqs if dependencies
were changed
• [x] Write documentation
By submitting this pull request, I confirm that my
contribution is made under the terms of the Apache 2.0 license.