Inputs
What a job's hash covers. Declared inputs, input groups, and the inputs cigen derives for itself.
A job’s inputs say what its result depends on. When nothing in a job’s hash has changed since it last passed, the job
skips. A job without inputs always runs.
inputs
A glob, or a list of globs and @group references:
# cigen.yml
provider: github
input_groups:
rust: ['src/**/*.rs', 'Cargo.toml', 'Cargo.lock']
rust_tests: ['@rust', 'tests/**']
workflows:
ci:
jobs:
test:
image: rust:latest
inputs: ['@rust_tests', 'fixtures/**/*.json']
steps:
- run: cargo test
Globs are relative to the project root, the directory that holds cigen.yml or .cigen/. In a git repository they match
the files git tracks (git ls-files), so build output and untracked files never change a hash. Outside one, the same
rules apply to the files on disk. A checkout owned by another user, as in a container job, works too. If git fails for
any other reason, cigen hash stops with git’s message rather than guess at the files.
The rules are gitignore’s, which err towards matching more files: a glob that matches too little would skip a job whose inputs changed.
| Glob | Matches |
|---|---|
*.md |
Markdown files everywhere: a glob with no / matches at any depth, like **/*.md. |
/*.md |
Markdown files at the root only: a leading / (or ./) anchors a glob to the root. |
docs/*.md |
Markdown files directly in docs/: a glob with a / starts at the root, and * stays in one directory. |
docs/**/*.md |
Markdown files in docs/ and every directory under it: **/ is zero or more directories. |
docs/** |
Every file under docs/. |
/docs |
Every file under docs/: a glob that matches a directory matches every file under it. |
docs |
Every file under each directory named docs, at the root or deeper (site/docs/). |
A file name with no / matches that name in every directory: Cargo.lock includes tools/Cargo.lock. Write
/Cargo.lock for the root one only.
input_groups
Named lists of globs at the top level. A job refers to one as @name. A group can include other groups. A reference to
a group that doesn’t exist is an error, and so is a cycle:
# cigen.yml
# error: Input groups reference each other in a cycle
provider: github
input_groups:
app: ['src/**', '@shared']
shared: ['lib/**', '@app']
workflows:
ci:
jobs:
test:
inputs: '@app'
steps:
- run: make test
Derived inputs
A job’s result depends on more than the files it lists, and a missed input is the worst bug a skipping system can have:
the job skips when it should have failed. So cigen hash adds the inputs it can find for itself. Each rule errs towards
including too much, because an extra input costs a rerun, while a missing one hides a failure.
On top of the job’s inputs, a job’s hash covers:
- cigen’s version, the job’s id and workflow, the job’s own definition, and its workflow’s settings. Changing a step reruns the job.
- The jobs it
needs, each by its whole hash, and so the jobs those need too. A job usually uses what the jobs before it made, so a change that rerunsbuildalso reruns thetestthat needs it. A job it doesn’t need isn’t in its hash. - Commands the job uses, and the commands those use.
- Services the job names.
- Top-level provider blocks (
github:,circleci:), which shape every generated job. - Files its steps name. Any word in a step that is a path to a project file:
sh scripts/check.sh,require('./.github/wait-for-checks.js'), a file in an action’swith:. A local action (uses: ./path) brings every file in its directory. - Toolchain pins in the project root:
rust-toolchain.toml,rust-toolchain,.ruby-version,.node-version,.nvmrc,.python-version,.go-version,.java-version,.terraform-version,.tool-versions,mise.toml,.mise.toml, andpackage.json’spackageManager. - Lockfiles in the project root:
Cargo.lock,Gemfile.lock,package-lock.json,pnpm-lock.yaml,yarn.lock,bun.lock,bun.lockb,poetry.lock,uv.lock,Pipfile.lock,composer.lock,go.sum. - Every
package.jsonin the project, tracked by git.npm run testruns whatever thetestscript says, and cigen can’t tell which job runs a package manager, or in which package.
A command or service the job doesn’t use isn’t in its hash, so changing it doesn’t rerun the job.
Known gaps
- Files that a named script mentions aren’t followed.
- Paths in steps are looked up from the project root, so a step with a different working directory can miss its script.
- A moving image tag such as
rust:latestisn’t resolved to a digest, so a new image under the same tag doesn’t rerun the job. - Toolchain pins and lockfiles go into every job, so a
yarn.lockchange reruns Rust jobs too. Modules will narrow this per toolchain.
See a job’s hash
cigen hash --job <id> prints the hash CI computes for a job. See CLI.