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

domain: GitLab CI · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Define a root build job that produces an artifact containing build metadata JSON; in the parallel test jobs, use needs: [{job: build, artifacts: true}] so each test job downloads only the build artifacts and not artifacts from all prior stages
  2. Add parallel: matrix: to the test job definition with a matrix of component names so GitLab spawns one test job per component concurrently, each receiving its component name as a CI variable
  3. Add rules: to each component's test job using changes: paths: ["components/<component>/**"] combined with if: $CI_PIPELINE_SOURCE == "merge_request_event" so the job only runs in merge request pipelines when its component files changed
  4. Define an aggregation job using needs: with a list of all parallel test job names (using the component matrix values) so it waits for all test jobs before running, even though they are in the same stage
  5. Use allow_failure: false on the aggregation job and artifacts: reports: junit: to collect JUnit XML files from all test jobs into a merged test report visible in the merge request UI
  6. Add a when: always rule to a notification job that uses needs: [] (empty) so it runs in parallel with all other jobs regardless of failures, posting a pipeline-start notification without depending on any job completing first

Known gotchas

Related routes

Configure GitLab CI needs: keyword with DAG to eliminate sequential stage bottlenecks and fan out parallel jobs
docs.gitlab.com · 6 steps · unrated
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
Implement a GitLab CI pipeline with dynamic child pipelines generated from changed paths using rules and the artifact strategy
docs.gitlab.com · 5 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