Running Pipelines

glci run executes CI jobs locally via a background daemon that survives terminal disconnection.

Basic usage#

glci run                     # run everything
glci run lint test           # run specific jobs
glci run --stage build       # run all jobs in a stage
glci run -d build-job        # detached: start in background, exit immediately

In a terminal, glci run shows a live pipeline graph; press Enter on a job to open its log. The graph pane supports / job-name search (see Searching the pipeline graph) and the log view supports follow mode, w line wrap, ←→ panning, plus / search with n/N match navigation (see Log view keys).

Job selection#

# Glob patterns (only * is a metacharacter)
glci run 'qa:*'              # all qa: jobs
glci run 'static-analysis *' # all static-analysis shards
glci run rubocop 'lint-*'    # mix exact and glob

Skipping and manual jobs#

glci run --skip slow-integration    # skip a job (treated as success)
glci run --no-skip deploy-canary    # force-run a normally-skipped job
glci run --no-skip-all              # disable ALL skip rules
glci run --manual deploy-staging    # auto-run a specific manual job
glci run --manual-all               # auto-run ALL manual jobs
glci run --no-manual                # disable manual auto-run

Naming a manual job selects it but does not play it: glci run deploy-staging plans the job and leaves it manual. Add --manual (or --manual-all, or list it under [manual] jobs in .glciconfig.toml) to run it: glci run deploy-staging --manual deploy-staging.

A manual job can be played from the TUI as soon as glci has started its pipeline, including while the pipeline is still starting: the play is accepted and the job runs once its prerequisites allow, as GitLab accepts a play as soon as the pipeline exists.

A play that glci cannot honour is refused with an error naming why, rather than accepted and then silently skipped (a play accepted before a cancel is canceled with the pipeline, see below):

The TUI shows the reason under the pipeline title for a few seconds and keeps following the run, which a refused play leaves as it was (see Interactive TUI).

GitLab accepts a play on a canceled or finished pipeline and runs the job in it. A local run has already ended by then, so to run the job, start it again with glci run --manual <job>. A job played before you cancel the pipeline, and not yet started, is reported skipped, like every other job the canceled pipeline had not started (GitLab reports them canceled).

A manual job you do not play stays manual. Whether it holds back the rest of the pipeline depends on its allow_failure, as on GitLab:

To make a job manual locally, or a manual job automatic, without editing .gitlab-ci.yml, set when (and, if needed, allow_failure) in a .glciconfig.toml job section. The override is applied before planning, so it schedules the job exactly as the same keyword in the YAML would.

A DAG job that lists a non-blocking manual job in its needs: does not wait for it. As on GitLab, an unplayed non-blocking manual job counts as skipped for the jobs that need it, so each is decided at once, even while its other needs still run: a when: always dependent runs, and any other, a manual one included, is skipped. Playing the manual job from the TUI while the run is still going (the run ends, and refuses later plays, once nothing is running and nothing else can start) brings back the jobs skipped because of it, as GitLab does: they wait for it and are decided again once it finishes. A blocking manual need is waited for. If it is never played, a dependent that is not itself manual is skipped once nothing else can run, and a manual one stays manual. A manual job behind a failure is skipped rather than left manual: one with a failed job in an earlier stage, or a DAG job with a need that failed or was skipped. It can no longer be played and no longer holds later stages, so a later when: always job still runs. A failure that is not behind the manual job, for example one in its own stage, leaves it playable.

Waiting on an unplayed manual job never fails a pipeline, but waiting on a job that can never run does. When nothing is running and nothing else can start, glci looks at each job still waiting. A job waiting on a needs: entry whose target is not in the pipeline is stalled, and so is any job (manual jobs included) waiting on a stalled one, through needs: or an earlier stage. A need without optional: true on a job that rules: left out never gets this far: GitLab refuses to create that pipeline, and glci refuses to start it, with GitLab’s message (see A job needs a job that “does not exist in the pipeline”). What is left is rarer, such as a target in a stage that stages: does not list. glci still runs the jobs that can run, then reports each stalled job as failed and fails the pipeline, so the run exits 1. The job’s trace says why, for example ERROR: job "test" can never run: it needs "compile", which is not in the pipeline, and the reason is also logged by the daemon and summed up in pipeline_done’s error (see Structured output), which the TUI shows. A trigger job whose downstream pipeline stalls fails too, whatever its strategy:. A pipeline resumed after a crash is judged the same way. See Pipeline fails with “pipeline cannot finish”.

Skip rules can be configured permanently in .glciconfig.toml:

[skip]
jobs = ["slow-integration"]
job_patterns = [".*windows.*"]
stages = ["deploy"]

Dirty mode#

By default, uncommitted and untracked files are included in the pipeline. Use --no-dirty to only use committed code.

The changes count for rules: changes: too: the run’s diff goes to the commit the overlay makes, so an edited or new file matches a changes: rule as it would once committed and pushed (see The changes diff).

glci commits each changed file the way git add in your project would, using your repository’s own Git configuration:

glci writes nothing to your index, and no Git objects or refs to your repository. Clean filters run in your repository as they do for git add, so they can write state of their own there: Git LFS, for example, keeps the file in .git/lfs/objects. What the jobs receive for an LFS-tracked file is its pointer: glci serves no LFS content, for committed files or dirty ones.

If the overlay fails, the run uses your committed code instead, and glci tells you why. Causes include git add refusing a file (for example, core.safecrlf stopping an irreversible line-ending conversion), a required clean filter whose program the daemon cannot find, and a detached HEAD that no branch points at. The warning says what runs, then the reason, on one line:

glci: warning: --dirty overlay failed, so the run uses the committed tree without your uncommitted changes: <reason>

The job and workflow rules: changes: of such a run compare against HEAD, the tree it runs. Its include: rules were decided while the overlay was being built, against the working tree.

See --dirty overlay failed for the fixes.

Simulation mode#

Replace all scripts with echo commands. Produces dummy artifacts so you can validate pipeline structure and artifact flow in seconds:

glci run --simulate

Artifact reuse#

Skip upstream jobs when their artifacts exist from a prior run – useful for iterating on a single failing job:

glci run --reuse-artifacts test-job

Cross-project triggers#

Map trigger: project: targets to local directories:

glci run --project-dir group/other-project=../other-project

Or in .glciconfig.toml:

[projects."group/other-project"]
dir = "../other-project"
branch = "main"

Watch mode#

glci run --watch automatically re-runs the pipeline when source files change. The watcher monitors the entire project directory, respects .gitignore patterns, and debounces rapid edits.

glci run --watch                          # re-run full pipeline on changes
glci run --watch test-job                 # re-run specific job on changes
glci run --watch --debounce 1s            # custom debounce interval
glci run --watch --on-change 'make lint'  # run a hook before re-running

The --on-change flag runs a shell command each time changes are detected, before the pipeline re-executes. The command receives GLCI_CHANGED_FILES in its environment (newline-separated list of changed paths).

--on-change-mode controls how that command runs:

# Regenerate Pages on every change while keeping a preview server alive
glci run --watch pages --on-change 'glci pages serve' --on-change-mode restart

Watch mode is also available on glci show, glci lint, glci jobs, and glci merged:

glci show --watch                 # live pipeline visualization
glci lint --watch                 # continuous validation
glci jobs --watch --json          # live job list as JSON
glci merged --watch               # live fully-resolved config

Concurrent runs#

If you start glci run while another pipeline is already being prepared for the same project directory, the new request automatically queues behind the in-progress preparation. The CLI and TUI display “Waiting for pipeline preparation to finish…” while queued. Up to 3 requests can queue per directory; additional requests are rejected. Press Ctrl+C to abort the wait at any time.

Tolerated failures#

allow_failure is a property of the job, not of the kind of failure — exactly as it is on GitLab. A job that is allow_failure: true may fail for any reason without sinking the pipeline: a non-zero script exit, a job timeout (which is also how glci surfaces a runner that never picked the job up), or a runner that went silent mid-job. Jobs that are allow_failure: true, declared or implied by a job-level when: manual (see below), show the ⚠ marker in the pipeline view, and a tolerated failure leaves the run’s exit code at 0.

flaky-integration:
  allow_failure: true
  script:
    - ./flaky.sh

A job with a job-level when: manual and no allow_failure key defaults to allow_failure: true, as it does on GitLab. Played (--manual, --manual-all, a [manual] rule, or the TUI) and failed, such a job leaves the run’s exit code at 0. The default follows the job’s own when:, not the one a rule produces: a job that is manual only through rules: - when: manual defaults to allow_failure: false, and a when: manual job whose matched rule sets when: on_success runs automatically but keeps allow_failure: true. An explicit allow_failure always wins: on the job (including one inherited through extends:), on the matched rule, or in a .glciconfig.toml job section.

The mapping form is different, and matches GitLab: allow_failure:exit_codes tolerates a job only when it reported one of the listed exit codes. A job that failed without reporting one — a timeout, or a runner system failure — is never tolerated by an exit_codes list, and allow_failure: {} with no exit codes tolerates nothing at all.

tolerate-137:
  # Tolerated only when the script itself exits 137.
  allow_failure:
    exit_codes:
      - 137
  script:
    - ./maybe-oom.sh

As on GitLab, rules:allow_failure replaces the job-level keyword outright, including any exit_codes list it declared. The same goes for an allow_failure override in a .glciconfig.toml job section.

The value must have the right type, or the pipeline is refused, as on GitLab. glci lint exits non-zero and glci run will not start. A job’s allow_failure takes a boolean or the exit_codes mapping (jobs:<name> allow failure should be a hash or a boolean value). A trigger job’s takes a boolean only (jobs:<name> allow failure should be a boolean value). So does a rule’s allow_failure or interruptible on a job, a trigger job or workflow: (jobs:<name>:rules:rule allow failure should be a boolean value). A wrong-typed value is never read as false, so it cannot quietly override the job’s own setting. As on GitLab, yes, no, on, off, true and false are booleans only written plain or tagged !!bool, in any letter case (Yes, oFF), not quoted and not a | or > block: allow_failure: yes is true, while allow_failure: "yes" (or !!str yes) is a string and refused like any other.

The effective value — the one the pipeline’s verdict used — is what a terminal job_status event carries under --json, and what decides whether the JUnit report records the job as skipped. See Structured output.

Trigger jobs (trigger:, including cross-project ones) run no script and so never report an exit code: only the boolean form can tolerate them. See Cross-project pipelines.

Three failures are never tolerated, whatever the job declared:

Ctrl+C behavior#

In attached mode (the default):

Flags reference#

FlagDescription
-d, --detachedStart pipeline in background and exit
-e, --executorExecutor: docker, kubernetes (default “docker”)
-f, --filePath to CI config file (default “.gitlab-ci.yml”)
--imageDefault Docker image (default “alpine:latest”)
--stageRun only jobs in this stage
--env KEY=VALUESet variable (repeatable)
--env-fileLoad variables from env file
--secretsFetch remote variables: all, project, or none (default “all”)
--refresh-secretsForce refresh cached API variables
--git-strategySource code strategy: clone, fetch, none, remote (default “clone”)
--contextCI context: branch=NAME, merge_request, tag=NAME, env=NAME, or preset name (default: the pipeline pushing HEAD would create, usually branch=<checked-out branch>)
--mr-sourceSource branch for merge_request context; without --context or a preset context, implies merge_request
--mr-targetTarget branch for merge_request context; without --context or a preset context, implies merge_request
--input KEY=VALUESet pipeline input (repeatable)
--inputs-fileLoad pipeline inputs from YAML file
--dirtyInclude uncommitted files (default: true)
--no-dirtyDisable dirty mode
--reuse-artifactsSkip upstream deps when their artifacts exist
--simulateEcho commands without executing
--timeoutOverride job timeout (e.g. 30m, 1h)
--no-registryDisable embedded container registry
--registryCustom container registry URL
--registry-userContainer registry username
--registry-passwordContainer registry password
--push-throughMirror pushes to upstream registry
--pull-policyDocker image pull policy: always, if-not-present, never (default “if-not-present”)
--tokenGitLab private token
--gitlab-urlGitLab instance URL
--projectGitLab project path
--no-tokenDisable forwarding host GitLab token as CI_JOB_TOKEN
--skipSkip a job (treated as success; repeatable)
--no-skipForce-run a normally-skipped job (repeatable)
--no-skip-allDisable all skip rules
--manualAuto-run a manual job (repeatable)
--manual-allAuto-run ALL manual jobs
--no-manualDisable manual auto-run
--project-dirMap a project path to a local dir, for cross-project triggers and submodules (repeatable)
--plainDisable colors (also off when the output is not a terminal or NO_COLOR is set)
--jsonEmit line-delimited JSON events on stdout instead of human output
--json-logsWith --json, include job trace output as job_log events
--report FILEWrite the run’s result report to FILE when the pipeline finishes
--report-formatFormat for --report: junit (default) or json
-p, --pipelineNamed pipeline preset from .glciconfig.toml
-w, --watchRe-run on file changes
--debounceDebounce interval for watch mode (default 500ms)
--on-changeShell command to run when files change (requires –watch)
--on-change-modeHow --on-change runs: block (default) or restart (kill & relaunch in background)

Driving glci from a script, a CI job or an editor integration? Use --json and --report rather than parsing the terminal output — see Structured Output.

Esc