wake
Engineering Guide · GitLab CI · Updated November 22, 2026

Deterministic GitLab Dynamic Child Pipelines for Polyglot Monorepos

Direct answer: Static rules:changes path filters silently miss transitive dependencies across Python, Rust, TypeScript, Go, and Nix packages. Replacing static YAML with a 15-line GitLab trigger:include:artifact parent pipeline that resolves your real dependency graph cut our self-hosted GitLab CE UI merge request from 2m 59s to 30s (7.1x less runner compute) while keeping the full suite mandatory on default branches and tags.

Why GitLab rules:changes fails in monorepos

Almost every growing monorepo starts with hand-written rules:changes: globs in .gitlab-ci.yml. It works for three services and breaks quietly at ten:

  • Transitive dependency blind spots: Editing libs/proto/schema.py breaks services/api and services/worker, even though no file under services/ changed. Either engineers maintain fragile duplicated path lists by hand or they give up and run every job on every push.
  • Coding agents amplify the waste: When Claude Code or Cursor pushes 5 to 10 iterative fix commits per MR, re-running cold Nix, Rust, and integration test stages for a 2-line UI or formatting tweak saturates self-hosted runner fleets.
  • Late-stage failure feedback: Putting lint or format in the final stage makes developers wait for full build and integration suites just to learn a trailing comma failed formatting at minute 2:49.

How GitLab Dynamic Child Pipelines work

GitLab natively supports generating a child pipeline YAML file at runtime via artifacts:paths and executing it with trigger:include:artifact. Your existing runners, Docker images, caches, and job scripts stay unchanged.

stages: [plan, run]

wake-plan:
  stage: plan
  image: ghcr.io/strange-metal/wake:latest
  script:
    - wake plan --ci-file .wake-pipeline.yml --post-comment --out wake-generated-ci.yml
  artifacts:
    paths:
      - wake-generated-ci.yml

wake-child:
  stage: run
  trigger:
    include:
      - artifact: wake-generated-ci.yml
        job: wake-plan
    strategy: depend

In wake-plan, Wake parses your workspace manifests (pyproject.toml, package.json, Cargo.toml, go.mod, flake.nix, callPackage, and optional .wake.yml custom edges), computes the transitive reverse-dependency closure of changed files, promotes fast linters to parallel stage 0, injects explicit needs: DAG edges, and writes wake-generated-ci.yml.

Three self-hosted GitLab Runner pitfalls you must handle

  1. Never trust CI_COMMIT_BEFORE_SHA on feature branches: On a branch's first push, GitLab sets CI_COMMIT_BEFORE_SHA to 40 zeroes. On a force-push after rebase, it points to an unreachable commit that breaks git diff. Always force-fetch origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME (or CI_DEFAULT_BRANCH) and diff against git merge-base.
  2. Docker executor cached .git volumes go stale: Self-hosted runners with persistent build caches often hold outdated refs/remotes/origin/develop. Explicitly run git fetch --no-tags --depth=50 origin +refs/heads/$TARGET:refs/remotes/origin/$TARGET inside the planner job.
  3. Always keep a deterministic full-suite safety net: Any edit to root lockfiles, shared CI templates, or pushes to develop/main and release tags must automatically bypass pruning and run 100% of jobs.

Measured results on self-hosted GitLab CE

ScenarioJobs runWall-clockComputeResult
Static YAML (cold cache)9 / 92m 59s4m 32sFailed at 2:49 on formatting
Static YAML (warm cache)9 / 91m 23s2m 40sUI edit rebuilt backend + Nix
Wake stage-0 fast-fail1 / 921s21s4.0x faster feedback
Wake dynamic child pipeline (UI MR)3 / 930s38.3s7.1x less compute

Profile your own GitLab pipeline with zero code egress

Inspect our live monorepo X-Ray flamegraph or run Wake's offline container inside your own GitLab Runner network to see exactly how many minutes dynamic child pipelines can cut.

Request a 15-minute X-Ray audit