Skip to content

Commit 37fe70e

Browse files
authored
Remove include/exclude flags support from bundle sync command (#2718)
## Why <!-- Why are these changes needed? Provide the context that the reviewer might be missing. For example, were there any decisions behind the change that are not reflected in the code itself? --> Recently introduced (#2650) `--include` and `--exclude` flag in `bundle sync` command duplicate the existing functionality of files inclusion and exclusion [via settings in .yml file](https://docs.databricks.com/aws/en/dev-tools/bundles/settings#include-and-exclude). This change removes the ability to supply include/exclude patterns via CLI flags which removes the confusion before the two methods ## Tests <!-- How have you tested the changes? --> Updated existing tests <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent 2578aa7 commit 37fe70e

File tree

6 files changed

+10
-47
lines changed

6 files changed

+10
-47
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010

1111
### Bundles
1212
* Do not exit early when checking incompatible tasks for specified DBR ([#2692](https://github.com/databricks/cli/pull/2692))
13+
* Removed include/exclude flags support from bundle sync command ([#2718](https://github.com/databricks/cli/pull/2718))
1314

1415
### API Changes

acceptance/bundle/help/bundle-sync/output.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ Usage:
66
databricks bundle sync [flags]
77

88
Flags:
9-
--exclude strings patterns to exclude from sync (can be specified multiple times)
109
--full perform full synchronization (default is incremental)
1110
-h, --help help for sync
12-
--include strings patterns to include in sync (can be specified multiple times)
1311
--interval duration file system polling interval (for --watch) (default 1s)
1412
--output type type of the output format
1513
--watch watch local file system for changes

acceptance/bundle/sync/databricks.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ resources:
55
dashboards:
66
dashboard1:
77
display_name: My dashboard
8+
9+
sync:
10+
exclude:
11+
- 'project-folder/app.*'
12+
- 'project-folder/query.sql'
13+
include:
14+
- 'ignored-folder/**/*.py'

acceptance/bundle/sync/output.txt

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,6 @@
33
Initial Sync Complete
44
Uploaded .gitignore
55
Uploaded databricks.yml
6-
Uploaded project-folder
7-
Uploaded project-folder/app.py
8-
Uploaded project-folder/app.yaml
9-
Uploaded project-folder/query.sql
10-
11-
>>> [CLI] bundle sync --exclude project-folder/app.* --output text
12-
Deleted project-folder/app.py
13-
Deleted project-folder/app.yaml
14-
Initial Sync Complete
15-
16-
>>> [CLI] bundle sync --exclude project-folder/app.* --exclude project-folder/query.sql --output text
17-
Deleted project-folder
18-
Deleted project-folder/query.sql
19-
Initial Sync Complete
20-
21-
>>> [CLI] bundle sync --exclude project-folder/app.* --exclude project-folder/query.sql --include ignored-folder/*.py --output text
22-
Initial Sync Complete
23-
Uploaded ignored-folder
24-
Uploaded ignored-folder/script.py
25-
26-
>>> [CLI] bundle sync --exclude project-folder/app.* --exclude project-folder/query.sql --include ignored-folder/**/*.py --output text
27-
Initial Sync Complete
286
Uploaded ignored-folder/folder1
297
Uploaded ignored-folder/folder1/script.py
30-
31-
>>> [CLI] bundle sync --output text
32-
Deleted ignored-folder
33-
Deleted ignored-folder/folder1
34-
Deleted ignored-folder/folder1/script.py
35-
Deleted ignored-folder/script.py
36-
Initial Sync Complete
37-
Uploaded project-folder
38-
Uploaded project-folder/app.py
39-
Uploaded project-folder/app.yaml
40-
Uploaded project-folder/query.sql
8+
Uploaded ignored-folder/script.py

acceptance/bundle/sync/script

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,9 @@ repls.json
99
EOF
1010

1111
cleanup() {
12-
rm -rf project-folder ignored-folder .git
12+
rm -rf project-folder ignored-folder .git .gitignore
1313
}
1414
trap cleanup EXIT
1515

1616
# Note: output line starting with "Action: " lists files in non-deterministic order so we filter it out
1717
trace $CLI bundle sync --output text | grep -v "^Action: " | sort
18-
trace $CLI bundle sync --exclude 'project-folder/app.*' --output text | grep -v "^Action: " | sort
19-
trace $CLI bundle sync --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' --output text | grep -v "^Action: " | sort
20-
trace $CLI bundle sync --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' --include 'ignored-folder/*.py' --output text | grep -v "^Action: " | sort
21-
trace $CLI bundle sync --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' --include 'ignored-folder/**/*.py' --output text | grep -v "^Action: " | sort
22-
trace $CLI bundle sync --output text | grep -v "^Action: " | sort

cmd/bundle/sync.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ type syncFlags struct {
2222
full bool
2323
watch bool
2424
output flags.Output
25-
exclude []string
26-
include []string
2725
}
2826

2927
func (f *syncFlags) syncOptionsFromBundle(cmd *cobra.Command, b *bundle.Bundle) (*sync.SyncOptions, error) {
@@ -49,8 +47,6 @@ func (f *syncFlags) syncOptionsFromBundle(cmd *cobra.Command, b *bundle.Bundle)
4947

5048
opts.Full = f.full
5149
opts.PollInterval = f.interval
52-
opts.Exclude = append(opts.Exclude, f.exclude...)
53-
opts.Include = append(opts.Include, f.include...)
5450
return opts, nil
5551
}
5652

@@ -66,8 +62,6 @@ func newSyncCommand() *cobra.Command {
6662
cmd.Flags().BoolVar(&f.full, "full", false, "perform full synchronization (default is incremental)")
6763
cmd.Flags().BoolVar(&f.watch, "watch", false, "watch local file system for changes")
6864
cmd.Flags().Var(&f.output, "output", "type of the output format")
69-
cmd.Flags().StringSliceVar(&f.exclude, "exclude", nil, "patterns to exclude from sync (can be specified multiple times)")
70-
cmd.Flags().StringSliceVar(&f.include, "include", nil, "patterns to include in sync (can be specified multiple times)")
7165

7266
cmd.RunE = func(cmd *cobra.Command, args []string) error {
7367
ctx := cmd.Context()

0 commit comments

Comments
 (0)