-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Exporter] Allow to match resource names by regular expression (#4177)
## Changes <!-- Summary of your changes that are easy to understand --> In addition to the existing `-match` option, this PR allows the matching of names by regex during the listing operation. There are new options: - `-matchRegex` - checks if name matches a regex - this could be useful for exporting notebooks for only specific users, or something like that. - `-excludeRegex` - checks if name matches a regex, and skips processing of that object. For example, it could be used to exclude `databricks_automl` directories. This parameter has higher priority than the `-match` and `-matchRegex`. - `filterDirectoriesDuringWorkspaceWalking` - if we should apply match logic to directory names when we're performing workspace tree walking. *Note: be careful with it as it will be applied to all entries, so if you want to filter only specific users, then you will need to specify the condition for `/Users` as well, so regex will be `^(/Users|/Users/[a-c].*)$`* ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] `make test` run locally - [x] relevant change in `docs/` folder - [ ] covered with integration tests in `internal/acceptance` - [ ] relevant acceptance tests are passing - [ ] using Go SDK --------- Co-authored-by: Miles Yucht <[email protected]>
- Loading branch information
Showing
7 changed files
with
230 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,16 +316,16 @@ func TestGetEnvAsInt(t *testing.T) { | |
} | ||
|
||
func TestExcludeAuxiliaryDirectories(t *testing.T) { | ||
assert.True(t, excludeAuxiliaryDirectories(workspace.ObjectStatus{Path: "", ObjectType: workspace.Directory})) | ||
assert.True(t, excludeAuxiliaryDirectories(workspace.ObjectStatus{ObjectType: workspace.File})) | ||
assert.True(t, excludeAuxiliaryDirectories(workspace.ObjectStatus{Path: "/Users/[email protected]/abc", | ||
assert.False(t, isAuxiliaryDirectory(workspace.ObjectStatus{Path: "", ObjectType: workspace.Directory})) | ||
assert.False(t, isAuxiliaryDirectory(workspace.ObjectStatus{ObjectType: workspace.File})) | ||
assert.False(t, isAuxiliaryDirectory(workspace.ObjectStatus{Path: "/Users/[email protected]/abc", | ||
ObjectType: workspace.Directory})) | ||
// should be ignored | ||
assert.False(t, excludeAuxiliaryDirectories(workspace.ObjectStatus{Path: "/Users/[email protected]/.ide", | ||
assert.True(t, isAuxiliaryDirectory(workspace.ObjectStatus{Path: "/Users/[email protected]/.ide", | ||
ObjectType: workspace.Directory})) | ||
assert.False(t, excludeAuxiliaryDirectories(workspace.ObjectStatus{Path: "/Shared/.bundle", | ||
assert.True(t, isAuxiliaryDirectory(workspace.ObjectStatus{Path: "/Shared/.bundle", | ||
ObjectType: workspace.Directory})) | ||
assert.False(t, excludeAuxiliaryDirectories(workspace.ObjectStatus{Path: "/Users/[email protected]/abc/__pycache__", | ||
assert.True(t, isAuxiliaryDirectory(workspace.ObjectStatus{Path: "/Users/[email protected]/abc/__pycache__", | ||
ObjectType: workspace.Directory})) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters