Skip to content

Update lefthook rules

Dmitry Gruzd requested to merge update-lefthook-rule into main

What does this MR do and why?

This MR updates Lefthook rules to make it smarter. It will only be run if files related to the hook change to make unrelated changes (for example, documentation) quite a bit faster.

Screenshots or screen recordings

$ git push
Lefthook v1.4.0
RUNNING HOOK: pre-push
rspec: (skip) no files for inspection
helm_lint_many_values: (skip) no files for inspection
integration_spec: (skip) no files for inspection
helm_lint: (skip) no files for inspection

SUMMARY: (SKIP EMPTY)

How to set up and validate locally

  1. Check out this branch
    git checkout update-lefthook-rule
  2. Enable Lefthook if it's not already
    lefthook install
  3. Create a commit with change to a one of the md files
    echo "change" >> README.md && git commit -a -m "test commit"
  4. Execute
    lefthook run pre-push
  5. Ensure that it doesn't execute any hooks
  6. Create a commit with change to a one of the yaml, tpl, or rb files
    echo > templates/svc-gateway.yaml && git commit -a -m "test commit 2"
  7. Execute
    lefthook run pre-push
  8. Ensure that this time it did execute hooks. In addition to that you should see spec failure
  9. Now you can reset the changes we've made
    git reset --hard origin/update-lefthook-rule
Edited by Dmitry Gruzd

Merge request reports