fleetlint Policy for a fleet of repositories
v0.11 (latest)
Getting started

CEL reference

Generated by fleetlint docs; do not edit. Everything an expr rule can use.

Variables

VariableContents
repoFacts: name, stacks, artifacts (the published artifact kinds: release-files, image, npm, …), 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.
paramsThe rule’s params map from the catalog or the repo override.
itemIn a rule with foreach, the current element; in an artifact definition’s instances, the CI file; "" otherwise.
artifactIn an implementation keyed by artifact (by: artifact), the published artifact being checked: {kind, name, workflows}; name is "" when the kind does not name its instances. Empty strings and lists elsewhere.

Functions

FunctionReturns
exists(glob: string) -> boolTrue if any file in the scope matches the glob (** supported).
file(path: string) -> boolTrue 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) -> stringFile contents, or "" when absent.
lines(path: string) -> list<string>File contents split into lines.
yaml(path: string) -> dynParsed YAML document; null when absent.
toml(path: string) -> dynParsed TOML document; null when absent.
json(path: string) -> dynParsed 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) -> boolTrue 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) -> stringThe 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.
artifact_workflows(kind: string) -> list<string>Deprecated, refused in catalogs for engine level 7: use artifact.workflows in an implementation keyed by artifact. CI files that publish any artifact of the kind; empty when the kind is not published.
find(text: string, regex: string) -> stringThe first capture group of the first match (the whole match without a group), or "" when nothing matches.
findall(text: string, regex: string) -> list<string>The first capture group of every match (the whole match without a group), in order; empty when nothing matches.
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) -> boolTrue 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) -> intSize in bytes of a tracked or untracked file; 0 when absent.
globmatch(pattern: string, path: string) -> boolTrue if the path matches the glob (** supported).

Standard CEL operators, macros (all, exists, exists_one, filter, map, has) and 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.

Extension functions

The cel-go extension libraries below are enabled as well; cel-go’s documentation describes each function. A name with a leading dot is called on a value ("a,b".split(","), [[1], [2]].flatten()).

LibraryFunctions
Strings.charAt(), .format(), .indexOf(), .join(), .lastIndexOf(), .lowerAscii(), .replace(), .reverse(), .split(), strings.quote(), .substring(), .trim(), .upperAscii()
Lists.distinct(), .flatten(), .hasAll(), .hasAny(), .hasExactly(), .hasOnly(), lists.range(), .reverse(), .slice(), .sort(), .sortBy()

Generated by fleetlint docs from catalog v0.8.0.