Running dbt-checkpoint in Gitlab CI
hossein-jazayeri opened this issue · 1 comments
hossein-jazayeri commented
Similar to GitHub actions, it would be very nice to be able to run the rules in Gitlab CI.
noel commented
you can, you just need a docker image with dbt. We do this and Jenkins with Datacoves.
In Gitlab, it would look something like this.
build_and_test:
image: datacoves/ci-basic-dbt-snowflake:2.2
before_script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- cd $CI_PROJECT_DIR
stage: build
script:
- git fetch origin main
- git diff origin/main HEAD --name-status
- cd $DATACOVES__DBT_HOME
- dbt debug
- dbt deps
- dbt build --fail-fast
- cd $CI_PROJECT_DIR
- CHANGED_FILES=$(git diff --name-only origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME HEAD)
- dbt docs generate
- pre-commit run --files $CHANGED_FILES --config .pre-commit-config.yaml
only:
- merge_requests
interruptible: true