Add ability to skip tasks,if checksum for this traks was not changed
Opened this issue · 4 comments
Sometimes I want to skip execution of some tasks, if command's checksum from last run is not changed.
Example: before each npm run smth
I want to run npm i
. But if package.json
and package.lock
is not changed, I do not need to run npm i
So, in lets.yaml
I want to past smth like this and as a result, omit running task
New lets.yaml
install_deps:
checksum:
deps: &deps
- package.json
- package-lock.json
only:
checksum:
<<: *deps
cmd: npm i
run-smth:
depends: [install_deps]
cmd: npm run smth
As you can see, in lets.yaml
I added in cmd install_deps
property only
. It will allow to execute install_deps.cmd
only if checksum for this cmd changed.
So, what we need to implement:
- Persistant saving of checksums into file
- Reading saved checksum for command
- Updating of after cmd successful execution
- Skip command invocation, if new and saved checksum are equal
Later we can add some other rules for only
property in cmd, like Git branch name and etc ( analogy to gitlab-ci only
)
I think we have to implement checksum persistent first (probably in a separate issue) and then implement only
functionality
Makes sense
Another use case. When using depends
, sometimes we want to skip some of the commands in it.
There are a couple of ways to do that.
- Persistent - store settings in .lets (not implenented)
- Dynamic - for example
lets -E PULL=false run
If commands haveif
oronly
directive, we can checkPULL
in it and skip the command (not implemented)