Repository navigation
Add cigen plan: hashes for a setup job, and the CircleCI config to continue with - #52
Open
ndbroadbent wants to merge 5 commits into
Open
ndbroadbent wants to merge 5 commits into
ndbroadbent wants to merge 5 commits into
Conversation
…ntinue with CircleCI parity item (b), first part: the command the setup job will call. The provider doesn't call it yet; that's the next PR, with the gate and mockci scenarios. - `cigen plan --hash-dir <dir> --job <id>[=<modules digest>]...` writes each job's hash to <dir>/<id>, the hash `cigen hash --job` prints, from one pass over the files. A job it can't hash (or a config that doesn't load) gets a one-off value no pass is recorded under, so the job runs. - `cigen plan --circleci-continue <main.yml> --passed <dir> --output <file>` drops each job with a file in --passed, closed under requires: a passed job stays while a job that requires it runs. cigen_gate always stays, requiring the jobs that remain, and its CIGEN_GATE_JOBS list shrinks to match. A config it can't plan is written unchanged, so every job runs; with nothing to skip, the output is the input byte for byte. hash.rs gains only `job_hashes` at the end, so it stays out of the way of tools' #14, which moves hashing to src/hashing/.
…icate names, approvals, ids
--circleci-continue applies YAML merge keys first, continues unchanged when a workflow entry has
`matrix` or one name runs different jobs in two workflows, and checks that every remaining
`requires` names an entry still in its workflow. It writes the planned config as JSON, so
CircleCI's YAML 1.1 reads every string as written ("yes", "1:20"). An approval goes when
everything waiting on it does. With --hash-dir, a pass counts only if its file holds the job's
current hash.
--hash-dir writes the bytes `cigen hash --job` prints, newline included (CircleCI keys on the
file's checksum, so the setup job's key never matched a job's). Ids with `/` get subdirectories,
ids that would leave the directory are refused, and a job that can't be written runs instead of
stopping the rest.
# Conflicts: # docs/src/content/docs/cli.md # internal_docs/STATUS.md # src/commands/hash.rs # src/commands/mod.rs # src/main.rs
…ing for GitHub matrices A gate is a job named cigen_gate or cigen_gate_<workflow> that carries CIGEN_GATE_JOBS, so a user's cigen_gate_smoke keeps the jobs it requires (it lost them: a false skip). The config loader rejects job ids starting with cigen_. src/yaml11 finds plain scalars that YAML 1.1 reads differently from YAML 1.2 (saphyr-parser reports each scalar's style), and --circleci-continue continues unchanged when a config it would rewrite has one. --hash-dir warns for a job that runs GitHub's own matrix, whose base hash matches no entry's.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CircleCI parity item (b), part 1 of 2: the command the setup job will call. Part 2 generates the setup job, the job markers and the gate, with mockci scenarios on #41's CircleCI mode. It also resolves STATUS 13.
What changed
cigen plan --hash-dir <dir> --job <id>[=<modules digest>]...writes each job's hash to<dir>/<id>: the hashcigen hash --jobprints, from one pass over the files. The=digestform matches the job's own--modules-digest, so the planner's hash and the job's are the same. A job it can't hash, or a config that doesn't load, gets a one-offunplanned-…value that no pass is recorded under, so the job runs. The setup job's{{ checksum }}always has a file to read.cigen plan --circleci-continue <main.yml> --passed <dir> --output <file>drops each job that has a file in--passed, closed underrequires: a passed job stays while a job that requires it runs.cigen_gatealways stays, requiring only the remaining jobs, and itsCIGEN_GATE_JOBSlist shrinks to match. If it can't plan a config (bad YAML, no workflows, a workflow that would be left empty), it writes the config unchanged, so every job runs. When it skips nothing, the output is the input byte for byte.hash.rsgains onlyjob_hashes, at the end, so it stays out of tools' Add cigen explain <job>: what a job's hash covers #14's way (Add cigen explain <job>: what a job's hash covers #14 moves hashing tosrc/hashing/).cigen plansection incli.md. STATUS: the CLI line and the tests list. No generated config calls it yet; both say so.Testing
tests/cigen_plan.rs(4 tests):cigen hash --job, with and without a digest, and change when an input changes;unplanned-value;With the closure loop removed, the dependent test fails.
task cigreen.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.