Skip to content

[Nexthop] Add Docker support for FBOSS Image Builder#799

Closed
raghav-nexthop wants to merge 3 commits intofacebook:mainfrom
nexthop-ai:raghav.distro-cli-docker-part3
Closed

[Nexthop] Add Docker support for FBOSS Image Builder#799
raghav-nexthop wants to merge 3 commits intofacebook:mainfrom
nexthop-ai:raghav.distro-cli-docker-part3

Conversation

@raghav-nexthop
Copy link
Contributor

@raghav-nexthop raghav-nexthop commented Jan 9, 2026

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Add Docker container and image management capabilities.

  • Implement Docker container wrapper with exec and run operations
  • Implement Docker image wrapper with build, pull, and tag operations
  • Add comprehensive unit tests for container and image functionality
  • Include test helper utilities for unit test infrastructure
  • Add build_docker.sh script for Docker build automation

Test Plan

Added unit tests for docker infrastructure and image building.

cd /work/raghav/private-fboss/fboss-image && PYTHONPATH=/work/raghav/private-fboss/fboss-image:$PYTHONPATH python3 -m pytest distro_cli/tests/ -v
=================================================================== test session starts ====================================================================
platform linux -- Python 3.10.12, pytest-8.4.1, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /work/raghav/private-fboss/fboss-image
collected 37 items                                                                                                                                         

distro_cli/tests/build_test.py::TestBuildCommand::test_build_all_stub PASSED                                                                         [  2%]
distro_cli/tests/build_test.py::TestBuildCommand::test_build_command_exists PASSED                                                                   [  5%]
distro_cli/tests/build_test.py::TestBuildCommand::test_build_specific_components_stub PASSED                                                         [  8%]
distro_cli/tests/cli_test.py::ValidatePathTest::test_validate_path_converts_to_path PASSED                                                           [ 10%]
distro_cli/tests/cli_test.py::ValidatePathTest::test_validate_path_existing_file PASSED                                                              [ 13%]
distro_cli/tests/cli_test.py::ValidatePathTest::test_validate_path_nonexistent_file_raises PASSED                                                    [ 16%]
distro_cli/tests/cli_test.py::ValidatePathTest::test_validate_path_nonexistent_file_without_check PASSED                                             [ 18%]
distro_cli/tests/cli_test.py::CommandGroupTest::test_add_command_to_group PASSED                                                                     [ 21%]
distro_cli/tests/cli_test.py::CommandGroupTest::test_add_command_with_arguments PASSED                                                               [ 24%]
distro_cli/tests/cli_test.py::CommandGroupTest::test_command_group_creation PASSED                                                                   [ 27%]
distro_cli/tests/cli_test.py::CommandGroupTest::test_command_group_with_arguments PASSED                                                             [ 29%]
distro_cli/tests/cli_test.py::CLITest::test_add_command PASSED                                                                                       [ 32%]
distro_cli/tests/cli_test.py::CLITest::test_add_command_group PASSED                                                                                 [ 35%]
distro_cli/tests/cli_test.py::CLITest::test_add_command_with_arguments PASSED                                                                        [ 37%]
distro_cli/tests/cli_test.py::CLITest::test_cli_creation PASSED                                                                                      [ 40%]
distro_cli/tests/cli_test.py::CLITest::test_cli_with_verbose_flag PASSED                                                                             [ 43%]
distro_cli/tests/cli_test.py::CLITest::test_cli_without_verbose_flag PASSED                                                                          [ 45%]
distro_cli/tests/device_test.py::TestDeviceCommands::test_device_commands_exist PASSED                                                               [ 48%]
distro_cli/tests/device_test.py::TestDeviceCommands::test_getip_stub PASSED                                                                          [ 51%]
distro_cli/tests/device_test.py::TestDeviceCommands::test_image_stub PASSED                                                                          [ 54%]
distro_cli/tests/device_test.py::TestDeviceCommands::test_image_upstream_stub PASSED                                                                 [ 56%]
distro_cli/tests/device_test.py::TestDeviceCommands::test_reprovision_stub PASSED                                                                    [ 59%]
distro_cli/tests/device_test.py::TestDeviceCommands::test_ssh_stub PASSED                                                                            [ 62%]
distro_cli/tests/device_test.py::TestDeviceCommands::test_update_stub PASSED                                                                         [ 64%]
distro_cli/tests/docker_image_test.py::TestShouldBuildImage::test_custom_expiration_time PASSED                                                      [ 67%]
distro_cli/tests/docker_image_test.py::TestShouldBuildImage::test_image_exists_and_not_expired PASSED                                                [ 70%]
distro_cli/tests/docker_image_test.py::TestShouldBuildImage::test_image_expired PASSED                                                               [ 72%]
distro_cli/tests/docker_image_test.py::TestShouldBuildImage::test_image_not_found PASSED                                                             [ 75%]
distro_cli/tests/docker_test.py::TestDockerInfrastructure::test_run_simple_container PASSED                                                          [ 78%]
distro_cli/tests/image_builder_test.py::TestImageBuilder::test_build_all_stub PASSED                                                                 [ 81%]
distro_cli/tests/image_builder_test.py::TestImageBuilder::test_build_components_stub PASSED                                                          [ 83%]
distro_cli/tests/image_builder_test.py::TestImageBuilder::test_builder_initialization PASSED                                                         [ 86%]
distro_cli/tests/manifest_test.py::TestImageManifest::test_has_component PASSED                                                                      [ 89%]
distro_cli/tests/manifest_test.py::TestImageManifest::test_load_manifest PASSED                                                                      [ 91%]
distro_cli/tests/manifest_test.py::TestImageManifest::test_missing_components PASSED                                                                 [ 94%]
distro_cli/tests/manifest_test.py::TestImageManifest::test_resolve_path_relative PASSED                                                              [ 97%]
distro_cli/tests/manifest_test.py::TestImageManifest::test_resolve_path_url PASSED                                                                   [100%]

==================================================================== 37 passed in 0.78s ====================================================================

@meta-cla meta-cla bot added the CLA Signed label Jan 9, 2026
@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch 2 times, most recently from cf3dfe9 to 6d2a3bb Compare January 12, 2026 18:01
@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch 4 times, most recently from 75eb298 to f2673ec Compare January 26, 2026 23:21
@meta-codesync
Copy link

meta-codesync bot commented Jan 29, 2026

@kevin645 has imported this pull request. If you are a Meta employee, you can view this in D91736319.

@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch from f2673ec to 6037c61 Compare January 29, 2026 03:00
@facebook-github-bot
Copy link
Contributor

@raghav-nexthop has updated the pull request. You must reimport the pull request before landing.

@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch from 6037c61 to d1b288c Compare February 3, 2026 01:09
@facebook-github-bot
Copy link
Contributor

@raghav-nexthop has updated the pull request. You must reimport the pull request before landing.

@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch from d1b288c to c9dbcad Compare February 3, 2026 01:23
@facebook-github-bot
Copy link
Contributor

@raghav-nexthop has updated the pull request. You must reimport the pull request before landing.

@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch from c9dbcad to df25910 Compare February 5, 2026 01:32
@facebook-github-bot
Copy link
Contributor

@raghav-nexthop has updated the pull request. You must reimport the pull request before landing.

@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch from df25910 to e83b4cd Compare February 5, 2026 19:15
@facebook-github-bot
Copy link
Contributor

@raghav-nexthop has updated the pull request. You must reimport the pull request before landing.

Integrate distro_cli Python unit tests into the FBOSS CMake build system to enable automated testing in CI/CD pipelines.

- Add FbossImageDistroCliTests.cmake to discover and register Python unit tests
- Configure test discovery for distro_cli modules (builder, cmds, lib, tools)
- Update root CMakeLists.txt to include distro_cli test suite
- Enable distro_cli tests in GitHub Actions workflow
- Update distro_cli README with build and test instructions

The CMake configuration automatically discovers all *_test.py files and registers them as CTest targets, allowing tests to run via 'ctest' or 'make test'.
Provide basic tools and utiulities for the distro_cli build system.

- Add custom exception classes for structured error handling
- Define shared constants for Docker configuration and build settings
- Implement path resolution utilities for components
- Define test data fixture for image manifest validation

These core utilities provide the base infrastructure required by all downstream components including Docker integration, artifact handling, and build orchestration.
Add Docker container and image management capabilities.

- Implement Docker container wrapper with exec and run operations
- Implement Docker image wrapper with build, pull, and tag operations
- Add comprehensive unit tests for container and image functionality
- Include test helper utilities for unit test infrastructure
- Add build_docker.sh script for Docker build automation

Added unit tests for docker infrastructure and image building.
@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker-part3 branch from e83b4cd to d644f72 Compare February 5, 2026 22:41
@facebook-github-bot
Copy link
Contributor

@raghav-nexthop has updated the pull request. You must reimport the pull request before landing.

@meta-codesync
Copy link

meta-codesync bot commented Feb 5, 2026

@kevin645 merged this pull request in e545b09.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants