Chapter 15Lesson 03~165 minutes

Multi-Project Pipelines, Downstream Triggers, Cross-Project Dependencies, and Platform-Oriented Delivery: Configuration, Design Choices, and Tradeoffs

Platform-oriented delivery is a contract design problem, not merely a trigger syntax choice. This lesson compares trigger jobs with API triggers, moving branches with governed release refs, status mirroring with loose coupling, and centralized orchestration with event-driven autonomy.

Multi-project pipelinesCI_JOB_TOKENDownstream triggersAuthorizationPlatform delivery

Learning objectives

  • Choose trigger keyword versus API triggering based on coupling, auditability, runtime needs, and status semantics.
  • Choose moving branch versus governed release/tag ref and always verify the actual downstream SHA.
  • Design narrow dataflow with inputs, inheritance controls, and trigger forwarding instead of implicit variable propagation.
  • Decide when centralized orchestration is appropriate and when event-driven project autonomy reduces coupling.
  • Evaluate cross-project artifact options, tier requirements, wait semantics, and rollback/evidence implications.

1. Start with the contract, not the trigger syntax

A platform-oriented delivery chain should state: producer project/version, consumer project/ref, allowed pipeline sources, input schema, required permissions, status semantics, cross-project data, side effects, observability, and rollback. The syntax is implementation after those decisions.

2. trigger keyword versus API trigger

Choice Strength Cost/risk Prefer when
trigger:project Declarative relationship visible in compiled YAML and graph Ref/project fixed by configuration/variables supported by keyword Downstream orchestration is part of pipeline design
CI_JOB_TOKEN + trigger API Runtime decision can choose target/ref after safe computation More script/API error handling, HTTP evidence, retry/idempotency concerns A job genuinely must compute trigger parameters at runtime
Long-lived trigger token Simple external caller integration Secret lifecycle and weaker user-context semantics External integration specifically requires it; rotate/revoke and scope carefully
PAT-based API Very broad API capability Personal identity, long-lived secret, excessive scope risk Avoid as routine cross-project pipeline mechanism

3. Moving branch versus governed release ref

A branch optimizes convenience; a protected version tag optimizes reproducibility. Neither name alone proves the code. Record the downstream SHA in every case.

Ref strategy Change behavior Evidence requirement Rollback
default/main branch Moves whenever branch advances Record actual downstream SHA every run Re-trigger known-good SHA indirectly via governed ref/update policy
release tag Expected stable release point Record tag + resolved SHA + protection/governance Trigger prior known-good tag
environment branch Moves intentionally with promotion Record branch + SHA + promotion record Reset only through reviewed promotion process

4. Mirror status only when upstream truly owns downstream outcome

strategy: mirror creates synchronous coupling: the upstream trigger job waits for and reflects downstream status. That is correct when downstream validation/deployment is part of the upstream definition of done. It also increases upstream duration and propagates downstream instability.

Loose coupling is healthier when downstream is an autonomous consumer that should react independently. In that architecture, use events/APIs with explicit correlation IDs and do not pretend the upstream pipeline owns downstream completion.

5. Inputs versus forwarded variables

Mechanism Use Risk control
trigger inputs Typed/validated downstream API arguments Document, validate, keep non-secret
YAML variables Small runtime config intentionally passed Name explicitly; avoid secrets and collisions
trigger:forward Controls YAML/pipeline variable forwarding Default to narrow/false where practical
inherit:variables Controls upstream defaults inherited by trigger job Use false or explicit list for bounded contracts
Secrets Credentials/privileged identity Retrieve/authorize separately; do not broad-forward

6. Allowlist design: least privilege in two dimensions

Least privilege has two dimensions: which source projects/groups may present a job token, and which target capabilities that token may use. Keep allowlist entries narrow. Where current GitLab fine-grained job-token permissions fit, restrict endpoints such as read-only commit/job operations instead of relying on broad defaults.

Never assume a group allowlist entry is static: future projects created inside that group are also included. Use group entries only when the governance intent is truly group-wide.

7. Cross-project artifact design is not orchestration design

Artifacts answer “which produced bytes should another job consume?” Triggers answer “which pipeline should run?” Keep those contracts separate. A downstream pipeline can run correctly with no artifact dependency, and an artifact fetch can succeed without proving the expected downstream pipeline ran.

Current needs:project is Premium/Ultimate, can fetch from up to five jobs, and chooses latest successful artifacts for the specified ref/job without waiting for a currently running pipeline. For high-assurance promotion, identify producer project/pipeline/job/SHA and verify an artifact digest before use.

8. Central orchestration versus event-driven autonomy

Model Benefits Risks Good fit
Central orchestrator project One visible release graph, coordinated sequencing Large blast radius, coupling, permissions concentrated Tightly coordinated multi-service release
Producer triggers consumer directly Simple ownership relationship Point-to-point coupling can grow Small dependency graph with clear ownership
Event-driven autonomous consumers Loose coupling and independent evolution Harder correlation/status aggregation Many teams/services with independent SLOs
Component + downstream contract Standardized interface and local autonomy Requires version/API governance Platform golden paths

9. Free mandatory path versus optional paid capabilities

Core multi-project triggers, inputs, CI_JOB_TOKEN, and allowlist controls support the mandatory learning path. Premium/Ultimate features such as needs:project should improve ergonomics, not become hidden prerequisites. A course design that requires a paid artifact primitive to understand cross-project authorization would violate the academy contract.

10. Rollback is identity + contract rollback, not blind re-trigger

A failed downstream release may require restoring a prior downstream ref/version, component contract, artifact digest, or environment state. Record those identities before change. “Retry the trigger” can repeat side effects and does not restore previous code.

11. Worked scenario: choose the platform pattern

Scenario: a service repository needs a validation pipeline in a platform-owned project. The validator consumes only upstream SHA and release channel, produces no deployment, and its result must block the service release.

Decision Choice Why/evidence
Trigger trigger:project Declarative relation visible in compiled config
Downstream ref protected version tag Stable validator release; verify actual downstream SHA
Data spec:inputs Typed non-secret contract; no broad variable forwarding
Status strategy: mirror Validator success is part of upstream release definition
Authorization user permission + narrow job-token allowlist only if API callback needed Separate pipeline creation from API access
Artifact none in mandatory contract Avoid unnecessary cross-project data coupling
Rollback previous validator tag + SHA Explicit known-good version

12. Architecture review checklist

  • Is every downstream project/ref/SHA observable?
  • Can the trigger relationship be understood without reading secret variables?
  • Are only necessary non-secret inputs forwarded?
  • Does status coupling match ownership rather than convenience?
  • Are job-token source/target allowlists narrow and auditable?
  • Are artifact dependencies version/tier/producer identity explicit?
  • Can each project fail or roll back without ambiguous “latest” selection?

Knowledge check

When is strategy: mirror the wrong choice?

Why is a protected tag still accompanied by a SHA in evidence?

What hidden coupling can broad variable forwarding introduce?

Does needs:project establish a runtime dependency on the just-triggered pipeline?

Why can a group allowlist entry be broader than it looks?

Next lesson

Diagnostics, failure modes, security, and performance

Diagnose ref drift, allowlist direction, secret forwarding, status misunderstandings, stale artifacts, and circular trigger chains.

Version and compatibility note

GitLab and GitLab Runner evolve continuously. Treat version-sensitive YAML, runner/executor behavior, APIs, security features, policy controls, tiers, and deprecations as assumptions to verify against the current official GitLab documentation before production use. Preserve the exact project/ref/SHA, compiled configuration, pipeline/job IDs, runner/tool versions, and external target evidence used for any reproducible lab or incident record.

Official references and version notes

Documentation verification date: 2026-09-11. Multi-project trigger syntax, downstream inputs/forwarding, CI_JOB_TOKEN permissions, allowlist controls, artifact APIs, and needs:project are version-sensitive. Re-check the GitLab version deployed on Self-Managed or Dedicated instances before relying on newer behavior.

  • Downstream pipelines — multi-project triggers, downstream source values, trigger strategies, inputs, variable forwarding, and cross-project artifact patterns.
  • CI/CD job token — token lifetime, user-derived permissions, cross-project allowlists, security, and current allowlist controls.
  • Fine-grained job-token permissions — optional endpoint-level restrictions for allowlisted projects/groups.
  • Trigger pipelines with the API — trigger tokens, CI_JOB_TOKEN multi-project API triggers, source semantics, and revocation guidance.
  • CI/CD YAML syntax reference — trigger, trigger:strategy, trigger:forward, needs:project, and current tier constraints.
  • Job Artifacts API — artifact download by job/ref and the current tier requirement for cross-project job-token downloads.
Current behavior used by this chapter: Multi-project downstream pipelines are available across GitLab offerings. The user who starts the upstream pipeline must also be authorized to start a pipeline in the downstream project. Jobs in a multi-project downstream pipeline see CI_PIPELINE_SOURCE=pipeline. By default, a trigger job succeeds when GitLab successfully creates the downstream pipeline; strategy: mirror makes the trigger job track downstream status, while strategy: depend is not recommended for new designs. Downstream inputs are preferred over broad variables when defining a configuration contract. CI_JOB_TOKEN exists only while a job runs; target projects restrict cross-project token use with an allowlist, and allowlisting does not grant project membership. Current allowlists support up to 200 group entries and 200 project entries. needs:project and CI_JOB_TOKEN-authenticated Job Artifacts API downloads across projects are Premium/Ultimate features, so this chapter's mandatory path uses Free-tier allowlisted API metadata access and treats cross-project artifact transfer as optional/simulated.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.