Skip to content

Conversation

ttusing
Copy link
Contributor

@ttusing ttusing commented Aug 23, 2025

Resolves #11953

Problem

When using environment variables in git package URLs, dbt deps generates different package hashes on different machines even when the actual package specification is identical. This causes several problematic behaviors:

Solution

Added a new optional exclude-env-vars-from-hash field to git packages that allows excluding environment variables from hash calculation while still using them for actual git operations.

GitPackage field with YAML alias support
to_dict_for_hash() method: Returns dictionary using unrendered values when flag is set
[_create_sha1_hash()]: Modified to use new method when available, falls back to existing behavior
Backward compatible: Existing packages continue to work unchanged (flag defaults to false)

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 or 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.

@ttusing ttusing requested a review from a team as a code owner August 23, 2025 22:59
Copy link

cla-bot bot commented Aug 23, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Tobie Tusing.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@github-actions github-actions bot added the community This PR is from a community member label Aug 23, 2025
@ttusing ttusing force-pushed the tobie/exclude_env_var_on_hash branch from 5b6a4a0 to 86734bc Compare August 23, 2025 23:20
Copy link

cla-bot bot commented Aug 23, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Tobie Tusing.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

Copy link
Contributor

Choose a reason for hiding this comment

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

@ttusing this file is empty -- was there intended to be content in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed - also fixed my commit history for the CLA bot I think, though it looks like I need to sign those commits. will address that along with any feedback!

Copy link

cla-bot bot commented Aug 27, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Tobie Tusing.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@ttusing ttusing force-pushed the tobie/exclude_env_var_on_hash branch from 589916d to 5df4078 Compare August 27, 2025 04:32
@cla-bot cla-bot bot added the cla:yes label Aug 27, 2025
do not include env vars when hashing packages

add changie
@ttusing ttusing force-pushed the tobie/exclude_env_var_on_hash branch from 5df4078 to 32d2352 Compare August 27, 2025 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:yes community This PR is from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Git packages with environment variables cause unnecessary package-lock.yml regeneration

2 participants