-
Notifications
You must be signed in to change notification settings - Fork 183
Config remote sync command #4289
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
Merged
Merged
Changes from 64 commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
70ee529
Command placeholder
ilyakuz-db b9d9afc
First iteration of YAML generation
ilyakuz-db ef55090
File writer
ilyakuz-db 1bf39c9
Target overrides
ilyakuz-db afc2e87
Cleanup
ilyakuz-db beba54d
Fix invalid Dyn panic
ilyakuz-db d8fac50
Fix test to use structs
ilyakuz-db e0bb6b1
Cleanup
ilyakuz-db 02be4c1
Fix missing tags issue
ilyakuz-db ee2564d
Fix sequences
ilyakuz-db 0436a74
Cleanup
ilyakuz-db 8ac2ba8
Rename
ilyakuz-db 53066eb
Use less dyn.Value conversions
ilyakuz-db d4c5744
More asserts
ilyakuz-db bde1e10
Cleanup
ilyakuz-db b93536f
Fix add fields
ilyakuz-db 072b408
Encapsulate dyn values in resolve selectors function
ilyakuz-db f7be4e3
Cleanup dyn logic
ilyakuz-db fc8baf8
Simplify patching behavior
ilyakuz-db 57842b6
Hardcoded server side defaults
ilyakuz-db 9c4f04b
Normalise values using SDK marshaler
ilyakuz-db a51189f
Cleanup
ilyakuz-db 2e4076f
Move command to the bundle namespace
ilyakuz-db cf867e1
More strict errors
ilyakuz-db dd4d5eb
Better errors
ilyakuz-db 2c70e2c
Fix tests
ilyakuz-db a8e96e6
Go mod update
ilyakuz-db 52c71ae
Merge branch 'main' into config-remote-sync-command
ilyakuz-db 2df4366
Remove unused argument
ilyakuz-db 25603ef
Add terraform defaults
ilyakuz-db 3830ba1
Update acceptance test
ilyakuz-db e1fe23e
Merge branch 'main' of github.com:databricks/cli into config-remote-s…
ilyakuz-db 2335079
Remove webhook_notifications and email_notifications defaults
ilyakuz-db 687ebee
Remove unused functions
ilyakuz-db 72ce457
Add acceptance tests
ilyakuz-db ec82ac7
Stable sort for changes
ilyakuz-db 09afeb5
Update tests
ilyakuz-db 2f1f185
Update storage field
ilyakuz-db e31d1c9
Update tests
ilyakuz-db 3695217
Update tests
ilyakuz-db 2fc8dc3
Move tests to bundle/
ilyakuz-db 0fff83a
Test update
ilyakuz-db 022bb5d
Skip windows
ilyakuz-db 6ef718d
Merge branch 'main' of github.com:databricks/cli into config-remote-s…
ilyakuz-db acefab4
Update test tomls
ilyakuz-db cf60183
Merge branch 'main' of github.com:databricks/cli into config-remote-s…
ilyakuz-db e471f65
Use diff for test output
ilyakuz-db 838885b
Fix globs drift
ilyakuz-db 65bbac9
Remove backup
ilyakuz-db 7c6cc1e
Merge tests, delete task in one test
ilyakuz-db c476464
Cleanup
ilyakuz-db 7092091
New test suite with confgi edits
ilyakuz-db bf2c771
Some cleanup
ilyakuz-db 08805b6
Add tests for permissions
ilyakuz-db ab7b1f7
Enable cloud for resource-speicifc tests, disable permissions
ilyakuz-db fd072fe
Remove diff headers
ilyakuz-db 680c190
Merge branch 'main' of github.com:databricks/cli into config-remote-s…
ilyakuz-db 401e2f3
Fix go mod
ilyakuz-db 5354b4c
Add new defaults, fix cloud tests
ilyakuz-db 56f3856
Fix gcp defaults
ilyakuz-db 56219a7
Fix pipeline name
ilyakuz-db 11b7c51
Update diffs
ilyakuz-db 877c4aa
Fix metastore issues
ilyakuz-db 8ce10c6
Fix data security mode
ilyakuz-db e343f46
Use nodes instead if string builder
ilyakuz-db c36e931
Disable on Windows
ilyakuz-db a9114c3
Remove redundant test
ilyakuz-db 7c6133d
Use more realistic example
ilyakuz-db c92277e
Use existing diff script
ilyakuz-db 00d73f1
Merge branch 'main' of github.com:databricks/cli into config-remote-s…
ilyakuz-db 95c50f3
Fix lint
ilyakuz-db 8521645
Update command help
ilyakuz-db a7383c5
Update config_edits test to make it more readable + merged API calls …
ilyakuz-db e3ac580
Merge branch 'main' of github.com:databricks/cli into config-remote-s…
ilyakuz-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
42 changes: 42 additions & 0 deletions
42
acceptance/bundle/config-remote-sync/config_edits/databricks.yml.tmpl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Users/{{workspace_user_name}}/notebook | ||
| new_cluster: | ||
| spark_version: $DEFAULT_SPARK_VERSION | ||
| node_type_id: $NODE_TYPE_ID | ||
| num_workers: 1 | ||
|
|
||
| targets: | ||
| default: | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| email_notifications: | ||
| on_success: | ||
| - success@example.com | ||
| parameters: | ||
| - name: catalog | ||
| default: main | ||
| - name: env | ||
| default: dev | ||
| trigger: | ||
| periodic: | ||
| interval: 1 | ||
| unit: DAYS | ||
| tags: | ||
| env: dev | ||
| version: v1 | ||
| max_concurrent_runs: 1 | ||
| environments: | ||
| - environment_key: default | ||
| spec: | ||
| environment_version: "3" | ||
| dependencies: | ||
| - ./*.whl |
8 changes: 8 additions & 0 deletions
8
acceptance/bundle/config-remote-sync/config_edits/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
acceptance/bundle/config-remote-sync/config_edits/output.txt
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| Uploading dummy.whl... | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| === Edit config locally | ||
|
|
||
| === Edit job remotely | ||
|
|
||
| === Detect and save changes | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.my_job | ||
| email_notifications.on_failure[0]: update | ||
| max_concurrent_runs: update | ||
| tags['env']: update | ||
|
|
||
|
|
||
| === Configuration changes | ||
| bundle: | ||
| name: test-bundle-[UNIQUE_NAME] | ||
| - | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| spark_version: 13.3.x-snapshot-scala2.12 | ||
| node_type_id: [NODE_TYPE_ID] | ||
| num_workers: 1 | ||
| - | ||
| targets: | ||
| default: | ||
| resources: | ||
| on_success: | ||
| - success@example.com | ||
| on_failure: | ||
| - - config-failure@example.com | ||
| + - remote-failure@example.com | ||
| parameters: | ||
| - name: catalog | ||
| default: main | ||
| interval: 1 | ||
| unit: DAYS | ||
| tags: | ||
| - env: config-production | ||
| - max_concurrent_runs: 3 | ||
| + env: remote-staging | ||
| + max_concurrent_runs: 5 | ||
| timeout_seconds: 3600 | ||
| environments: | ||
| - environment_key: default |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #!/bin/bash | ||
|
|
||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| touch dummy.whl | ||
| $CLI bundle deploy | ||
| job_id="$(read_id.py my_job)" | ||
|
|
||
| title "Edit config locally" | ||
| echo | ||
| # Case 1: Add field in config (on_failure) - will also be added remotely with different value | ||
| # Case 2: Add field in config (timeout_seconds) - will be removed remotely | ||
| # Case 3: Remove field from config (version tag) - will also be removed remotely | ||
| # Case 4: Update field in config (max_concurrent_runs) - will also be updated remotely with different value | ||
| # Case 5: Update field in config (tags.env) - will also be updated remotely with different value | ||
| cat > databricks.yml <<EOF | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Users/{{workspace_user_name}}/notebook | ||
| new_cluster: | ||
| spark_version: $DEFAULT_SPARK_VERSION | ||
| node_type_id: $NODE_TYPE_ID | ||
| num_workers: 1 | ||
|
|
||
| targets: | ||
| default: | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| email_notifications: | ||
| on_success: | ||
| - success@example.com | ||
| on_failure: | ||
| - config-failure@example.com | ||
| parameters: | ||
| - name: catalog | ||
| default: main | ||
| - name: env | ||
| default: dev | ||
| trigger: | ||
| periodic: | ||
| interval: 1 | ||
| unit: DAYS | ||
| tags: | ||
| env: config-production | ||
| max_concurrent_runs: 3 | ||
| timeout_seconds: 3600 | ||
| environments: | ||
| - environment_key: default | ||
| spec: | ||
| environment_version: "3" | ||
| dependencies: | ||
| - ./*.whl | ||
| EOF | ||
|
|
||
| title "Edit job remotely" | ||
| echo | ||
| # Case 1: Add field remotely (on_failure) - also added in config with different value | ||
| edit_resource.py jobs $job_id <<EOF | ||
| r["email_notifications"]["on_failure"] = ["remote-failure@example.com"] | ||
| EOF | ||
|
|
||
| # Case 2: Remove field remotely (timeout_seconds) - added in config | ||
| edit_resource.py jobs $job_id <<EOF | ||
| r.pop("timeout_seconds", None) | ||
| EOF | ||
|
|
||
| # Case 3: Remove field remotely (version tag) - also removed in config | ||
| edit_resource.py jobs $job_id <<EOF | ||
| r["tags"].pop("version", None) | ||
| EOF | ||
|
|
||
| # Case 4: Update field remotely (max_concurrent_runs) - also updated in config with different value | ||
| edit_resource.py jobs $job_id <<EOF | ||
| r["max_concurrent_runs"] = 5 | ||
| EOF | ||
|
|
||
| # Case 5: Update field remotely (tags.env) - also updated in config with different value | ||
| edit_resource.py jobs $job_id <<EOF | ||
| r["tags"]["env"] = "remote-staging" | ||
| EOF | ||
|
|
||
| title "Detect and save changes" | ||
| echo | ||
| cp databricks.yml databricks.yml.backup | ||
| $CLI bundle config-remote-sync --save | ||
|
|
||
| title "Configuration changes" | ||
| echo | ||
| file_diff databricks.yml.backup databricks.yml | ||
| rm databricks.yml.backup | ||
11 changes: 11 additions & 0 deletions
11
acceptance/bundle/config-remote-sync/config_edits/test.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Cloud = true | ||
|
|
||
| RecordRequests = false | ||
|
|
||
| Ignore = [".databricks", "dummy.whl", "databricks.yml", "databricks.yml.backup"] | ||
|
|
||
| [Env] | ||
| DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC = "true" | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct"] |
25 changes: 25 additions & 0 deletions
25
acceptance/bundle/config-remote-sync/formatting_preserved/databricks.yml.tmpl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Top-level comment about the bundle | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| # Resources section with extra spacing | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| # Comment about max concurrent runs | ||
| max_concurrent_runs: 1 | ||
|
|
||
| # Task configuration | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Users/{{workspace_user_name}}/notebook | ||
| new_cluster: | ||
| spark_version: $DEFAULT_SPARK_VERSION | ||
| node_type_id: $NODE_TYPE_ID | ||
| num_workers: 1 # inline comment about workers | ||
|
|
||
| # Tags for categorization | ||
| tags: | ||
| env: dev # environment tag | ||
| team: data-eng |
8 changes: 8 additions & 0 deletions
8
acceptance/bundle/config-remote-sync/formatting_preserved/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
acceptance/bundle/config-remote-sync/formatting_preserved/output.txt
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| === Modify max_concurrent_runs from 1 to 5 | ||
| === Detect and save changes | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.my_job | ||
| max_concurrent_runs: update | ||
|
|
||
|
|
||
| === Configuration changes | ||
| # Top-level comment about the bundle | ||
| bundle: | ||
| name: test-bundle-[UNIQUE_NAME] | ||
| - | ||
| # Resources section with extra spacing | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| # Comment about max concurrent runs | ||
| - max_concurrent_runs: 1 | ||
| - | ||
| + max_concurrent_runs: 5 | ||
| # Task configuration | ||
| tasks: | ||
| - task_key: main | ||
| spark_version: 13.3.x-snapshot-scala2.12 | ||
| node_type_id: [NODE_TYPE_ID] | ||
| num_workers: 1 # inline comment about workers | ||
| - | ||
| # Tags for categorization | ||
| tags: | ||
| env: dev # environment tag |
22 changes: 22 additions & 0 deletions
22
acceptance/bundle/config-remote-sync/formatting_preserved/script
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/bash | ||
|
|
||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| touch dummy.whl | ||
| $CLI bundle deploy | ||
| job_id="$(read_id.py my_job)" | ||
|
|
||
| title "Modify max_concurrent_runs from 1 to 5" | ||
| edit_resource.py jobs $job_id <<EOF | ||
| r["max_concurrent_runs"] = 5 | ||
| EOF | ||
|
|
||
| title "Detect and save changes" | ||
| echo | ||
| cp databricks.yml databricks.yml.backup | ||
| $CLI bundle config-remote-sync --save | ||
|
|
||
| title "Configuration changes" | ||
| echo | ||
| file_diff databricks.yml.backup databricks.yml | ||
| rm databricks.yml.backup |
10 changes: 10 additions & 0 deletions
10
acceptance/bundle/config-remote-sync/formatting_preserved/test.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Cloud = true | ||
|
|
||
| RecordRequests = false | ||
| Ignore = [".databricks", "dummy.whl", "databricks.yml", "databricks.yml.backup"] | ||
|
|
||
| [Env] | ||
| DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC = "true" | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct"] |
34 changes: 34 additions & 0 deletions
34
acceptance/bundle/config-remote-sync/job_fields/databricks.yml.tmpl
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| email_notifications: | ||
| on_success: | ||
| - success@example.com | ||
| parameters: | ||
| - name: catalog | ||
| default: main | ||
| - name: env | ||
| default: dev | ||
| trigger: | ||
| periodic: | ||
| interval: 1 | ||
| unit: DAYS | ||
| tags: | ||
| env: dev | ||
| environments: | ||
| - environment_key: default | ||
| spec: | ||
| environment_version: "3" | ||
| dependencies: | ||
| - ./*.whl | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Users/{{workspace_user_name}}/notebook | ||
| new_cluster: | ||
| spark_version: $DEFAULT_SPARK_VERSION | ||
| node_type_id: $NODE_TYPE_ID | ||
| num_workers: 1 |
8 changes: 8 additions & 0 deletions
8
acceptance/bundle/config-remote-sync/job_fields/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.