LUCIRUNSINBOXREPORTSDOCSPUBLIC CI

WORKFLOW MANUAL

Luci KDL

Pick an image, say what to run, then decide which pushes should run it again.

1. Run your first job

Save this as .ci/hello.kdl, commit it, then push to trunk in a public repository watched by Luci.

.ci/hello.kdl

job hello {
  image {
    pull "docker.io/library/alpine:3.22"
  }
  trigger {
    push {
      branch trunk
    }
  }
  run "mkdir -p out" description="Prepare the output directory"
  run "cd out"
  run "export MESSAGE=hello"
  run """
    echo "$MESSAGE from $PWD"
    test "$PWD" = /work/out
    """
}

Follow the run for your commit and look for hello from /work/out in the log. Luci reads only direct .ci/*.kdl files at the selected commit, and job names must be unique across them.

One shell, separate log steps

Each child starts at /work, a fresh shallow checkout pinned to the commit, with no Git remote configured for ordinary jobs. All run nodes execute in order in the same /bin/sh, so cd, shell variables, and exports persist within that child, not between jobs.

An optional description labels the step in the timing table and log without changing the command. Use nonblank single-line text without control or format characters. Descriptions are literal: no shell or matrix expansion. The full command remains in the raw log, subject to the same best-effort masking as other log output. Do not put secrets in commands or descriptions: repository configuration is public.

Logs show each step's command and elapsed time. A nonzero step status stops the job; use && or explicit checks so a later successful command doesn't hide an earlier failure in a multiline step. An early exit ends the shell itself and can bypass the step's closing marker. Children run sequentially; the first failed child fails the run and skips the rest.

2. Choose when it runs

Push
push accepts repeated branch, tag, include, and exclude globs. With only branch, tags don't match; with only tag, branches don't match; with neither, both can match. Path globs are repo-root relative; ** crosses directories.
Path filters
With filters, at least one changed path must pass: any include (or no includes), and no exclude. The job's own KDL file and its resolved Containerfile also count as included paths, but only for an existing push block, on a matching branch or tag, and never through an exclude. Unfiltered pushes only need a matching ref; new refs count the entire new tree as changed.
Schedule
Add one schedule "0 3 * * 1" in trigger for Mondays at 03:00 UTC, independent of push filters. Five-field cron uses the default branch, doesn't catch up after downtime, and runs at most once per 15 minutes per job. Ticks coalesce while the job is queued or running.
Manual
Omit trigger for manual-only jobs. Current repo writers can submit with ci run REPO JOB --ref trunk over Luci SSH, or use --rev COMMIT instead. Manual runs ignore triggers and pin the requested ref or revision before queueing. An empty push run means no job matched, not that tests passed.

3. Share a recipe, not a cache

This example runs a small check in two Alpine versions and warms a workspace directory. Save it as .ci/versions.kdl and add any text file named demo.lock at the repo root.

.ci/versions.kdl

job versions {
  image ref=alpine
  trigger ref=demo-push
  cache ref=demo
  matrix {
    version "3.21" "3.22"
  }
  run "echo Alpine $CI_MATRIX_VERSION"
  run "mkdir -p .demo-cache"
  run """
    cmp -s demo.lock .demo-cache/input ||
      cp demo.lock .demo-cache/input
    """
}

image alpine {
  pull "docker.io/library/alpine:${version}"
}
trigger demo-push {
  push {
    branch trunk
    include demo.lock
  }
}
cache demo {
  path .demo-cache
  key {
    file demo.lock
  }
}

Named image, cache, and trigger declarations live at the top level of the same file as their users. Define them before or after the jobs. A reference takes only ref=name: no positional args, children, or overrides; an unknown name is an error.

A cache name reuses configuration, not data across jobs. Entries are scoped by repository, job name, and cache name, so matrix children of a job share that namespace. Luci computes a SHA-256 key from the listed file paths and contents, including whether each file is missing. Before commands it restores the exact version, otherwise the newest saved version in that cache, otherwise nothing. It saves after successful commands; keep cache contents safe to reuse and let your tools validate them on a fallback.

4. Bring your own image

Use build instead of pull when the image needs tools installed ahead of time. Pair this job with .ci/Containerfile containing FROM docker.io/library/alpine:3.22 and, on the next line, RUN apk add --no-cache jq.

.ci/report.kdl

job report {
  image {
    build {
      containerfile ".ci/Containerfile"
    }
  }
  trigger {
    push {
      branch trunk
      include "src/**"
    }
  }
  run "jq -n '1 + 1' > report.json"
  artifact report {
    path report.json
    required #true
  }
}

Both containerfile and context are relative to the repo root. Omit context to use the Containerfile's parent; set context "." for the repo root. Luci honors .containerignore in the context and excludes Git metadata.

Podman builds rootlessly, but Containerfile steps can run as root inside the build and download packages. The job runs unprivileged in the resulting image. Builds get no job environment, credentials, mounts, Podman socket, or host network. The job also gets no Podman socket; building its execution image doesn't publish it. Base tags refresh on new builds, but a cached RUN won't rerun just because upstream packages changed.

Reference

File & job

Luci uses KDL v2: bare strings such as trunk and quoted strings such as "src/**" both work. Use double quotes for spaces or special characters, triple double quotes for a multiline string with its closing delimiter on a line of its own, and // for a line comment. Unknown nodes are errors; expressions, job dependencies, services, arbitrary host mounts, and general-purpose env blocks aren't supported.

job NAME
One image source plus one or more run "COMMAND" nodes, or the agent form below.
image
Exactly one pull "IMAGE" or build with containerfile PATH and optional context PATH, or a file-local reference. Legacy image "IMAGE" and job-level build still work; don't combine image sources.
trigger
At most one push and one schedule "CRON", or a file-local reference. See matching rules.
matrix
Declare each axis as a node with one or more values. Luci runs every combination, up to 64 children. ${axis} substitutes in image names, build paths, commands, cache paths and key files, and publish fields; children get CI_MATRIX_<UPPERCASE_AXIS>.
cache NAME
One workspace-relative path and one key block with one or more workspace-relative file inputs, or use cache ref=NAME instead.
Environment
Luci sets CI_REPO, CI_JOB, CI_REF, CI_REV, CI_TRIGGER, CI_RUN_ID, and CI_CHILD_ID. Use shell export for your own values; the image needs /bin/sh and date for step timing.

Credentials & output

Ordinary job code has network access; repos, logs, and artifacts are public. Masking is best-effort: never print credentials or put them in caches, artifacts, or published files. SSH submissions cannot run jobs declaring secrets, auth mounts, or publishing.

secret NAME env="VAR" or secret NAME file="PATH"
Ask the operator to provision the named value for the repo and job. Use exactly one target: an environment variable or a read-only workspace-relative file. Missing values fail before commands.
mount TYPE NAME TARGET
TARGET is an absolute guest path. cache is a persistent read-write directory, not a keyed snapshot. auth is a persistent read-write directory provisioned by the operator. Both are scoped to repo, job, and name and locked during use.
artifact NAME
One or more workspace-relative path entries. Add required #true to insist on output or after-failure #true to also collect it on failure. Artifacts are immutable public downloads; symlinks and overlaps with credential paths are rejected. Limits per child: 100 files, 10 MiB per file, 50 MiB total.
publish ADAPTER
After successful commands and cache saves, send workspace-relative from to to. pkg and site replace the destination within an operator-configured root. registry takes a freshly generated OCI archive at from and a registry image reference at to, not an image child. Keep the archive outside caches and artifacts. Success logs the exact published digest; publishing isn't deployment. Use ${rev} in publish fields for the full commit ID, or distinct matrix destinations to avoid replacing another child's output.

Reports and actions

Repo code decides what matters and writes ordinary JSON; KDL chooses what readers see.

.ci/size.kdl

job size {
  image "alpine:3.22"
  run "sh .ci/measure.sh > size.json"
  report bundle {
    source size.json
    fact bytes title="Bundle size" type=size
    inbox budget fresh-for="24h"
  }
}

For a bundle within budget, .ci/measure.sh might emit {"bytes":2048,"budget":{"completeness":"complete","items":[]}}. An eligible complete assessment resolves omitted actions; partial preserves them. Missing, malformed or oversized output is not an all-clear.

Use text, code, HTTP(S) link, scalar fact, table, or artifact sections. Bind an exact JSON key with field, independent of display title. Table columns default to the exact column argument; null requires nullable=#true, missing fields always fail. Declare an artifact set separately before referring to its files. Never put credentials in reports.

Limits: 1 MiB input and projected values per report, 16 JSON levels, 256 entries per collection, 16 KiB strings, 8 reports per job, 32 sections and 8 inboxes per report, 32 columns per table. See machine reference for action fields, scalar types and file safety limits.

Manual agent jobs

Save this as .ci/inspect.kdl and put List the top-level files without changing them. in .ci/inspect.md. Use a model available through your enrolled provider connection; the ID below is an example. Submit it like any other manual job.

.ci/inspect.kdl

job inspect {
  image {
    pull "docker.io/library/alpine:3.22"
  }
  agent ".ci/inspect.md"
  model "bugabinga/MiniMax-M2.7"
  request-cap 8
}

An agent job accepts only an image source, one agent prompt, one model "virtual/upstream-ID", optional skill nodes (up to eight repo-relative SKILL.md files), and an optional positive integer request-cap for the lifetime request budget. The prompt is a nonblank UTF-8 Markdown file at the pinned revision, up to 64 KiB.

Current repo writers submit over SSH, with optional private input via --input on stdin. Luci uses the selected enrolled payer connection, with no fallback. Commands run in a networked rootless guest without host credentials; if configured, a short-lived Git credential grants access to the run's repository, so don't assume a prompt makes Git read-only. Agent input and session records aren't public run logs; authorized writers can export them over SSH. See llms.txt for enrollment, model discovery, and SSH commands.

Copy value