Overview

The Moby project utilizes a series of scripts and configurations to streamline Continuous Integration (CI) and Continuous Deployment (CD) for building and testing its components. This document outlines the step-by-step guide for setting up CI/CD within the Moby project based on its current practices.

Current CI/CD Setup

What Exists

Currently, the Moby project utilizes Jenkins infrastructure for CI. The CI jobs can be triggered and re-run by the Moby maintainers. However, there is no explicit CI/CD configuration visible in the repository documentation directly related to the project’s build and deployment processes beyond Jenkins. As a result, the existing setup primarily focuses on integration tests and other CI functionalities rather than deployment specifics.

Next Steps for CI/CD Enhancement

For developers seeking to enhance CI/CD within the Moby project, consider the following actions:

  1. Familiarize with Jenkinsfile Structure:

    • Review and contribute to the Jenkinsfile, ensuring it is equipped to handle new types of CI/CD workflows as required by the project.
  2. Integrate Testing Frameworks:

    • Integrate additional testing frameworks and define clear testing guidelines for adding or updating tests within the integration/ directory while phasing out the deprecated integration-cli.
  3. Containerize the CI Environment:

    • Consider creating Docker images that mirror the CI/CD environment. This will allow the tests to run in a consistent context.
  4. Automate Dependency Management:

    • Ensure the VENDORING.md guidelines are followed to keep vendoring to a minimum and maintain a regular cadence for updates.
  5. Improve Cross Architecture Support:

    • Contributions should focus on improving support for diverse architectures in CI pipelines, recognizing the existing limitations and working towards addressing them.

Example Commands and Code

For developers looking to understand the environment and test configurations, take note of the following Dockerfile and Makefile commands utilized in the project to manage builds and tests.

Dockerfile Highlights

The Dockerfile describes settings used during the container image creation, expressing the various build environments:

# Base Go image configuration
FROM --platform=$BUILDPLATFORM golang:1.21.7-bookworm AS base

# Dummy stages and package installations
FROM scratch AS binary-dummy
COPY --from=build-dummy /build /build

# CRIU (Checkpoint/Restore in Userspace)
FROM base AS criu
RUN apt-get update && apt-get install -y criu

# Build the main binary based on the specifications
FROM base AS build
RUN apt-get update && apt-get install -y gcc pkg-config
RUN docker buildx bake binary

Makefile Commands

The Makefile provides several commands to facilitate building, testing, and running the project components. For example:

# Compile the binaries
binary:
    docker buildx bake binary

# Run the test suite
test:
    docker run --rm my_image ./test_suite

# Clean the caches
clean:
    rm -rf ./build

Testing Commands

When running tests, specific build constraints are defined, such as:

# Run tests respecting specific build constraints
go test -tags=linux,go1.19 ./...

This ensures that tests are run only in the correct environments.

Conclusion

While there is no comprehensive CI/CD deployment structure detailed in the Moby project at this moment, opportunities exist to expand upon existing infrastructure with contributions targeted at enhancing build processes, testing framework integration, and cross-architecture support. Expert developers are encouraged to review the state of the project, contribute improvements, and leverage the existing Docker and Makefile configurations to streamline the CI/CD processes further.

Source: Project Documentation Overview on CI/CD structure and relevant file excerpts from Dockerfile and Makefile.