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

Better error message for Private package definition #10084

Merged
merged 2 commits into from
May 7, 2024
Merged

Conversation

ChenyuLInx
Copy link
Contributor

resolves #10083

Problem

We are introducing better support for private package in dbt-cloud, which allows people to define a new package.
If we don't do anything in core, this would lead to core raising

  Validator Error:
  {'private': 'dbt-labs/audit_helper', 'revision': 'HEAD', 'subdirectory': 'audit_helper', 'unrendered': {'private': 'dbt-labs/audit_helper', 'revision': 'HEAD', 'subdirectory': 'audit_helper'}} is not valid under any of the given schemas

Instead, we should have a clear message telling people to define git package.

Solution

Checklist

  • I have read the contributing guide and understand what's expected of me
  • 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
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@ChenyuLInx ChenyuLInx requested a review from a team as a code owner May 2, 2024 22:57
@cla-bot cla-bot bot added the cla:yes label May 2, 2024
Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 88.18%. Comparing base (29b8359) to head (dc13909).
Report is 4 commits behind head on main.

Files Patch % Lines
core/dbt/deps/resolver.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10084      +/-   ##
==========================================
- Coverage   88.21%   88.18%   -0.04%     
==========================================
  Files         181      181              
  Lines       22748    22759      +11     
==========================================
+ Hits        20068    20069       +1     
- Misses       2680     2690      +10     
Flag Coverage Δ
integration 85.49% <83.33%> (-0.13%) ⬇️
unit 62.65% <91.66%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -304,7 +305,7 @@ def test__invalid_color_config_block(
self,
project,
):
with pytest.raises(ValidationError):
with pytest.raises((ValidationError, ConfigUpdateError)):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This caused an issue in CI because of the execution order of tests. Since Gerda also ran into this before, I am just fixing it here.

@@ -74,6 +75,10 @@ def update_from(self, src: List[PackageSpec]) -> None:
pkg = TarballUnpinnedPackage.from_contract(contract)
elif isinstance(contract, GitPackage):
pkg = GitUnpinnedPackage.from_contract(contract)
elif isinstance(contract, PrivatePackage):
raise DbtInternalError(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should be a DbtInternalError if it can be caused by user-configuration and is resolvable given user action

@ChenyuLInx ChenyuLInx requested a review from MichelleArk May 7, 2024 17:03
@ChenyuLInx ChenyuLInx merged commit e349e01 into main May 7, 2024
63 checks passed
@ChenyuLInx ChenyuLInx deleted the cl/package_error branch May 7, 2024 20:02
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.

[Feature] Add a private package definition
2 participants