lets icon indicating copy to clipboard operation
lets copied to clipboard

Add ability to skip tasks,if checksum for this traks was not changed

Open danylkaaa opened this issue 4 years ago • 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

danylkaaa avatar Mar 04 '20 12:03 danylkaaa

Later we can add some other rules for only property in cmd, like Git branch name and etc ( analogy to gitlab-ci only)

danylkaaa avatar Mar 04 '20 12:03 danylkaaa

I think we have to implement checksum persistent first (probably in a separate issue) and then implement only functionality

kindermax avatar Mar 05 '20 16:03 kindermax

Makes sense

danylkaaa avatar Mar 05 '20 16:03 danylkaaa

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.

  1. Persistent - store settings in .lets (not implenented)
  2. Dynamic - for example lets -E PULL=false run If commands have if or only directive, we can check PULL in it and skip the command (not implemented)

kindermax avatar Nov 13 '20 09:11 kindermax