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

Remove --dry-run flag from dbt deps #9169

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/unreleased/Breaking Changes-20231129-091921.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Breaking Changes
body: Rm --dry-run flag from 'dbt deps --add-package', in favor of just 'dbt deps
--lock'
time: 2023-11-29T09:19:21.071212+01:00
custom:
Author: jtcohen6
Issue: "9100"
7 changes: 0 additions & 7 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ def debug(ctx, **kwargs):
@p.target
@p.vars
@p.source
@p.dry_run
@p.lock
@p.upgrade
@p.add_package
Expand All @@ -483,12 +482,6 @@ def deps(ctx, **kwargs):
message=f"Version is required in --add-package when a package when source is {flags.SOURCE}",
option_name="--add-package",
)
else:
if flags.DRY_RUN:
raise BadOptionUsage(
message="Invalid flag `--dry-run` when not using `--add-package`.",
option_name="--dry-run",
)
task = DepsTask(flags, ctx.obj["project"])
results = task.run()
success = task.interpret_results(results)
Expand Down
7 changes: 0 additions & 7 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@
hidden=True,
)

dry_run = click.option(
"--dry-run",
envvar=None,
help="Option to run `dbt deps --add-package` without updating package-lock.yml file.",
is_flag=True,
)

empty = click.option(
"--empty/--no-empty",
envvar="DBT_EMPTY",
Expand Down
5 changes: 3 additions & 2 deletions core/dbt/task/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@
if previous_hash != current_hash:
self.lock()

# Early return when dry run or lock only.
if self.args.dry_run or self.args.lock:
# Early return when 'dbt deps --lock'
# Just resolve packages and write lock file, don't actually install packages
if self.args.lock:

Check warning on line 225 in core/dbt/task/deps.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/deps.py#L225

Added line #L225 was not covered by tests
return

if system.path_exists(self.project.packages_install_path):
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/dependencies/test_dependency_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ def test_deps_add(self, clean_start):
)
assert len(os.listdir("dbt_packages")) == 3

def test_deps_add_dry_run(self, clean_start):
def test_deps_add_without_install(self, clean_start):
os.rename("packages.yml", "dependencies.yml")
run_dbt(
[
"deps",
"--add-package",
"dbt-labs/audit_helper@0.9.0",
"--dry-run",
"--lock",
]
)
assert not os.path.exists("dbt_packages")
Expand Down
Loading