Skip to content

Commit

Permalink
add dbt packages lock check to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
haritamar committed Nov 18, 2024
1 parent 3112564 commit a90856f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,20 @@ repos:
entry: mypy --no-error-summary
language: system
files: ^elementary/.*\.py$

- repo: local
hooks:
- id: verify-dbt-project-packages-lock
name: Verify internal dbt project package lock
entry: |
bash -c '
dbt_version=$(python -c "from dbt.version import __version__; print(__version__)");
required_version="1.8";
if [[ $(echo -e "$dbt_version\n$required_version" | sort -V | tail -1) == "$dbt_version" ]]; then
dbt deps --lock --project-dir elementary/monitor/dbt_project && git diff --quiet elementary/monitor/dbt_project/package-lock.yml || (echo "Changes detected in package lock file!" && exit 1);
else
echo "Skipping hook, dbt version is $dbt_version (< 1.8).";
fi
'
language: system
pass_filenames: false

0 comments on commit a90856f

Please sign in to comment.