Skip to content

New hidden install-pipelines-cli command that creates pipelines symlink to databricks#3009

Merged
andrewnester merged 27 commits intodatabricks:mainfrom
alyssa-db:install-dlt-feat
Jun 20, 2025
Merged

New hidden install-pipelines-cli command that creates pipelines symlink to databricks#3009
andrewnester merged 27 commits intodatabricks:mainfrom
alyssa-db:install-dlt-feat

Conversation

@alyssa-db
Copy link
Copy Markdown
Contributor

@alyssa-db alyssa-db commented Jun 6, 2025

Changes

  • New file: pipelines.go (package pipelines)
  • New file: install_pipelines_cli.go (package pipelines)
    • To databricks, implements a hidden install-pipelines-cli command that creates a symlink named pipelines pointing to the real databricks binary.
    • Handles symlink creation, permission checks, and error handling for existing files/symlinks.
  • New folder: pipelines/install-pipelines-cli acceptance test
  • main.go returns a root depending on if the binary is invoked as pipelines/pipelines.exe or databricks

Why

  • Symlink installation: This enables users to invoke pipelines as a standalone CLI, which internally points to the main databricks binary. This is a step towards a dedicated Pipelines CLI experience, while minimizing code duplication.
  • Stub CLI: Lays groundwork for future pipelines-specific commands and workflows
  • Testing: Acceptance test.

Tests

  • Added acceptance tests for install-pipelines-cli in pipelines to check if success message pipelines successfully installed is printed
  • Test descriptions:
    1. Fresh installation:
      Creates temporary directory and verifies successful symlink creation.
      Validates CLI output and stub command functionality.
    2. Already installed scenario:
      Confirms graceful handling when symlink already exists.
    3. File collision test:
      Ensures installation fails when regular file exists at target path.
    4. Aliased binary execution:
      Verifies installation works when databricks binary is renamed/called via alias.

@alyssa-db alyssa-db requested a review from kanterov June 10, 2025 23:38
Copy link
Copy Markdown
Collaborator

@kanterov kanterov left a comment

Choose a reason for hiding this comment

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

Left few comments

// Make helper scripts available
t.Setenv("PATH", fmt.Sprintf("%s%c%s", filepath.Join(cwd, "bin"), os.PathListSeparator, os.Getenv("PATH")))
pathDirs := []string{filepath.Join(cwd, "bin"), buildDir}
t.Setenv("PATH", fmt.Sprintf("%s%c%s", strings.Join(pathDirs, string(os.PathListSeparator)), os.PathListSeparator, os.Getenv("PATH")))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This adds buildDir to PATH? What for?

Copy link
Copy Markdown
Contributor

@denik denik Jun 11, 2025

Choose a reason for hiding this comment

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

If the goal is to expose dlt command to test then we should

  • modify BuildCLI to link databricks to dlt
  • export $DLT env var pointing to built dlt (+ replacement)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The intention here was probably so dlt can be found on the build path when it's built, but we should probably export the $DLT env var the same way we do it for CLI and other envs.

qq: maybe I misunderstood, wdym by "+ replacement" here?

@jefferycheng1
Copy link
Copy Markdown
Collaborator

I think it's better to write it as an acceptance test, for example as here
https://github.com/databricks/cli/tree/main/acceptance/cmd/unknown-subcommand

Here you can see a short guide how to do that https://github.com/databricks/cli/tree/main/acceptance

@denik / @kanterov high level question here: we should be definitely adding acceptance tests, but in general does it hurt to have unit tests as well? A quick look through the repo and it feels like some files have more unit tests while others don't.

For this command specifically, I think it's helpful to test the edge cases for which PATH might not contain databricks, target local isn't writable etc... WDYT?

@denik
Copy link
Copy Markdown
Contributor

denik commented Jun 11, 2025

@denik / @kanterov high level question here: we should be definitely adding acceptance tests, but in general does it hurt to have unit tests as well? A quick look through the repo and it feels like some files have more unit tests while others don't.

For this command specifically, I think it's helpful to test the edge cases for which PATH might not contain databricks, target local isn't writable etc... WDYT?

Depends on code being test; if it's a pure function / class, makes sense to cover edge cases with unit tests. If it involves reading env vars, command line arguments then acceptance tests typically provide more realistic setup.

@alyssa-db alyssa-db force-pushed the install-dlt-feat branch 2 times, most recently from 085a428 to 9d53ff8 Compare June 12, 2025 23:39

title "Executable not called as databricks"
cp $CLI notdatabricks
dlt=$(trace errcode ./notdatabricks install-dlt -o json | jq -r .symlink_path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's also not clear here what's being asserted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the case that the user has databricks aliased, want to make sure the install-dlt command still works.

main.go Outdated
// binary to be used for both DLT and databricks CLI commands.
func getCommand(ctx context.Context) *cobra.Command {
invokedAs := filepath.Base(os.Args[0])
if invokedAs == "dlt" || (runtime.GOOS == "windows" && invokedAs == "dlt.exe") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: you can replace it with strings.StartsWith for invokedAs as nit

@alyssa-db alyssa-db enabled auto-merge June 18, 2025 18:43
@alyssa-db alyssa-db disabled auto-merge June 18, 2025 20:08
Copy link
Copy Markdown
Contributor

@andrewnester andrewnester left a comment

Choose a reason for hiding this comment

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

Approved to unblock but first symlink needs to be renamed from dlt to pipelines

@alyssa-db alyssa-db requested a review from andrewnester June 19, 2025 01:38
Copy link
Copy Markdown
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

Please update the PR title and summary to reflect the new state of the PR.

@alyssa-db alyssa-db changed the title New hidden install-dlt command that creates dlt symlink to databricks New hidden install-pipelines-cli command that creates pipelines symlink to databricks Jun 19, 2025
@alyssa-db alyssa-db changed the title New hidden install-pipelines-cli command that creates pipelines symlink to databricks New hidden install-pipelines-cli command that creates pipelines symlink to databricks Jun 19, 2025
@github-actions
Copy link
Copy Markdown

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 3009
  • Commit SHA: 9156ad52393b0c5260b7573fe18c969c2ae82723

Checks will be approved automatically on success.

@alyssa-db alyssa-db requested a review from pietern June 19, 2025 19:15
@andrewnester andrewnester dismissed pietern’s stale review June 20, 2025 15:38

Already addressed

@andrewnester andrewnester merged commit d5108bf into databricks:main Jun 20, 2025
9 checks passed
denik pushed a commit that referenced this pull request Jan 21, 2026
## Changes

This PR removes the unused standalone pipelines CLI entrypoint
infrastructure. The ability to invoke the CLI binary as `pipelines`
(instead of `databricks`) was never released and is no longer needed.
All pipelines functionality remains available through `databricks
pipelines` commands.

PRs that added this:
- #3009
- #3114
- #3170
- #3177
- #3221

## Tests

Updated acceptance tests.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants