Skip to content

Conversation

@raghav-nexthop
Copy link

@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

This PR introduces Docker infrastructure support for the FBOSS Image Builder, building on the CLI skeleton and core infrastructure from previous PRs. This is part of a series of PRs to create a comprehensive FBOSS distribution image builder tool.

  • Docker container wrapper (container.py) with exec/run capabilities for managing containerized build environments
  • Docker image wrapper (image.py) with build/pull/tag operations, including intelligent image caching and expiration
  • Build script (build_docker.sh) for creating the FBOSS builder Docker image with all necessary dependencies
  • Comprehensive unit tests for Docker operations

This is part of a series. The previous one is #793 The next one is #795

Test Plan

Unit Tests:

PYTHONPATH=fboss-image:$PYTHONPATH python3 -m pytest fboss-image/distro_cli/tests/ -v --tb=short
============================================================== 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
collected 37 items                                                                                                                               

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

=============================================================== 37 passed in 0.99s ===============================================================

Summary:

Here an RPM specfile and surrounding machinery is added to build an
FBOSS-compatible Linux kernel from vanilla Linux sources which is
compatible with CentOS. On top of this reference configuration,
additional local changes from `fboss-local-overrides.yaml` are applied
prior to building.

To use, inside an FBOSS build container, run:

    # fboss-image/kernel/scripts/build_kernel.sh 6.4.3 out
    ...
    Kernel RPM build complete!
    Output files:
    out/x86_64/kernel-modules-6.4.3-1.fboss.el9.x86_64.rpm
    out/x86_64/kernel-headers-6.4.3-1.fboss.el9.x86_64.rpm
    out/x86_64/kernel-core-6.4.3-1.fboss.el9.x86_64.rpm
    out/x86_64/kernel-devel-6.4.3-1.fboss.el9.x86_64.rpm
    out/BUILD/linux-6.4.3/kernel/config_data.gz
    out/SRPMS/kernel-6.4.3-1.fboss.el9.src.rpm
    out/kernel-6.4.3.rpms.tar.gz
    out/kernel-6.4.3-1.fboss.el9.src.rpm
    out/RPMS/x86_64/kernel-modules-6.4.3-1.fboss.el9.x86_64.rpm
    out/RPMS/x86_64/kernel-headers-6.4.3-1.fboss.el9.x86_64.rpm
    out/RPMS/x86_64/kernel-core-6.4.3-1.fboss.el9.x86_64.rpm
    out/RPMS/x86_64/kernel-devel-6.4.3-1.fboss.el9.x86_64.rpm
    # ls fboss-image/kernel/dist/build-6.4.3/out/
    kernel-6.4.3-1.fboss.el9.src.rpm  kernel-core-6.4.3-1.fboss.el9.x86_64.rpm   kernel-headers-6.4.3-1.fboss.el9.x86_64.rpm
    kernel-6.4.3.rpms.tar.gz          kernel-devel-6.4.3-1.fboss.el9.x86_64.rpm  kernel-modules-6.4.3-1.fboss.el9.x86_64.rpm
@meta-cla meta-cla bot added the CLA Signed label Jan 9, 2026
@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker branch from e87c9aa to 2e40434 Compare January 9, 2026 04:17
Add CMake configuration and CI workflow for FBOSS Image Builder:
- CMake test configuration for distro_cli unit tests
- GitHub Actions workflow for automated testing
- README documentation for the distro_cli tool

Test Plan:
- CMake configuration tested with pytest integration
- CI workflow validates on pull requests
Add foundational infrastructure for distro_cli:
- Custom exception classes for error handling
- Shared constants for Docker and build configuration
- Path resolution utilities for locating components
- ImageManifest class for build configuration parsing
- Unit tests for ImageManifest with test data

Test Plan:
- Pre-commit checks: PASSED
- Unit tests: 5/5 passing
  $ PYTHONPATH=fboss-image python3 -m pytest fboss-image/distro_cli/tests/manifest_test.py -v
  test_has_component PASSED
  test_load_manifest PASSED
  test_missing_components PASSED
  test_resolve_path_relative PASSED
  test_resolve_path_url PASSED
Add Docker container and image management:
- Docker container wrapper with exec/run capabilities
- Docker image wrapper with build/pull/tag operations
- Build script for FBOSS builder Docker image
- Comprehensive unit tests for Docker operations

Dependencies: Uses constants from PR facebook#792

Test Plan:
- All unit tests pass (docker_test.py, docker_image_test.py)
- Docker image builds successfully with all build dependencies
@raghav-nexthop raghav-nexthop force-pushed the raghav.distro-cli-docker branch from 2e40434 to 524bf4f Compare January 9, 2026 04:23
Add CMake configuration and CI workflow for FBOSS Image Builder:
- CMake test configuration for distro_cli unit tests
- GitHub Actions workflow for automated testing
- README documentation for the distro_cli tool

Test Plan:
- CMake configuration tested with pytest integration
- CI workflow validates on pull requests
Add foundational infrastructure for distro_cli:
- Custom exception classes for error handling
- Shared constants for Docker and build configuration
- Path resolution utilities for locating components
- ImageManifest class for build configuration parsing
- Unit tests for ImageManifest with test data

Test Plan:
- All unit tests pass (manifest_test.py)
- Pre-commit checks pass
@raghav-nexthop
Copy link
Author

New PR will be created.

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.

1 participant