Skip to content

Commit

Permalink
Pr 1669 lock files (#1753)
Browse files Browse the repository at this point in the history
* add package-lock

* update package-lock file

* add dbt packages lock check to pre-commit

---------

Co-authored-by: Noel Gomez <[email protected]>
  • Loading branch information
haritamar and Noel Gomez authored Nov 18, 2024
1 parent d85644d commit d32c132
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var/
logs/
.venv
poetry.lock
package-lock.yml

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -97,4 +96,4 @@ venv/

# elementary outputs
edr_target/
tests/tests_with_db/dbt_project/dbt_packages/
tests/tests_with_db/dbt_project/dbt_packages/
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
6 changes: 6 additions & 0 deletions elementary/monitor/dbt_project/package-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
packages:
- package: dbt-labs/dbt_utils
version: 0.8.6
- git: https://github.com/elementary-data/dbt-data-reliability.git
revision: 4c65ce164ff02dd816d0d311471e521cf0b7bd14
sha1_hash: d1378c3e1fda6c00a2e6cd156455d39cfc08a4d8

0 comments on commit d32c132

Please sign in to comment.