18 Sep 2025 · Software Engineering · 3 min read

    Feature Showcase: Fan-Out Fan-In

    Contents

    Continuous Integration pipelines don’t have to be slow or complicated. One of the simplest patterns, called Fan-Out Fan-In, can give you both speed and reliability.

    The idea is straightforward:

    • build once
    • run tests in parallel
    • deploy or release if everything passes

    In other words, build the product once, test it from every angle at the same time, then release or deploy.

    What is Fan-Out Fan-In?

    Fan-Out Fan-In is a CI/CD pipeline pattern designed to maximize efficiency.

    • Fan-Out: after building your artifact once, the pipeline “fans out” into multiple test jobs such as unit tests, integration tests, and end-to-end tests. These run in parallel, saving time.
    • Fan-In: once all tests pass, the pipeline “fans in” to a single stage, usually for release or deployment.
    An overview of the fan-out fan-in workflow in a pipeline
    Screenshot

    The key benefit is to avoid rebuilding the same artifact multiple times. It works incredibly well on large projects that demand a lot of computing power to build.

    Build Stage

    Every pipeline starts with a build. This is where you take your source code and turn it into a usable artifact. This can be a compiled binary, a Docker image, or a packaged directory.

    The important part is you only build once. That artifact becomes the single source of truth for all later stages.

    This approach has several advantages:

    • It ensures consistency: tests and deployments all use the same artifact.
    • It saves time: no need to rebuild for every job.
    • It makes debugging easier: if something fails, you know it’s not because of mismatched builds.

    In practice, this usually looks like:

    1. Checking out the repository.
    2. Installing dependencies.
    3. Running the build command.
    4. Storing the result in an artifact store for later stages.
    Pipeline showing the Build Stage

    At this point, you’ve got a reliable package that’s ready to be tested.

    Fan-Out Stage

    Once you have a single, reliable build, it’s time to test it. In the fan-out part, we run test in parallel to reduce the pipeline duration.

    Typical jobs might include unit, integration, and end-to-end tests, but you can do any kind of test in the fan-out stage.


    Each test job starts by pulling down the artifact you built earlier. Since they’re all working with the exact same artifact, you avoid inconsistencies and wasted rebuilds.

    Pipeline showing the Fan-Out Stage

    At the end of this stage, you’ll have a full set of test results and a clear signal of whether your artifact is ready to move forward.

    Fan-In Stage

    All tests passed? Time to fan back in to a single stage that ships your artifact. Here, we start by pulling the exact same build from the artifact store, then package and publish it. This keeps your release consistent with what you just tested.

    Pipeline showing the Fan-In Stage

    Conclusion

    Continuous integration doesn’t have to be complex to be effective. Fan-Out Fan-In keeps things simple: one build, parallel tests, one release. This strategy gives speed without losing reliability.

    Check the documentation page for more examples on modeling complex workflows.

    Thank you for reading, and happy building!

    Want to discuss this article? Join our Discord.

    mm
    Writen by:
    I picked up most of my skills during the years I worked at IBM. Was a DBA, developer, and cloud engineer for a time. After that, I went into freelancing, where I found the passion for writing. Now, I'm a full-time writer at Semaphore.
    Star us on GitHub