Skip to content

Commit d32c132

Browse files
haritamarNoel Gomez
andauthored
Pr 1669 lock files (#1753)
* add package-lock * update package-lock file * add dbt packages lock check to pre-commit --------- Co-authored-by: Noel Gomez <gomezn@convexa.ai>
1 parent d85644d commit d32c132

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ var/
2828
logs/
2929
.venv
3030
poetry.lock
31-
package-lock.yml
3231

3332
# PyInstaller
3433
# Usually these files are written by a python script from a template
@@ -97,4 +96,4 @@ venv/
9796

9897
# elementary outputs
9998
edr_target/
100-
tests/tests_with_db/dbt_project/dbt_packages/
99+
tests/tests_with_db/dbt_project/dbt_packages/

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,20 @@ repos:
4343
entry: mypy --no-error-summary
4444
language: system
4545
files: ^elementary/.*\.py$
46+
47+
- repo: local
48+
hooks:
49+
- id: verify-dbt-project-packages-lock
50+
name: Verify internal dbt project package lock
51+
entry: |
52+
bash -c '
53+
dbt_version=$(python -c "from dbt.version import __version__; print(__version__)");
54+
required_version="1.8";
55+
if [[ $(echo -e "$dbt_version\n$required_version" | sort -V | tail -1) == "$dbt_version" ]]; then
56+
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);
57+
else
58+
echo "Skipping hook, dbt version is $dbt_version (< 1.8).";
59+
fi
60+
'
61+
language: system
62+
pass_filenames: false
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
packages:
2+
- package: dbt-labs/dbt_utils
3+
version: 0.8.6
4+
- git: https://github.com/elementary-data/dbt-data-reliability.git
5+
revision: 4c65ce164ff02dd816d0d311471e521cf0b7bd14
6+
sha1_hash: d1378c3e1fda6c00a2e6cd156455d39cfc08a4d8

0 commit comments

Comments
 (0)