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

Fix dbt deps failing on tarballs #9068

Merged
merged 7 commits into from
Nov 14, 2023

Conversation

QMalcolm
Copy link
Contributor

@QMalcolm QMalcolm commented Nov 14, 2023

resolves #9062

Problem

In 1.7.x it's default behavior for a packages-lock.yml to be produced when running dbt deps. However, our to_dict function on tarball packages tries to produces fields which don't actually exist (and are thus populated with None), and drop some of the required fields 😬 Thus when we try to parse the packages-lock.yml the process blows up 😅 Specifically it raises a DbtProjectError saying the packages.yml is malformed. However the error is really that we mangled the packages-lock.yml, and thus the yaml can't be used to produce the python object representation of the tarball package.

Solution

We corrected the to_dict function for tarball packages.

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 and others added 4 commits November 13, 2023 08:34
This test was written _after_ the fix was commited. However, I ran this
test against main without the fix and it failed. After running the test
with the tarball fix, it passed.
…date`

We had a conditional to skip validation for a package if the package
included the `tarball` key. However, this conditional always returned
false as it was nested inside a conditional that the package had the
default `package` key, which means it's not a tarball package, but a
package package (maybe we need better differentiation here). If we need
additional validation for tarballs down the road, we should do that one
level up. At this time we have no additional validaitons to add.
@QMalcolm QMalcolm requested a review from a team as a code owner November 14, 2023 00:02
@cla-bot cla-bot bot added the cla:yes label Nov 14, 2023
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e24f9b3) 86.56% compared to head (cb29a01) 86.60%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9068      +/-   ##
==========================================
+ Coverage   86.56%   86.60%   +0.03%     
==========================================
  Files         179      179              
  Lines       26538    26538              
==========================================
+ Hits        22973    22983      +10     
+ Misses       3565     3555      -10     
Flag Coverage Δ
integration 83.55% <ø> (+0.07%) ⬆️
unit 64.79% <ø> (ø)

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.

@ChenyuLInx
Copy link
Contributor

Thanks for removing the logic that's not needed!

@martynydbt martynydbt requested review from ChenyuLInx and removed request for ChenyuLInx November 14, 2023 01:10
Copy link
Member

@emmyoop emmyoop left a comment

Choose a reason for hiding this comment

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

Small fix to the changelog, otherwise it looks good.

.changes/unreleased/Fixes-20231113-114956.yaml Outdated Show resolved Hide resolved
We initially included this fixture due to copy and pasting another
test. However, this `setUp` fixture isn't actually necessary for the
tarball dependency tests.
@QMalcolm QMalcolm merged commit 017faf4 into main Nov 14, 2023
51 checks passed
@QMalcolm QMalcolm deleted the qmalcolm--9062-dbt-deps-tarball-failure branch November 14, 2023 19:38
github-actions bot pushed a commit that referenced this pull request Nov 14, 2023
* tarball lockfile fix

* Add changie doc for tarball deps issue

* Add integration test for ensuring tarball package specification works

This test was written _after_ the fix was commited. However, I ran this
test against main without the fix and it failed. After running the test
with the tarball fix, it passed.

* Remove unnecessary `tarball` conditional logic in `PackageConfig.validate`

We had a conditional to skip validation for a package if the package
included the `tarball` key. However, this conditional always returned
false as it was nested inside a conditional that the package had the
default `package` key, which means it's not a tarball package, but a
package package (maybe we need better differentiation here). If we need
additional validation for tarballs down the road, we should do that one
level up. At this time we have no additional validaitons to add.

* Fix typos in changie doc for tarball deps issue

* Improve tarball package test naming and add related unhappy path test

* Remove unnecessary `setUp` fixture from tarball package tests

We initially included this fixture due to copy and pasting another
test. However, this `setUp` fixture isn't actually necessary for the
tarball dependency tests.

---------

Co-authored-by: Chenyu Li <chenyu.li@dbtlabs.com>
(cherry picked from commit 017faf4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3377] [Regression] dbt deps fails on tarball dependencies
3 participants