perf: avoid eager fingerprint variable evaluation (#2883)

This commit is contained in:
Maxime Boucher
2026-07-13 13:58:27 -07:00
committed by GitHub
parent 9200d42282
commit ed24adbc99
3 changed files with 247 additions and 8 deletions

View File

@@ -217,15 +217,17 @@ func (e *Executor) compiledTask(call *Call, evaluateShVars bool) (*ast.Task, err
checker = fingerprint.NewChecksumChecker(e.TempDir.Fingerprint, e.Dry)
}
value, err := checker.Value(&new)
if err != nil {
return nil, err
}
vars.Set(strings.ToUpper(checker.Kind()), ast.Var{Live: value})
if origTask.ReferencesFingerprintVar(checker.Kind()) {
value, err := checker.Value(&new)
if err != nil {
return nil, err
}
vars.Set(strings.ToUpper(checker.Kind()), ast.Var{Live: value})
// Adding new variables, requires us to refresh the templaters
// cache of the the values manually
cache.ResetCache()
// Adding new variables, requires us to refresh the templaters
// cache of the the values manually
cache.ResetCache()
}
}
if len(origTask.Cmds) > 0 {