Cross-Project Pipelines
glci supports both child pipelines (trigger: include:) and cross-project pipelines (trigger: project:) locally. Child pipelines share the parent’s Docker infrastructure. Cross-project triggers resolve the target project from a local directory or by cloning it from GitLab.
Child pipelines (trigger: include:)#
Child pipelines work the same as production GitLab CI parent-child pipelines. Every include type GitLab accepts there is supported: string shorthand (an http:// or https:// URL is read as remote:, anything else as local:), local:, project:, remote:, template:, component: and artifact-sourced includes (artifact:/job:, see below), along with forward: and per-include inputs: and rules:. A trigger: include: may list up to 3 entries of any type, which are merged into the child pipeline (matching GitLab). As on GitLab, the parent’s own config is refused when it is parsed (so glci lint reports it too) if the list is longer (jobs:<name>:trigger:include config is too long (maximum is 3)), if include: is a single mapping rather than a string or a list (... config should be an array or a string), or if an entry is neither a string nor a mapping (jobs:<name>:trigger:include:include config should be a hash or a string). An entry that is itself a list of valid entries passes the parent, as on GitLab, and fails only the downstream pipeline (Each include must be a hash or a string, not a list). A project:, remote:, template: or component: entry is fetched by the same fetchers, with the same token and cache, as the same entry in a top-level include:, so a child pipeline that lives entirely in a shared templates project works as is:
deploy:
trigger:
include:
- project: group/ci-templates
file: /child.yml
A child pipeline’s config is ordinary CI YAML, so it may carry its own include: block — and those includes resolve exactly as they do in a top-level .gitlab-ci.yml, include: project: and include: component: included. A child that pulls shared job templates out of a central templates project therefore runs locally with no changes:
# child.yml
include:
- project: my-group/my-templates
ref: v1.0.0
file: templates.yml
job:
extends: .template-job
The remote fetch uses the same GitLab token as the top-level parse (see What requires a GitLab token) and the same on-disk include cache, so a template fetched once is reused by every child pipeline in the run.
When no token is available the include is skipped, and glci says so twice: in the trigger job’s output (glci log <pipeline-id> <trigger-job>, and inline during glci run) and in the daemon log. Look for:
skipping project include my-group/my-templates: no GitLab token configured
What happens next depends on whether anything referenced the skipped file:
- If a job
extends:a definition the include would have provided, the parse fails and the trigger job fails withextends target ".template-job" not found— matching GitLab, which rejects a config whoseextends:target is missing. - If nothing references it, the child pipeline runs without the jobs that file defined. The warning above is the only sign, so treat it as an error in disguise.
Note that downstream parsing is stricter than glci lint/glci jobs here: when an include was skipped for want of a token, those warn about a missing extends: or !reference target and carry on, because the target may be defined in the skipped file and a top-level parse is often run deliberately offline (glci lint then says it could not fully verify the config rather than calling it valid). A downstream parse cannot afford that — a job stripped of its extends: keeps no script:, so it is dropped from the pipeline and the trigger job passes with nothing to show for it. So glci lint -f child.yml may pass, unverified, on a file the child parse rejects; the parse error names the target it could not find. With no include skipped (or with a token configured), glci lint and the child parse both refuse a missing target.
A downstream config that GitLab rejects outright — a rules: if: that does not parse, for example — fails the trigger job with CI configuration is invalid: and the offending key (jobs:<name>:rules:rule if invalid expression syntax) in that job’s log, and none of the downstream pipeline’s jobs run, since GitLab creates none of them. As on GitLab this fails the trigger job whatever its strategy:, so the parent fails unless the trigger job has allow_failure: true. With allow_failure: true the run stays green and reports no error at all: GitLab drops the bridge with downstream_pipeline_creation_failed, and a failed bridge that is allowed to fail counts as success with warnings. The reason is still in that trigger job’s own log, and in a nested pipeline (parent triggers child triggers grandchild) the tolerated refusal stops there rather than sinking the pipelines above it. glci lint -f child.yml reports the same error. A child refused only in its context, where a job needs a job that rules: leave out ('<job>' job needs '<target>' job, but '<target>' does not exist in the pipeline. ...), fails the trigger job the same way, but glci lint passes it, since lint evaluates no job rules.
The downstream pipeline itself is still recorded, as GitLab records it: any downstream config that fails to load (one GitLab rejects, YAML that does not parse, a trigger: include: file or an include inside it that does not resolve, a trigger: include: artifact: whose artifact is missing or empty, a needs: naming no job or forming a cycle, a job needing a job that rules: leave out) leaves a pipeline in glci history that is failed with failure reason config_error, has no jobs, and lists the config errors. The trigger job links to it (child_pipeline_id in glci history show --json), and glci history show <id> prints the reason and each error. A trigger job stopped before GitLab would create a downstream pipeline at all (the nesting limit below, an artifact: include with no job:, a target project with no .gitlab-ci.yml, or a downstream pipeline that workflow: filters out or whose jobs rules: all filter out) leaves none, as on GitLab. The trigger job’s log names the recorded pipeline: downstream pipeline #<id> recorded as failed (config_error); see: glci history show <id>. A bare glci retry after such a run lands on that pipeline, which has no jobs, and says to retry the parent’s trigger job instead.
Where include paths resolve from#
trigger: include: local: paths (and bare strings that are not URLs) — and any include: local: inside the child’s own config — resolve from the repository root, exactly as GitLab reads them out of the repository. Leading slashes are stripped, so ci/child.yml and /ci/child.yml name the same file.
Include resolution does not depend on which directory you invoke glci from, so a CI file in a subdirectory names paths the way GitLab reads them:
# apps/web/.gitlab-ci.yml, run as: glci run --file apps/web/.gitlab-ci.yml
child:
trigger:
include: ci/child.yml # <repo-root>/ci/child.yml, as on GitLab
A path that climbs out of the repository (../outside.yml) is rejected. An absolute filesystem path is not a special case: its leading slash is stripped like any other, so /etc/passwd is looked up as <repo-root>/etc/passwd and simply isn’t found — a path outside the repository can never be read, because GitLab could not read one either.
A path reached through a symbolic link is rejected too, even when the link points at a file inside the repository. That matches GitLab rather than merely being cautious: GitLab reads includes out of the git object database, where a symlink is a blob holding the target’s path. So it never traverses through one — link/ci.yml where link is a symlink answers Local file 'link/ci.yml' does not exist! — and never follows one, reading the link’s own text instead, which gives Invalid configuration format for a path where a mapping was expected. The rule is about the link, not about whether it is committed — glci reads your working tree, so an untracked link is refused the same way. Reference the file directly rather than through a link; GitLab’s own documentation recommends include:local in place of symbolic links for this reason.
Wildcards in include paths#
A * makes a path a wildcard, matched the way GitLab matches it. This applies to trigger: include: and to include: local: alike — they share one implementation.
| Form | Matches | Example |
|---|---|---|
* | any characters except /, so it stays inside one directory | ci/*.yml matches ci/a.yml, not ci/one/b.yml |
** | any characters, / included | ci/**.yml matches ci/a.yml and ci/one/two/c.yml |
**/ | any run of directories, or none | ci/**/*.yml matches ci/a.yml as well as ci/one/two/c.yml |
Because **/ can match zero directories, a root-level **/*.yml picks up files at the top of the repository too, not only nested ones.
A * is the only thing that makes a path a wildcard. ?, [, ], { and } are literal parts of a filename, so ci/[ab].yml names one file called exactly that rather than matching ci/a.yml and ci/b.yml. This differs from exists: and changes:, which are shell globs where ? and [ are metacharacters — see workflow rules.
Matched files merge in path order, byte-sorted the way git lists them, so a later file overrides an earlier one on a conflicting key.
Wildcards resolve against the project’s non-ignored files. A gitignored fragment is not includable, and neither is anything inside a submodule — GitLab resolves includes out of the repository and would not see either.
A wildcard that matches nothing is silently ignored, as on GitLab. A path with no * in it is a plain filename, so if it does not exist you get an error rather than silence. A wildcard a variable delivers is expanded only in a plain-string entry: GitLab substitutes the variables of include: $PATTERN (or - $PATTERN) first, to tell local: from remote:, but expands wildcards before it substitutes the variables of a mapping, so local: $PATTERN holding ci/*.yml is the path ci/*.yml, which no file has, and fails on both. Inside a project: or component: file, a local: wildcard matches that project’s files at its ref, listed through the repository tree API, so the token needs read_api there; a listing that fails, or stops at 20,000 entries (directories count too), fails the include with cannot expand the wildcard.
The 3-file limit counts include entries, before expansion — again as GitLab counts it — so one ci/*.yml entry may merge more than three files, and a ** entry may merge a great many.
A wildcard expands against every matching file, not only the YAML ones, and each match must then end in .yml/.yaml — so ci/* fails when ci/ holds a README.md, while ci/*.yml beside the same file merges cleanly. Directories are skipped, matching GitLab, whose wildcard search returns files only. The pattern itself is never checked; GitLab expands before it validates.
For a trigger: include:, that check happens when the child pipeline is created rather than at glci lint time, which is how GitLab sequences it too — so the parent lints clean and the trigger job is where a bad extension surfaces.
Variables in a child’s include paths#
$VAR / ${VAR} references in a child’s include: entries (project:, ref:, file:, local:), and in the trigger: include: entries themselves, expand against the variables the trigger job forwards downstream — the parent’s global variables: the trigger job inherits (inherit: variables:) merged with its own variables:, and with forward: pipeline_variables its dotenv imports and the pipeline variables — the same set GitLab expands them against. So this picks up v2.0.0:
# .gitlab-ci.yml
child:
variables:
TEMPLATES_REF: v2.0.0
trigger:
include: child.yml
# child.yml
include:
- project: my-group/my-templates
ref: $TEMPLATES_REF
file: templates.yml
Underneath the forwarded set sit the predefined CI_* variables and any API-fetched instance/group/project variables (a multi-project pipeline’s group and project variables are the target’s, see CI/CD variables of the target project), so ref: $CI_DEFAULT_BRANCH resolves too. A child’s predefined variables are its parent’s, with CI_PIPELINE_SOURCE=parent_pipeline; a multi-project pipeline’s are the target’s own (see Cross-project variables). The forwarded set overrides the child’s own global variables: block, matching GitLab. The same set decides the downstream’s include rules.
glci’s own layers (--env, --env-file, preset env:, .glci.env) sit on top of all of it and still override a forwarded value, except for CI_PIPELINE_SOURCE and CI_PARENT_PIPELINE_ID: --env, --env-file and a preset’s env: do not reach those, as they do not for the downstream’s job rules, while .glci.env or a project CI/CD variable still does. Note they apply whatever forward: says — they are glci’s local override for a run, not a simulated GitLab variable source — so --env can steer which file a child includes even when forward: pipeline_variables is false and that variable is absent from the child’s rules and runtime environment. Setting forward: yaml_variables: false withholds the forwarded set from the expansion, leaving the predefined and glci layers in place.
glci-specific behavior#
- The child shares the parent’s mock server and runner containers.
- The child’s submodules are served too: it inherits what the parent served, and glci walks the repository again when the child’s jobs ask for more.
- Child pipeline events are bridged to the parent’s event bus, so the TUI and
glci logdisplay them inline. - Nesting is capped at 2 levels deep (matching GitLab). Exceeding this produces:
child pipeline nesting depth 3 exceeds maximum 2. strategy: depend(ormirror) makes the trigger job fail if the child fails. Without a strategy the trigger job is fire-and-forget and passes once the child is created, unless the child is refused when it is created (an invalid config, or a job needing a job thatrules:leave out in the child’s context) or stalls on aneeds:entry whose target is not in the child pipeline, such as a target in a stagestages:does not list. That fails the trigger job whatever itsstrategy:, with the reason in its trace, as GitLab fails a trigger job whose downstream pipeline it could not create (downstream_pipeline_creation_failed).allow_failure: trueon a trigger job is honoured, so a failing child understrategy: dependneed not sink the parent pipeline. A trigger job with a job-levelwhen: manualand noallow_failurekey defaults toallow_failure: true, as on GitLab, so playing one whose child fails leaves the parent passing. A trigger job runs no script and so never reports an exit code, which meansallow_failure:exit_codesnever applies to one. See Tolerated failures.- The child’s
rules: changes:, in its include rules and its job rules alike, compare against its parent’s diff. - The child receives
CI_PIPELINE_SOURCE=parent_pipelineandCI_PARENT_PIPELINE_ID, and its own freshly generatedCI_PIPELINE_ID/CI_PIPELINE_IID/CI_PIPELINE_URL/CI_PIPELINE_CREATED_AT(not inherited from the parent). - Stopping the parent pipeline (
glci stop) automatically cancels in-flight child pipeline jobs via the Job-Status cancel protocol. - A cross-pipeline need —
needs: [{pipeline: $PARENT_PIPELINE_ID, job: build}], or{project: ..., job: ..., ref: ...}— names a job in another pipeline, so it is never matched against the child’s own jobs: a child with a later-stage job also calledbuildis valid, as on GitLab, and the need adds no edge to the child’s DAG. glci does not fetch artifacts across pipelines, so the parent’sbuildartifacts are not downloaded into the child job, and its dotenv variables are not imported either.
Variable forwarding#
forward: controls what the parent passes to the downstream pipeline. The defaults match GitLab’s FORWARD_DEFAULTS:
| Forward setting | Default | What it passes |
|---|---|---|
yaml_variables | true | The trigger job’s YAML variables: the parent’s global variables: the trigger job inherits (inherit: variables:) merged with its own variables: (job overrides global) |
pipeline_variables | false | The dotenv variables the trigger job imports from the jobs it depends on, then the variables passed via --env (CLI/manual), --env-file and a preset’s env:, which stand in for the variables a pipeline is run with; in a child that triggers a pipeline of its own, what its own trigger job forwarded to it |
Because yaml_variables defaults to true, a trigger job with no forward: block still forwards the parent’s global variables and the trigger job’s own variables:. Set yaml_variables: false to suppress both, or inherit: variables: false (or a list) on the trigger job to forward its own variables: without the globals it leaves out.
Each setting takes a boolean, written plain: a quoted "false" is a string, and the pipeline is refused, as on GitLab (jobs:<name>:trigger:forward yaml variables should be a boolean value), rather than forwarding with the default. So is any other key under forward: (jobs:<name>:trigger:forward config contains unknown keys: <key>).
When a key appears in more than one forwarded set, the later one in GitLab’s order wins: the YAML variables, then the dotenv imports, then the pipeline variables.
Dotenv in a trigger job#
A trigger job imports the dotenv reports of the jobs it needs: (except a need with artifacts: false), or of every job in an earlier stage when it has no needs:, as any other job does. The imported values rank above the trigger job’s own variables: and below the CI/CD variables, so trigger: project:, trigger: branch: and the forwarded variables: can use them:
version:
stage: build
script: echo "DOWNSTREAM=group/deployer" > build.env
artifacts:
reports:
dotenv: build.env
deploy:
stage: deploy
needs: [version]
trigger:
project: $DOWNSTREAM # group/deployer, from the dotenv report
forward:
pipeline_variables: true # and pass the dotenv variables on
As on GitLab, the dotenv variables themselves reach the downstream pipeline only with forward: pipeline_variables: true. Each value is expanded in the trigger job’s context first, like a forwarded YAML variable.
The forwarded variables are the downstream pipeline’s own pipeline variables, as on GitLab, so they outrank its global and job variables: and the instance, group and project CI/CD variables, in its rules: and in its jobs’ environment. A child whose .gitlab-ci.yml sets DEPLOY_ENV: dev as a default runs with prod when the trigger job sets DEPLOY_ENV: prod. Of glci’s own layers, only .glci.env reaches a downstream pipeline directly, above the forwarded values. --env, --env-file and a preset’s env: reach it only when forward: pipeline_variables passes them on, as forwarded variables, as the variables a pipeline was run with do on GitLab; the child’s rules: and its jobs see the same values either way. A forwarded CI_PIPELINE_SOURCE or CI_PARENT_PIPELINE_ID is dropped, a deliberate difference from GitLab: glci sets CI_PIPELINE_SOURCE for the downstream pipeline and does not let a forwarded value relabel it, and CI_PARENT_PIPELINE_ID is glci’s own variable, which GitLab does not set.
Forwarded yaml_variables values are expanded in the context of the trigger job (the upstream pipeline) before being forwarded, so a value like SERVICE_PROJECT_URL: $CI_PROJECT_URL resolves to the parent project’s URL — matching GitLab. Use $$ to pass a literal dollar sign. If an expanded value references a masked variable, the forwarded copy stays masked.
Trigger inputs: are not forwarded as variables — like GitLab, they are used only for spec:inputs interpolation of the included config. An input the included file does not declare fails the child pipeline with unknown input arguments: <names>, as on GitLab, and so do inputs for a file with no spec: header.
Dynamic child pipelines (trigger: include: artifact:)#
A child pipeline can be generated at runtime by a job and passed to the trigger as an artifact, matching GitLab’s dynamic child pipelines. A generator job writes the child pipeline YAML to a file and exposes it as an artifact; the trigger job references it with artifact: and job::
generate-child-pipeline:
stage: generate
script:
- ./scripts/generate.sh > generated-pipeline.yml
artifacts:
paths:
- generated-pipeline.yml
trigger-child-pipeline:
stage: trigger
needs:
- job: generate-child-pipeline
artifacts: true
trigger:
include:
- artifact: generated-pipeline.yml
job: generate-child-pipeline
strategy: depend
glci resolves the artifact from the generator job’s output and runs it as the child pipeline, with full support for strategy: depend, variable forwarding, and per-include inputs: — the same as a static local: include. Notes:
- The generator job must run before the trigger job. Like GitLab, glci resolves it by name within the same pipeline, so put it in an earlier stage (as above) or add
needs:. If it hasn’t produced the artifact yet, the trigger job fails withartifact include "…": job "…" produced no artifacts, and a failed downstream pipeline (config_error) carrying that error is recorded and linked from the trigger job. - The
artifact:path is resolved inside the generator job’s artifact archive (the same path you listed underartifacts:paths:); nested paths likedir/child.ymlwork. artifact:requires ajob:; omitting it fails the trigger job (GitLab refuses it in the parent’s own config), and no downstream pipeline is recorded.- An
artifact:entry’srules:are decided before its artifact is read, as GitLab decides every include entry’s rules before it fetches the file, with the child’s variables and its parent’s diff. An entry its rules leave out never needs its artifact, so a generator that did not run is no error for it. An entry whose rules glci cannot decide is kept, with a warning in the trigger job’s log, and left out, with another warning, when its artifact is missing. glci run --simulatepasses a trigger job with a keptartifact:entry without spawning a child, since the generator’s output is simulated. A trigger whoserules:leave out everyartifact:entry simulates its child normally.- An empty artifact file, or one larger than 5 MiB, is rejected with a clear error.
- Artifact-sourced includes can be mixed with plain
local:includes (still up to 3 files total); a fourth entry fails the trigger job without recording a downstream pipeline. - The generated YAML is read straight from the artifact archive into memory. glci never writes it into your working tree, so a concurrent
glci run --dirtyin the same repository does not pick it up as an uncommitted change.
Cross-project pipelines (trigger: project:)#
Cross-project triggers (trigger: project:) work the same as production GitLab CI, but glci needs to know where the target project’s source code lives locally. A target config GitLab rejects outright fails the trigger job exactly as a child’s does, described under Child pipelines above; lint it with glci lint -f pointed at the target’s CI file.
Mapping projects to local directories#
Use --project-dir to map a project path to a local checkout:
glci run --project-dir group/other-project=../other-project
Or configure the mapping permanently in .glciconfig.toml:
[projects."group/other-project"]
dir = "../other-project"
branch = "main" # optional: override which branch to use
ci_config_path = "ci/pipeline.yml" # optional: see below
Relative paths in dir are resolved against the parent project’s working directory. The target directory must be a git repository. Its jobs run on the commit the checkout has, whichever branch that is on; when the trigger’s branch: or the entry’s branch names another one, the repository served to them also carries that branch at that commit, so git clone --branch and git fetch origin "$CI_COMMIT_BRANCH" in the target’s jobs find it (see Context simulation). ci_config_path names the target’s CI configuration file; see Where the target’s configuration is read from.
Resolution order#
When glci encounters a trigger: project: job, it resolves the target in this order:
- CLI
--project-dirmapping – highest priority - Config
[projects]section in.glciconfig.tomlor~/.glci/config.toml, when the entry has adir(a key set at project level overrides the same key set globally) - Git clone from GitLab – if a token is available, glci clones the target project as a bare repo (works for public repos without a token)
- Error with instructions – if none of the above succeed, glci prints a message showing how to configure the mapping
Submodules in a triggered target#
The target’s own git submodules are served from the mock, read from
the commit the target is running and resolved against the target’s project path — ../submod
next to mygroup/target is mygroup/submod, not a sibling of the triggering project. A target
resolved by cloning has no checkout to take objects from, so map its submodules with
--project-dir when they cannot be cloned from your GitLab instance.
Includes in a cloned target#
A target resolved by cloning from GitLab has no local checkout, so glci extracts the target’s CI configuration out of the bare repo into a private directory and parses it there. The whole tree of .yml/.yaml files is extracted, not just .gitlab-ci.yml, so the target’s own include: local: entries resolve from its repository root the way GitLab resolves them:
# .gitlab-ci.yml in the target project
include:
- local: ci/build.yml # resolves — ci/build.yml is extracted too
Only YAML is extracted, because that is the only thing an include: can name (GitLab rejects an include whose path has any other extension). Two consequences:
rules: exists:in a cloned target is evaluated against that extracted tree, so it only ever sees the target’s YAML files. Map the project locally (--project-dir, or[projects]) when a target’s job selection depends on non-YAML files.- A target with more than 64 MiB of YAML is refused with a message pointing at
--project-dir. Extraction runs per cross-project trigger job, and a repository that large belongs on disk rather than in a temp directory.
The target’s own .gitattributes is not applied: export-ignore hides files from git archive, but GitLab reads includes straight out of the repository, so glci does too.
Where the target’s configuration is read from#
GitLab reads a triggered project’s pipeline from that project’s CI/CD configuration file setting (ci_config_path), and glci reads it from the same place. The setting takes the forms GitLab accepts:
ci_config_path | Read from |
|---|---|
| empty | .gitlab-ci.yml at the target’s repository root |
ci/pipeline.yml | that file in the target’s repository. Its include: local: entries still resolve from the repository root |
ci/pipeline.yml@group/templates | that file in another project, on its default branch, fetched the way include: project: fetches it. That needs a token: without one the include is skipped with skipping project include, and the trigger job fails because the downstream pipeline has no jobs |
ci/pipeline.yml@group/templates:v1.2 | the same, at ref v1.2 |
https://example.com/pipeline.yml | that URL, fetched the way include: remote: fetches it |
The trigger’s inputs: reach the file’s spec: inputs: whichever form it takes. An input the file does not declare, or any input for a file with no spec: header, fails the trigger job with GitLab’s message. For a file in the target’s repository it names the file: `ci/pipeline.yml`: unknown input arguments: <names>. The downstream pipeline’s CI_CONFIG_PATH is the setting’s value, or .gitlab-ci.yml when it is empty.
glci finds the setting in this order:
ci_config_pathin the target’s[projects]entry, used as is. This is how to describe a target offline:[projects."my-group/service"] dir = "../service" ci_config_path = "ci/pipeline.yml"The entry needs no
dir: without one it maps no checkout, and the target is cloned from GitLab as usual, with thisci_config_path(and anybranch). A project.glciconfig.tomlthat sets onlyci_config_pathfor a target keeps thediryour global config maps it to, since[projects]entries merge key by key.The GitLab projects API (
GET /projects/:id), asked when a token is configured or when glci cloned the target from GitLab (a public project answers without a token). A locally mapped target with no token is not looked up, so an offline run stays offline. A CI job token is never presented, since GitLab does not accept one there. Each target is looked up once per run, however many trigger jobs name it, and a lookup gives up after 10 seconds..gitlab-ci.ymlotherwise. A failed lookup (the project is not on the instance, the API is unreachable, or the token cannot read the project’s code, so GitLab leavesci_config_pathout of its answer) also lands here, with awarning: looking up the ci_config_path of …line in the trigger job’s log. Stopping the pipeline during the lookup stops the trigger job instead.
A value GitLab would refuse to store fails the trigger job: one with a leading / or a .. anywhere, one longer than 255 characters, or a repository path that does not end in .yml/.yaml. So does a repository path that does not exist (target project has no ci/pipeline.yml in its repository (its ci_config_path)), and one reached through a symbolic link in a local checkout, even a link that stays inside it: GitLab reads the file as an include: local:, which never follows a link (see Where include paths resolve from). That includes a symlinked .gitlab-ci.yml.
What requires a GitLab token#
| Feature | Token required | Works offline |
|---|---|---|
trigger: include: (child pipeline) | No – unless a trigger: include: entry or the child’s own config uses project:/component: | Yes – unless an entry is project:, component:, remote: or template:, which are fetched over the network |
trigger: project: with --project-dir | No | Yes |
trigger: project: with [projects] config | No | Yes |
trigger: project: (auto-clone from GitLab) | Yes (or public repo) | No |
A target’s ci_config_path read from the projects API | Yes, for a locally mapped target (a cloned public one needs none) | No – set it in [projects] instead |
A target’s ci_config_path naming file@another/project | Yes | No |
A trigger: project: target’s group and project CI/CD variables | Yes (Maintainer on the target for its project variables) | No – the target runs without them |
include: project: in YAML | Yes | No |
include: component: in YAML | Yes | No |
include: local: in YAML | No | Yes |
include: remote: (HTTP URL) | No | Needs network |
include: template: | No | Needs network |
Cross-project variables#
Cross-project pipelines get fresh CI variables derived from the target project’s git state rather than inheriting the parent’s. This means CI_PROJECT_NAME, CI_COMMIT_SHA, CI_COMMIT_REF_NAME, and other git-derived variables reflect the target project.
The target pipeline receives CI_PIPELINE_SOURCE=pipeline (distinct from child pipelines which use parent_pipeline), and CI_CONFIG_PATH set to the target’s own ci_config_path (.gitlab-ci.yml by default).
The target’s include rules and the $VAR references in its include: entries see the same predefined variables as its jobs: the target’s branch (CI_COMMIT_REF_NAME, CI_COMMIT_BRANCH), its CI_PROJECT_*, its CI_CONFIG_PATH, CI_PIPELINE_SOURCE=pipeline, and no CI_MERGE_REQUEST_*, since GitLab creates the pipeline with no merge request. An include gated on $CI_COMMIT_BRANCH == "main" in the target is decided on the target’s branch, not the upstream pipeline’s.
A multi-project pipeline has no diff, as on GitLab, which creates it with no before_sha and no merge request, so a rules: changes: without compare_to: matches. A changes: compare_to: is still evaluated, against the target’s own tree: its working tree when it is a local checkout under --dirty, else its HEAD. Both hold for the target’s include rules and its job rules alike.
The cross-project pipeline also gets CI_REGISTRY, CI_REGISTRY_USER, and CI_REGISTRY_IMAGE pointing at the shared embedded registry, so jobs in the triggered project can build and push images just like the parent. CI_REGISTRY_IMAGE reflects the target project’s path. CI_REGISTRY_PASSWORD is injected per job (the job token), the same way it works in the parent pipeline.
CI/CD variables of the target project#
GitLab creates a multi-project pipeline in the target project, so its group and project CI/CD variables are the target’s, not the parent’s. glci fetches them for the target the way glci run fetches the parent’s (see Remote secrets): with the same token, for the scopes --secrets selects (all: the target’s groups and project, project: its project only, none: nothing), through the same daemon cache, keyed by the target’s path, and --refresh-secrets bypasses the cache here too. The target’s jobs, its workflow: and job rules:, and its include: entries and include rules all see these. The instance variables are the same for every project, so the target keeps the run’s.
The parent project’s group and project variables never reach the target’s jobs. If the token cannot read the target’s project variables (GitLab answers 403, since reading them takes the Maintainer role there), GitLab answers 404 for the target, or the fetch fails, the target runs without them. The trigger job’s log says so with a warning: line, and the run shows a target_variables_unread warning (on stderr, in the TUI, and as a warning event under --json). A group whose variables the token cannot read is skipped silently, as it is for the run’s own project. glci never falls back to the parent’s variables. The target’s masked values stay masked in its jobs’ logs and are redacted from the trigger job’s log and its failure messages.
Variable forwarding uses the same forward: rules and defaults as child pipelines (see Variable forwarding above): yaml_variables (default true) forwards the parent’s global variables: the trigger job inherits merged with its own variables:; pipeline_variables (default false) forwards the trigger job’s dotenv imports and the --env/--env-file/preset env: variables (and a child’s own forwarded set). The target’s own include: entries expand against that forwarded set too, exactly as a child pipeline’s do (see Variables in a child’s include paths). Forwarded values are expanded in the trigger job’s context ($CI_PROJECT_URL resolves to the parent project’s URL, not the target’s), and trigger inputs: are used only for spec interpolation, not forwarded as variables.
Dirty mode for cross-project targets#
When dirty mode is enabled (the default), glci overlays uncommitted and untracked files from local project directories onto the bare repo sent to the runner. This lets you test changes across multiple projects without committing first.
Each target’s files are committed with that target’s own Git configuration, as described in Dirty mode: its ignore rules, clean filters and line-ending settings, not the parent project’s. If the overlay fails for a target (for example, git add in the target would refuse a file), that target runs its committed code. glci warns when the trigger job runs, as it does for your own project, naming the target and the trigger job:
glci: warning: --dirty overlay failed for cross-project "group/project" (trigger job "deploy"), so its pipeline uses the committed tree without the uncommitted changes: <reason>
The line goes to glci run’s stderr (again under the summary), the TUI, glci log <id>, the trigger job’s log and glci daemon logs. In --json it is a warning event whose job_name is the trigger job. glci run --detached and glci retry return before the trigger job runs, so follow the run with glci log <id> to see it.
Multi-project setups#
For monorepos, standard child pipelines with different include paths work as expected. You can run a specific trigger job with glci run trigger-frontend.
For separate repositories that form a pipeline chain, map them all in .glciconfig.toml:
[projects."myorg/shared-lib"]
dir = "../shared-lib"
[projects."myorg/deploy-tools"]
dir = "../deploy-tools"
branch = "main"
include: project: in YAML#
include: project: works the same as production GitLab CI – it fetches YAML files from other projects via the GitLab Repository Files API at parse time. This always requires a GitLab token (see the token table above).
Nested includes within the fetched file that use local: are automatically rewritten to project: includes targeting the same remote project, matching GitLab’s behavior.
It applies to every config glci parses, not just the top-level .gitlab-ci.yml: a child pipeline’s config and a cross-project trigger’s target config resolve include: project: the same way, against the same GitLab instance and token. Fetched files are cached under ~/.glci/cache/includes and shared across all of them (a ref naming a complete version, such as 1.2.3, is served from the cache for as long as it keeps being used; everything else for an hour, including a partial 1.2, which names different content as new versions are published). Entries unused for 30 days are swept away automatically, and glci system prune clears the whole cache.
include: component: in YAML#
include: component: fetches CI/CD components from GitLab via the API at parse time. This always requires a GitLab token.
Version selectors#
Components are referenced with a version suffix after @. Besides an exact reference, GitLab recognises two selector shapes:
include:
- component: gitlab.com/mygroup/myproject/mycomp@2.3
| Selector | Example | Resolves to |
|---|---|---|
@~latest | gitlab.com/mygroup/myproject/mycomp@~latest | Newest published semver version |
@N | gitlab.com/mygroup/myproject/mycomp@2 | Newest published 2.*.* (e.g. 2.5.1) |
@N.M | gitlab.com/mygroup/myproject/mycomp@2.3 | Newest published 2.3.* (e.g. 2.3.7) |
| anything else | …/mycomp@1.2.3, @main, @0f1e2d3 | That tag, branch or commit, read literally |
As on GitLab, the address splits at the first @: everything after it is the reference, so …/mycomp@v1@rc uses ref v1@rc, and an @ earlier in the path ends the path there, so the address no longer names the intended component.
Candidates come from published releases, so an unreleased tag is never selected. Pre-releases (e.g. 1.0.0-rc1) are excluded, and a published version always wins over a tag or branch of the same name.
A partial version that matches no published release is still tried as a literal tag or branch name, matching GitLab’s fallback — so a project whose 2.3 line has nothing published but does carry a 2.3 tag still resolves @2.3 to that tag.
@~N and @~N.M are not valid. ~latest is the only selector GitLab spells with a tilde; earlier glci versions resolved @~2, which GitLab rejects with content not found. Drop the tilde and use @2.
Resolution queries the GitLab Releases API, so a selector needs a token and network access. An exact reference also needs a token but skips that lookup.
One divergence to know about: glci reads the project’s published releases, while GitLab reads the versions published to the CI/CD Catalog. Not every release becomes a catalog version — GitLab checks each release’s commit for a README.md and at least one discoverable component, and requires the project to have a description — and a project that has releases but was never published as a catalog resource has no catalog versions at all. In each of those cases glci resolves a selector that GitLab refuses, so a selector working locally is not proof the component is consumable on GitLab. Pin an exact version when the component project is not a published catalog resource.
$[[ component.* ]]#
A component can read the component it belongs to through four expressions, the ones GitLab defines:
| Expression | Value |
|---|---|
$[[ component.name ]] | The component’s name, the path after the project: mycomp for …/myproject/mycomp@1.2.3. |
$[[ component.reference ]] | The reference exactly as written after @: ~latest stays ~latest. |
$[[ component.version ]] | The published version the reference selects: what @~latest or @1 resolved to, or the reference itself when a release is published at exactly that tag. Empty for a branch, a SHA or an unreleased tag, as on GitLab, where it is null. |
$[[ component.sha ]] | The commit the component’s files were read at. |
The common use is pinning a nested include to the parent’s own release:
spec:
component:
- version
---
include:
- component: gitlab.com/mygroup/myproject/child@$[[ component.version ]]
glci substitutes these exactly as GitLab does, with the same two conditions:
- The component has to opt in. A value only exists when the file’s
spec:header lists its key undercomponent:, and that header has to be the first document of a multi-document file (the---above is part of the requirement). A file with no header is not interpolated at all, on GitLab or here: the literal string travels on as a git ref, and the include it pins fails as a missing file (glci reports the fetch, e.g.HTTP 404). A file with a header whosecomponent:list omits the key is a hard error instead,unknown interpolation provided, because the header decides what the expression may read. So is a key GitLab does not define, such ascomponent.project. referenceis the reference as written,versionis what it resolved to. A component included at@~latestinterpolatesreferenceas~latest, so a child pinned with it resolves against its own published versions, not the parent’s.versiongives the parent’s resolved release instead, which is usually what a pin wants.
Two more details follow from GitLab’s implementation. The expressions are only substituted in the body, so one written inside the spec: header keeps its literal text. And a component’s nested local: includes inherit its context, while a nested project:, remote: or template: include does not: those files have no component context. Nor does a .gitlab-ci.yml, which is not part of any component. A file with no context that opts in anyway fails with unknown interpolation provided, rather than passing a placeholder to the API as a ref and reporting a missing file at a nonsense reference.
name and reference come straight from the address. version and sha each cost an API call (the Releases API, and the Commits API), made once per component and reference in a parse, and only when one of its files reads the key. If that call fails, the parse fails with the reason, rather than substituting a value that might be wrong. The one exception is a Releases API that refuses the token (HTTP 401 or 403, for example with releases disabled on the project): GitLab needs no such permission to read a catalog version, so glci substitutes an empty version and prints a warning instead. version reads published releases where GitLab reads CI/CD Catalog versions, the same divergence described for selectors above: on a project with releases that is not a catalog resource, glci reports a version GitLab leaves empty.
Troubleshooting#
If a trigger job fails, check the daemon logs for resolution and parsing errors:
glci log <pipeline-id> trigger-job-name
tail -f ~/.glci/daemon.log