CEL reference
Generated by fleetlint docs; do not edit. Everything an expr rule can use.
Variables
| Variable | Contents |
|---|---|
repo | Facts: name, stacks, forge, visibility, public, container (none, devcontainer, docker, podman), tier, layout, ci, hooks, has_git, scope. |
release | {exists, mechanisms, tag_patterns, latest_tag}. |
taskrunner | {kind, targets, file, cmd, deps, recipes}: the task runner whatever its kind (make, just, task, npm-scripts, gradle, none). cmd is how a target is invoked (make, just, task, npm run, ./gradlew); deps and recipes map each target to what it depends on and the commands it runs. |
params | The rule’s params map from the catalog or the repo override. |
item | In a rule with foreach, the current element; "" otherwise. |
Functions
| Function | Returns |
|---|---|
exists(glob: string) -> bool | True if any file in the scope matches the glob (** supported). |
file(path: string) -> bool | True if the exact path exists (file or directory). (has is reserved by CEL.) |
glob(pattern: string) -> list<string> | Scope-relative paths matching the glob, sorted. |
tracked() -> list<string> | Git-tracked paths in the scope. |
text(path: string) -> string | File contents, or "" when absent. |
lines(path: string) -> list<string> | File contents split into lines. |
yaml(path: string) -> dyn | Parsed YAML document; null when absent. |
toml(path: string) -> dyn | Parsed TOML document; null when absent. |
json(path: string) -> dyn | Parsed JSON document; null when absent. Comments and trailing commas are accepted (JWCC), as in tsconfig.json. |
makefile(path: string) -> map | {targets: list<string>, deps: map<string, list<string>>, recipes: map<string, list<string>>}; null when absent. |
scan(path: string, regex: string) -> list<int> | 1-based line numbers where the regex matches. |
matchesAny(list: list<string>, regex: string) -> bool | True if any element matches the regex. |
workflows() -> list<string> | Paths of the repository’s CI files: Actions workflows (.github/workflows, .gitea/workflows, .forgejo/workflows), .gitlab-ci.yml and the local files it includes. CI lives at the repository root, so in a member scope these are the root’s files as ../ paths. |
ci_kind(path: string) -> string | The CI system of a file from workflows(): github, gitea, forgejo or gitlab. |
tagged_workflows() -> list<string> | CI files a tag push starts (on.push.tags; GitLab rules on $CI_COMMIT_TAG or only: tags), i.e. release pipelines. |
steps(path: string) -> list<map> | Every step of every job in a CI file, each as {job, name, uses, run, with} with ""/{} for absent fields. A GitLab job is one step whose run is its before_script, script and after_script. |
jobs(path: string) -> list<map> | Every job of a CI file as {name, timeout_minutes, permissions, runs_on, uses, image, interruptible}; timeout_minutes is 0 when unset (GitLab timeout: durations are converted); interruptible is GitLab’s. |
triggers(path: string) -> list<string> | Event names a CI file reacts to (push, pull_request, pull_request_target, …), whatever the on: shape; a GitLab pipeline reads as push, plus pull_request for merge request pipelines and schedule. |
includes(path: string) -> list<map> | What a GitLab CI file includes, as {type, target, ref} (type local, project, remote, template or component; ref is the project ref or component version); empty for other files. |
tags() -> list<string> | Git tags, newest version first. |
tag_signed(name: string) -> bool | True if the tag is an annotated tag carrying a PGP, SSH or X.509 signature; false for lightweight or unsigned tags. The signature is not verified. |
commits(n: int) -> list<map> | Newest n commits as {hash, author, email, subject, body, trailers, lines, root}; lines is insertions plus deletions, root is true for a commit without parents; empty without git. |
grep(glob: string, regex: string) -> list<map> | {path, line, text, match} for every line matching the regex (case-insensitive) in files matching the glob; match is the first capture group, or the whole match, unshortened; skips fenced code blocks; pairs with foreach to flag every match. |
codegrep(kind: string, regex: string) -> list<map> | {path, line, text, match} for every matching line of tracked source code; kind is code, test or nontest. Case-sensitive unless the pattern starts with (?i); vendored, generated and build paths are skipped. |
filesize(path: string) -> int | Size in bytes of a tracked or untracked file; 0 when absent. |
globmatch(pattern: string, path: string) -> bool | True if the path matches the glob (** supported). |
Standard CEL operators, macros (all, exists, filter, map, has) and string functions (contains, startsWith, endsWith, matches, size) are available. A rule’s result must be a bool; with foreach, the list expression is evaluated first and expr once per item.
Generated by fleetlint docs from catalog v0.1.0.