Commit Graph

393 Commits

Author SHA1 Message Date
Shreyas Goenka 43aadba1f8
made events work and moved validation outside sync object 2023-06-06 15:12:56 +02:00
Shreyas Goenka f0f75ff98f
- 2023-06-06 02:03:04 +02:00
Shreyas Goenka 8166aed617
revert changes to reposfile 2023-06-06 02:00:30 +02:00
Shreyas Goenka 764d9e93e7
Merge remote-tracking branch 'origin' into import_dir 2023-06-06 01:57:27 +02:00
Shreyas Goenka f1e99d31a2
Merge remote-tracking branch 'origin' into import_dir 2023-06-06 01:57:13 +02:00
shreyas-goenka d6d35e314f
Add fs rm command for dbfs (#433)
## Changes
Please look at the title

## Tests
Integration tests
2023-06-05 23:21:47 +00:00
shreyas-goenka ae10419eb8
Add fs cat command for dbfs files (#430)
## Changes
TSIA

## Tests
Manually and integration tests
2023-06-06 01:16:23 +02:00
Shreyas Goenka 58acf64cf1
some cleanup 2023-06-06 01:01:42 +02:00
Shreyas Goenka 59081f7017
Merge remote-tracking branch 'origin' into import_dir 2023-06-06 00:36:12 +02:00
Shreyas Goenka 74cb87f1b9
- 2023-06-06 00:35:50 +02:00
Shreyas Goenka e9a309e85d
removes not a directory error 2023-06-06 00:34:09 +02:00
Shreyas Goenka 96290320b2
- 2023-06-06 00:32:51 +02:00
Shreyas Goenka 5fdd8a200c
- 2023-06-06 00:27:42 +02:00
Shreyas Goenka 14b63d0326
- 2023-06-06 00:27:02 +02:00
Shreyas Goenka ae09abf1f5
- 2023-06-06 00:26:41 +02:00
Shreyas Goenka bb175469f0
- 2023-06-06 00:25:12 +02:00
Shreyas Goenka 6cc2571add
address some comments 2023-06-06 00:07:21 +02:00
Andrew Nester df3f5863c7
Do not generate prompts for certain commands (#438)
## Changes
Some of the commands do not support prompts, for example `workspace
get-status` but we were wrongly suggesting customers some option.

Quick fix for this is not to provide prompts for these known commands.

Note: it uses a method from this PR in Go SDK
https://github.com/databricks/databricks-sdk-go/pull/416

## Tests
Running `workspace get-status`

Before
```
andrew.nester@HFW9Y94129 multiples-tasks % ../../cli/cli workspace get-status
Error: Path () doesn't start with '/'
```

After
```
andrew.nester@HFW9Y94129 multiples-tasks % ../../cli/cli workspace get-status
Error: accepts 1 arg(s), received 0

```
2023-06-05 19:38:45 +02:00
Shreyas Goenka 298fed28e5
undo remote path public 2023-06-05 18:45:21 +02:00
Shreyas Goenka 49f7969363
set template in annotation 2023-06-05 18:09:24 +02:00
Shreyas Goenka 0f1cb67c98
remove underscore 2023-06-05 18:07:41 +02:00
shreyas-goenka 6ff00122ad
Add fs ls command for dbfs (#429)
## Changes
1. Adds fs ls command
2. Adds ability to define multiple templates

## Tests
Manually and integration tests
2023-06-05 17:41:30 +02:00
Andrew Nester 1f130f3722
Do not use FgWhite and FgBlack for terminal output (#435)
## Changes
Using white / black color for terminal output will lead to poorly
displayed content in either light or dark terminal backgrounds. Some
other CLIs experienced same issues
(https://github.com/qri-io/qri/pull/774)

Instead, let's just use color to highlight some of the output so it's
more compatible with different background styles

## Tests
<img width="772" alt="Screenshot 2023-06-05 at 16 05 09"
src="https://github.com/databricks/cli/assets/2969996/01790239-6a33-4059-86a8-d5117ea0b75f">

---

<img width="757" alt="Screenshot 2023-06-05 at 16 05 20"
src="https://github.com/databricks/cli/assets/2969996/ea3b9fdc-3782-4f4f-a9df-19e66af0c04f">
2023-06-05 17:30:40 +02:00
Andrew Nester 3dbf7a575a
Better error message if can not load prompts (#437)
## Changes
Better error message if can not load prompts

## Tests
Setup 2 jobs with the same name and ran `cli job get`

```
andrew.nester@HFW9Y94129 multiples-tasks % ../../cli/cli jobs get
Error: failed to load names for Jobs drop-down. Please manually specify required arguments. Original error: duplicate .Settings.Name: duplicatejob
```
2023-06-05 16:32:03 +02:00
Pieter Noordhuis 28d36577a2
Speed up sync integration tests (#428)
## Changes

This change implements:
* Channels for line-by-line output from stdout/stderr
* A function to wait for a sync step to complete (using above)
* Ensure all tests are prefixed `TestAccSync`
* Use temporary paths in WSFS instead of cloning a repo

## Tests

The same integration tests now pass in ~90 seconds (was ~250s).
2023-06-02 14:02:18 +00:00
Pieter Noordhuis 1c0d67f66c
Add fs.FS adapter for the filer interface (#422)
## Changes

This enables the use of `io/fs` functions `fs.Glob` and `fs.WalkDir`
with filers.

We can't use `fs.FS` as the standard interface instead of `filer.Filer` because:
1. It was made for reading from filesystems only, not writing
2. It doesn't take a context for the core functions

Therefore a wrapper will do.

## Tests

* Added unit tests to cover the adapter through a fake filer.
* Manually ran `fs.WalkDir` against both WSFS and DBFS filers.
2023-06-02 12:49:59 +00:00
Andrew Nester f8255f356b
Added spinner when loading command prompts (#420)
## Changes
Added spinner when loading command prompts

## Tests
```
andrew.nester@HFW9Y94129 multiples-tasks % cli jobs get-run
⡿ No RUN_ID argument specified. Loading names for Jobs drop-down.```
2023-06-02 14:13:18 +02:00
Serge Smertin a6c9533c1c
Add profile on `databricks auth login` (#423)
## Changes
- added saving profile to `~/.databrickscfg` whenever we do `databricks
auth login`.
- we either match profile by account id / canonical host or introduce
the new one from deployment name.
- fail on multiple profiles with matching accounts or workspace hosts.
- overriding `~/.databrickscfg` keeps the (valid) comments, but
reformats the file.

## Tests
<!-- How is this tested? -->
- `make test`
- `go run main.go auth login --account-id XXX --host
https://accounts.cloud.databricks.com/`
- `go run main.go auth token --account-id XXX --host
https://accounts.cloud.databricks.com/`
- `go run main.go auth login --host https://XXX.cloud.databricks.com/`
2023-06-02 13:49:39 +02:00
shreyas-goenka 91097856b5
Add check for path is a directory in filer.ReadDir (#426)
## Tests
Integration tests
2023-06-02 12:28:35 +02:00
Shreyas Goenka 709987448a
Merge remote-tracking branch 'origin' into import_dir 2023-06-02 00:18:12 +02:00
Shreyas Goenka efc72b5bbd
- 2023-06-02 00:15:02 +02:00
Shreyas Goenka c1ccf8204f
testdata 2023-06-02 00:08:40 +02:00
Shreyas Goenka 2be6b85beb
wip import-dir acc tests 2023-06-02 00:08:29 +02:00
Shreyas Goenka dc0ff8925a
repofiles integration test 2023-06-02 00:07:35 +02:00
Shreyas Goenka 57a95786f7
added some intgegration test for repofiles and moved to filer 2023-06-02 00:07:16 +02:00
Shreyas Goenka 931fae1fd4
add check for isdir in readdir 2023-06-02 00:06:49 +02:00
Shreyas Goenka fb5ea166ca
helper wsfs function 2023-06-02 00:05:51 +02:00
Shreyas Goenka 289dd0db32
- 2023-06-02 00:05:17 +02:00
Shreyas Goenka 0382c749c5
- 2023-06-02 00:04:42 +02:00
Shreyas Goenka 2303f20f95
sync options redefine better 2023-06-02 00:04:18 +02:00
Pieter Noordhuis 2b56af6016
Add Stat function to filer.Filer interface (#421)
## Changes

TSIA

## Tests

New integration test passes.
2023-06-01 20:23:22 +02:00
Pieter Noordhuis 7a4ca786d8
Use cmdio in version command for `--output` flag (#419)
## Changes

Use cmdio in the version command such that it accepts the `--output` flag.

This removes the existing `--detail` flag which previously made the
command print JSON output.

## Tests

New integration test passes.
2023-06-01 12:03:22 +02:00
Serge Smertin 24ebfdf31e
Add readable console logger (#370)
## Changes

Add a readable colored console logger that is active only for TTYs:

<img width="764" alt="image"
src="https://user-images.githubusercontent.com/259697/235221427-ca482b32-9f88-4adb-ada3-8c4f35f50f06.png">

## Tests

Run `go run main.go clusters list --log-level debug --profile demo`
2023-06-01 11:37:33 +02:00
Shreyas Goenka 1244b3a414
Merge remote-tracking branch 'origin' into import_dir 2023-06-01 11:35:14 +02:00
Shreyas Goenka 9f4bf1261b
Add workspace import_dir command to the CLI 2023-06-01 11:23:31 +02:00
dependabot[bot] d44d8ff2dc
Bump github.com/mattn/go-isatty from 0.0.18 to 0.0.19 (#412) 2023-06-01 09:45:54 +02:00
Pieter Noordhuis 9ae86e3ae3
Fix locker integration test (#417)
## Changes

The failure was caused by swapping out the error types returned by the filer in #139.

## Tests

Integration tests pass again.
2023-06-01 09:38:03 +02:00
Pieter Noordhuis 349e2aff40
Allow equivalence checking of filer errors to fs errors (#416)
## Changes

The pattern `errors.Is(err, fs.ErrNotExist)` is common to check for an
error type.

Errors can implement `Is(error) bool` with a custom equivalence checker.

## Tests

New asserts all pass in the integration test.
2023-05-31 20:47:00 +02:00
Pieter Noordhuis 42cd8daee0
Make filer.Filer return fs.DirEntry from ReadDir (#415)
## Changes

This allows for compatibility with the stdlib functions in io/fs.

## Tests

Integration tests pass.
2023-05-31 14:22:26 +02:00
Pieter Noordhuis 27df4e765c
Implement DBFS filer (#139)
Adds a DBFS implementation of the `filer.Filer` interface.

The integration tests are reused between the workspace filesystem and
DBFS implementations to ensure identical behavior.
2023-05-31 13:24:20 +02:00