question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dbt deps does not handle non-master default branch

See original GitHub issue

Steps to reproduce

  1. Add a package using a the git syntax. The package must use a default branch other than master. In this example, the default branch is main (this package is currently an internal package but will be public soon)
$ cat packages.yml
packages:
  - git: git@github.com:fishtown-analytics/dbt-artifacts.git
    
  1. Run dbt deps
$ dbt deps
Running with dbt=0.19.0
Encountered an error:
Error checking out spec='master' for repo git@github.com:fishtown-analytics/dbt-artifacts.git
fatal: couldn't find remote ref master

Expected behavior

Package should install from the default branch, main and warn about an unpinned package

If I do specify revision: main, I also expect to get an unpinned error, however currently no warning is shown.

dbt version

0.19.0 😃

Additional context

Relevant code

Going to be more common since GitHub updated their default branch name.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
VasiliiSurovcommented, Feb 10, 2021

@jtcohen6 , @clrcrl I want to pick up this task if nobody minds

Here is my ideas:

  1. Add new method to client/git.py default_branch(repo) that will get the value of default branch from the git configuration using CLI git remote show [repository]
  2. Modify deps/git.py@resolved instead of hard coded ‘master’ assign result value from default_branch https://github.com/fishtown-analytics/dbt/blob/c8f0469a44f84cfc7d48cb6b938c6cd27288feba/core/dbt/deps/git.py#L136
  3. Modify deps/git.py@_fetch_metadata check self.revision for (‘master’, ‘main’) https://github.com/fishtown-analytics/dbt/blob/c8f0469a44f84cfc7d48cb6b938c6cd27288feba/core/dbt/deps/git.py#L75

And one more possible change that is out of the scope but is related

  1. Modify clients/git.py@checkout instead of hard coded ‘master’ assign result value from the default_branch https://github.com/fishtown-analytics/dbt/blob/c8f0469a44f84cfc7d48cb6b938c6cd27288feba/core/dbt/clients/git.py#L55
1reaction
kwigleycommented, Feb 12, 2021

💡 just jotting down my thoughts here, I haven’t tested this out. I know this applies to GitHub: after running git clone the default branch defined in GitHub will be checked out locally. When there is no version supplied for a package in packages.yml, we should probably:

  • after cloning the package, either skip checking out anything or check out the current branch (maybe even use HEAD here?)
  • ensure unpinned warning is displayed

There should be no reference to master after these changed.

When the version supplied for a package is a branch name, we could:

  • check if the version points to a branch as opposed to a tag and display an appropriate warning.

I apologize if this is repeating or different than was is mentioned above! I think the main issue here is git has no notion of default branch, so git clone is the important piece to get this info from.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dbt deps does not handle non-master default branch
Steps to reproduce. Add a package using a the git syntax. The package must use a default branch other than master .
Read more >
deps - dbt Developer Hub
dbt deps pulls the most recent version of the dependencies listed in your packages.yml from git. See Package-Management for more information.
Read more >
ORA-12700 to ORA-19400 - Oracle Help Center
Action: This error should not normally occur. If it persists, contact Oracle Support Services. ORA-12807: process queue could not receive parallel query message....
Read more >
IMS: Diagnosis - IBM
If an optional item appears above the main path, that item has no effect on ... job hangs in the system and does...
Read more >
GoldMine Administrator's Guide - Product Documentation
“Ivanti”), and may not be disclosed or copied without prior written consent ... Branch to Event ... Set Outlook as Default E-mail Application...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found