Repository navigation
Hash the inputs a job doesn't declare: commands, scripts, toolchain pins - #6
Merged
Merged
Conversation
A job's hash covered its definition and declared inputs, so changing a
command it uses, a script its steps run or the toolchain version left
the job skipping: a false skip. cigen hash --job now adds, on top of
the declared inputs (src/inputs.rs):
- the commands the job uses, through other commands too
- the services it names, as defined at the top level
- the top-level github: and circleci: blocks
- every project file its steps name (sh scripts/check.sh,
require('./x.js')) and every file of a local uses: ./action
- root toolchain pins, lockfiles and package.json packageManager
Each rule includes too much rather than too little. The mockci
scenarios show a job runs after a script or toolchain pin changes, and
hash tests cover the rest (the GitHub provider doesn't render commands
or services yet). With derivation disabled, seven of the eight new tests
fail; the eighth checks that an unnamed file still skips.
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.
Automatically derived inputs: the second part of step 3 in
internal_docs/DIRECTION.md. It fixes a false-skip risk. A job's hash covered only its own definition and declaredinputs, so changing a command it uses, a script its steps run or the toolchain version left the job skipping.What
cigen hash --jobadds now (src/inputs.rs)services.github:andcircleci:blocks.sh scripts/check.sh,require('./.github/wait-for-checks.js'), every file of a localuses: ./action.rust-toolchain.toml,.ruby-version,.nvmrc,.tool-versions, …), lockfiles, andpackage.json'spackageManager.Each rule includes too much rather than too little. An extra input costs a rerun; a missing one turns a real failure into a green check.
Tests
tests/derived_inputs.rs:packageManager. It doesn't change for an unused command or service. These are hash tests because the GitHub provider doesn't render commands or services yet (new STATUS known problem 12).With derivation disabled, 7 of the 8 tests fail. The eighth is the control.
The mockci helpers moved to
tests/support/skip.rsso both test files share them.Known gaps (STATUS known problem 1)
working-directorycan miss its script.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.