Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git package: warn if specified revision master, main #3117

Merged
merged 2 commits into from
Feb 22, 2021

Conversation

jtcohen6
Copy link
Contributor

Follow up from #3057, #3104

Previously, if a git package was unpinned, dbt tried to install it from master (hard coded). In #3104, this was fixed to used HEAD (default branch, regardless of name) and continue to warn if unpinned.

We'd like to warn as well if the user specifies the package revision as 'master' or 'main', since either almost certainly represents the default branch. Users can disable the warning with warn-unpinned: false.

Example

packages:
  - git: https:/fishtown-analytics/dbt-codegen 
    revision: master
  - git: https:/tailsdotcom/dbt_artifacts   
    revision: main
  - git: https://gitlab.com/gitlab-data/snowflake_spend
  - package: fishtown-analytics/audit_helper
    version: 0.3.0
$ dbt deps
Running with dbt=0.19.0
WARNING: The git package "https:/fishtown-analytics/dbt-codegen"
	is pinned to the "master" branch.
	This can introduce breaking changes into your project without warning!

See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
WARNING: The git package "https:/tailsdotcom/dbt_artifacts"
	is pinned to the "main" branch.
	This can introduce breaking changes into your project without warning!

See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
WARNING: The git package "https://gitlab.com/gitlab-data/snowflake_spend"
	is not pinned, using HEAD (default branch).
	This can introduce breaking changes into your project without warning!

See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
WARNING: The git package "https:/fishtown-analytics/dbt-codegen"
	is pinned to the "master" branch.
	This can introduce breaking changes into your project without warning!

See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
WARNING: The git package "https:/tailsdotcom/dbt_artifacts"
	is pinned to the "main" branch.
	This can introduce breaking changes into your project without warning!

See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
WARNING: The git package "https://gitlab.com/gitlab-data/snowflake_spend"
	is not pinned, using HEAD (default branch).
	This can introduce breaking changes into your project without warning!

See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
Installing https:/fishtown-analytics/dbt-codegen@master
  Installed from revision master

Installing https:/tailsdotcom/dbt_artifacts@main
  Installed from revision main

Installing https://gitlab.com/gitlab-data/snowflake_spend@HEAD
  Installed from HEAD (default branch)

Installing fishtown-analytics/[email protected]
  Installed from version 0.3.0

Installing fishtown-analytics/[email protected]
  Installed from version 0.6.4
packages:
  - git: https:/fishtown-analytics/dbt-codegen 
    revision: master
    warn-unpinned: false
  - git: https:/tailsdotcom/dbt_artifacts   
    revision: main
    warn-unpinned: false
  - git: https://gitlab.com/gitlab-data/snowflake_spend
    warn-unpinned: false
  - package: fishtown-analytics/audit_helper
    version: 0.3.0
$ dbt deps
Running with dbt=0.19.0
Installing https:/fishtown-analytics/dbt-codegen@master
  Installed from revision master

Installing https:/tailsdotcom/dbt_artifacts@main
  Installed from revision main

Installing https://gitlab.com/gitlab-data/snowflake_spend@HEAD
  Installed from HEAD (default branch)

Installing fishtown-analytics/[email protected]
  Installed from version 0.3.0

Installing fishtown-analytics/[email protected]
  Installed from version 0.6.4

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@jtcohen6 jtcohen6 requested a review from clrcrl February 19, 2021 10:26
@cla-bot cla-bot bot added the cla:yes label Feb 19, 2021
Copy link
Contributor

@clrcrl clrcrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jtcohen6 jtcohen6 requested review from a team, gshank and kwigley and removed request for a team February 19, 2021 19:29
@kwigley
Copy link
Contributor

kwigley commented Feb 19, 2021

nice! I do think we should warn when using any branch name to pin, but this is a step in that direction 👍

@jtcohen6
Copy link
Contributor Author

nice! I do think we should warn when using any branch name to pin, but this is a step in that direction 👍

@kwigley Do you mean, warn if users pin to a branch name in their revision, rather than a version number/release tag? That's fair! I don't think the git-based deps approach has a way today to differentiate between branch-name and release-name revisions.

@jtcohen6 jtcohen6 merged commit be47a0c into develop Feb 22, 2021
@jtcohen6 jtcohen6 deleted the fix/deps-git-warn-if-main-master branch February 22, 2021 09:49
@TeddyCr TeddyCr mentioned this pull request Apr 18, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants