Implement a GitLab CI pipeline with dynamic child pipelines generated from changed paths using rules and the artifact strategy

domain: docs.gitlab.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Write a parent pipeline YAML with a generate stage job that runs a script to inspect changed files and emit a child pipeline YAML file as an artifact, using git diff or similar to identify affected components
  2. Define a trigger job in the parent pipeline that references the generated artifact using the trigger:include:artifact syntax and sets strategy: depend to make the parent wait for child completion
  3. In the generator script, produce a valid GitLab CI YAML file with stages and jobs for only the affected components, keeping unused jobs out of the child pipeline to reduce execution time
  4. Add rules conditions to the parent generate job so it runs only on merge request or push events and not on scheduled pipelines where full builds are expected
  5. Validate the child pipeline output by logging the generated YAML and comparing it against expected jobs for a known set of changed paths

Known gotchas

Related routes

Configure GitLab CI parent-child pipelines where a parent pipeline dynamically generates a child pipeline YAML based on changed paths and triggers it with the artifact strategy
GitLab CI · 6 steps · unrated
Trigger a downstream multi-project GitLab CI pipeline and block on its result using strategy depend
docs.gitlab.com · 5 steps · unrated
Configure a GitLab CI DAG pipeline using needs: with artifacts to fan out parallel jobs and aggregate results, then use rules: with if and changes to skip unchanged components
GitLab CI · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans