Design a CI/CD system like GitHub Actions with ephemeral runners and live logs

Quick Overview

Design a CI/CD platform that runs YAML-defined workflow DAGs on ephemeral, isolated runners and streams build logs to users in real time. It tests job orchestration and exactly-once dispatch, sandboxing of untrusted multi-tenant code, and a log pipeline that serves live viewers and historical search at tens of millions of jobs per day.

Design a CI/CD system like GitHub Actions with ephemeral runners and live logs

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Other

Design a CI/CD system like GitHub Actions. Users commit declarative workflow files (YAML) to their repositories. The system runs each workflow as a DAG of jobs on isolated, ephemeral runners, lets users tail build logs in real time, and lets them search the output of past runs. Functional requirements: 1. Trigger workflows from system events (`push`, `pull_request`) or on a schedule (cron). 2. Parse the YAML files and execute discrete jobs and steps across different operating systems. 3. Support dynamic allocation of ephemeral cloud runners across multiple operating systems (a heterogeneous runner fleet). 4. Let users view real-time logs of executing jobs. Start by stating the non-functional requirements you are designing for, including availability and the execution guarantee a job needs. Then cover the data model, the API, the high-level design, and the parts of the system that are hardest to get right. ```hint Where job state lives Pick one place that is the source of truth for each job's state. Then ask what happens when two parent jobs finish at the same instant, or when a runner that stopped responding comes back to life. ``` ```hint Untrusted code A workflow from a public pull request is arbitrary code. Think about what a container shares with its host, and what a job could reach over the network from inside your data center. ``` ```hint Two kinds of log reader Someone watching a running job and someone searching last month's builds need different latency and retention from the same bytes. ``` ### Constraints & Assumptions - About 50 million job executions per day, with more than 2 million jobs running at the same time during peak hours. - Traffic is bursty. Large organizations and bots push many commits at once, and a single monorepo matrix can expand into thousands of jobs. - Jobs from many tenants share physical hosts and run untrusted code. - A job should start within 2 seconds of being queued when a warm runner is available, and log lines should reach a viewer's browser within 500 ms. ### Clarifying Questions to Ask - Must the system also run jobs on customer-managed self-hosted runners, or only on runners the platform hosts? - Which operating systems and hardware classes (Linux, Windows, macOS, ARM, GPU) does the fleet need to offer? - If a scheduler or runner crashes, may a step ever run twice? Deploy steps make this matter. - How long are logs kept, and must search cover jobs that are still running? - Do workflows triggered by pull requests from forks get access to repository secrets? ### What a Strong Answer Covers - Non-functional requirements with numbers, including control-plane availability, tenant isolation, and the delivery guarantee for job dispatch. - Storage choices that separate transactional workflow and job state from high-volume log data, along with the core entities, the trigger API and the runner protocol. - How `needs` dependencies become a DAG, how jobs move through their states, and how the design prevents double dispatch or a stuck run when parents finish together or a runner stalls. - How untrusted jobs are isolated from the host, from other tenants and from internal networks, and how nothing carries over from one job to the next. - How logs reach live viewers within 500 ms and also land in durable, searchable storage without one path slowing the other. ### Follow-up Questions - How do trusted runs get secrets while pull requests from forks get none, and how do you keep secret values out of the logs? - Self-hosted runners sit behind corporate firewalls that block inbound traffic. How do they receive jobs? - One monorepo push expands into a 5,000-job matrix. How do you stop it from starving smaller tenants? - The workflow engine crashes right after committing a job as QUEUED. How does the job still reach a runner, and only once?

Overview: Design a CI/CD platform that runs YAML-defined workflow DAGs on ephemeral, isolated runners and streams build logs to users in real time. It tests job orchestration and exactly-once dispatch, sandboxing of untrusted multi-tenant code, and a log pipeline that serves live viewers and historical search at tens of millions of jobs per day.

Nov 25, 2026
hardSoftware EngineerOtherSystem Design
0
0

Design a CI/CD system like GitHub Actions. Users commit declarative workflow files (YAML) to their repositories. The system runs each workflow as a DAG of jobs on isolated, ephemeral runners, lets users tail build logs in real time, and lets them search the output of past runs.

Functional requirements:

  1. Trigger workflows from system events ( push , pull_request ) or on a schedule (cron).
  2. Parse the YAML files and execute discrete jobs and steps across different operating systems.
  3. Support dynamic allocation of ephemeral cloud runners across multiple operating systems (a heterogeneous runner fleet).
  4. Let users view real-time logs of executing jobs.

Start by stating the non-functional requirements you are designing for, including availability and the execution guarantee a job needs. Then cover the data model, the API, the high-level design, and the parts of the system that are hardest to get right.

Constraints & Assumptions

  • About 50 million job executions per day, with more than 2 million jobs running at the same time during peak hours.
  • Traffic is bursty. Large organizations and bots push many commits at once, and a single monorepo matrix can expand into thousands of jobs.
  • Jobs from many tenants share physical hosts and run untrusted code.
  • A job should start within 2 seconds of being queued when a warm runner is available, and log lines should reach a viewer's browser within 500 ms.

Clarifying Questions to Ask Guidance

  • Must the system also run jobs on customer-managed self-hosted runners, or only on runners the platform hosts?
  • Which operating systems and hardware classes (Linux, Windows, macOS, ARM, GPU) does the fleet need to offer?
  • If a scheduler or runner crashes, may a step ever run twice? Deploy steps make this matter.
  • How long are logs kept, and must search cover jobs that are still running?
  • Do workflows triggered by pull requests from forks get access to repository secrets?

What a Strong Answer Covers Guidance

  • Non-functional requirements with numbers, including control-plane availability, tenant isolation, and the delivery guarantee for job dispatch.
  • Storage choices that separate transactional workflow and job state from high-volume log data, along with the core entities, the trigger API and the runner protocol.
  • How needs dependencies become a DAG, how jobs move through their states, and how the design prevents double dispatch or a stuck run when parents finish together or a runner stalls.
  • How untrusted jobs are isolated from the host, from other tenants and from internal networks, and how nothing carries over from one job to the next.
  • How logs reach live viewers within 500 ms and also land in durable, searchable storage without one path slowing the other.

Follow-up Questions Guidance

  • How do trusted runs get secrets while pull requests from forks get none, and how do you keep secret values out of the logs?
  • Self-hosted runners sit behind corporate firewalls that block inbound traffic. How do they receive jobs?
  • One monorepo push expands into a 5,000-job matrix. How do you stop it from starving smaller tenants?
  • The workflow engine crashes right after committing a job as QUEUED. How does the job still reach a runner, and only once?