-
Notifications
You must be signed in to change notification settings - Fork 135
direct: Limit server_side_default to regular fields #4038
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 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions
15
acceptance/bundle/resources/permissions/jobs/added_remotely/databricks.yml
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,15 @@ | ||
| bundle: | ||
| name: test-bundle | ||
|
|
||
| resources: | ||
| jobs: | ||
| job_with_permissions: | ||
| name: job permissions added remotely | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Workspace/Users/user@example.com/notebook | ||
| source: WORKSPACE | ||
| permissions: | ||
| - level: CAN_VIEW | ||
| user_name: viewer@example.com |
102 changes: 102 additions & 0 deletions
102
acceptance/bundle/resources/permissions/jobs/added_remotely/out.plan.direct.json
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,102 @@ | ||
| { | ||
| "plan": { | ||
| "resources.jobs.job_with_permissions": { | ||
| "action": "skip", | ||
| "remote_state": { | ||
| "created_time": [UNIX_TIME_MILLIS], | ||
| "creator_user_name": "[USERNAME]", | ||
| "job_id": [JOB_ID], | ||
| "run_as_user_name": "[USERNAME]", | ||
| "settings": { | ||
| "deployment": { | ||
| "kind": "BUNDLE", | ||
| "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json" | ||
| }, | ||
| "edit_mode": "UI_LOCKED", | ||
| "email_notifications": {}, | ||
| "format": "MULTI_TASK", | ||
| "max_concurrent_runs": 1, | ||
| "name": "job permissions added remotely", | ||
| "queue": { | ||
| "enabled": true | ||
| }, | ||
| "tasks": [ | ||
| { | ||
| "notebook_task": { | ||
| "notebook_path": "/Workspace/Users/user@example.com/notebook", | ||
| "source": "WORKSPACE" | ||
| }, | ||
| "task_key": "main" | ||
| } | ||
| ], | ||
| "timeout_seconds": 0, | ||
| "webhook_notifications": {} | ||
| } | ||
| }, | ||
| "changes": { | ||
| "remote": { | ||
| "email_notifications": { | ||
| "action": "skip", | ||
| "reason": "server_side_default" | ||
| }, | ||
| "timeout_seconds": { | ||
| "action": "skip", | ||
| "reason": "server_side_default" | ||
| }, | ||
| "webhook_notifications": { | ||
| "action": "skip", | ||
| "reason": "server_side_default" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "resources.jobs.job_with_permissions.permissions": { | ||
| "depends_on": [ | ||
| { | ||
| "node": "resources.jobs.job_with_permissions", | ||
| "label": "${resources.jobs.job_with_permissions.id}" | ||
| } | ||
| ], | ||
| "action": "update", | ||
| "new_state": { | ||
| "value": { | ||
| "object_id": "/jobs/[JOB_ID]", | ||
| "permissions": [ | ||
| { | ||
| "permission_level": "CAN_VIEW", | ||
| "user_name": "viewer@example.com" | ||
| }, | ||
| { | ||
| "permission_level": "IS_OWNER", | ||
| "user_name": "[USERNAME]" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "remote_state": { | ||
| "object_id": "/jobs/[JOB_ID]", | ||
| "permissions": [ | ||
| { | ||
| "permission_level": "IS_OWNER", | ||
| "user_name": "[USERNAME]" | ||
| }, | ||
| { | ||
| "permission_level": "CAN_VIEW", | ||
| "user_name": "viewer@example.com" | ||
| }, | ||
| { | ||
| "group_name": "admin-team", | ||
| "permission_level": "CAN_MANAGE" | ||
| } | ||
| ] | ||
| }, | ||
| "changes": { | ||
| "remote": { | ||
| "permissions[group_name='admin-team']": { | ||
| "action": "update" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
acceptance/bundle/resources/permissions/jobs/added_remotely/out.plan.terraform.json
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 @@ | ||
| { | ||
| "plan": { | ||
| "resources.jobs.job_with_permissions": { | ||
| "action": "skip" | ||
| }, | ||
| "resources.jobs.job_with_permissions.permissions": { | ||
| "action": "update" | ||
| } | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
acceptance/bundle/resources/permissions/jobs/added_remotely/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
161 changes: 161 additions & 0 deletions
161
acceptance/bundle/resources/permissions/jobs/added_remotely/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,161 @@ | ||
|
|
||
| >>> [CLI] bundle plan | ||
| create jobs.job_with_permissions | ||
| create jobs.job_with_permissions.permissions | ||
|
|
||
| Plan: 2 to add, 0 to change, 0 to delete, 0 unchanged | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged | ||
|
|
||
| >>> [CLI] permissions get jobs [JOB_ID] | ||
| { | ||
| "access_control_list": [ | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":false, | ||
| "permission_level":"CAN_VIEW" | ||
| } | ||
| ], | ||
| "display_name":"viewer@example.com", | ||
| "user_name":"viewer@example.com" | ||
| }, | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":false, | ||
| "permission_level":"IS_OWNER" | ||
| } | ||
| ], | ||
| "display_name":"[USERNAME]", | ||
| "user_name":"[USERNAME]" | ||
| }, | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":true, | ||
| "inherited_from_object": [ | ||
| "/jobs/" | ||
| ], | ||
| "permission_level":"CAN_MANAGE" | ||
| } | ||
| ], | ||
| "group_name":"admins" | ||
| } | ||
| ], | ||
| "object_id":"/jobs/[JOB_ID]", | ||
| "object_type":"job" | ||
| } | ||
|
|
||
| === Add permissions out of band | ||
| >>> [CLI] permissions set jobs [JOB_ID] --json @remote_add.json | ||
| { | ||
| "access_control_list": [ | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":false, | ||
| "permission_level":"IS_OWNER" | ||
| } | ||
| ], | ||
| "display_name":"[USERNAME]", | ||
| "user_name":"[USERNAME]" | ||
| }, | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":false, | ||
| "permission_level":"CAN_VIEW" | ||
| } | ||
| ], | ||
| "display_name":"viewer@example.com", | ||
| "user_name":"viewer@example.com" | ||
| }, | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":false, | ||
| "permission_level":"CAN_MANAGE" | ||
| } | ||
| ], | ||
| "group_name":"admin-team" | ||
| }, | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":true, | ||
| "inherited_from_object": [ | ||
| "/jobs/" | ||
| ], | ||
| "permission_level":"CAN_MANAGE" | ||
| } | ||
| ], | ||
| "group_name":"admins" | ||
| } | ||
| ], | ||
| "object_id":"/jobs/[JOB_ID]", | ||
| "object_type":"job" | ||
| } | ||
|
|
||
| >>> [CLI] bundle plan | ||
| update jobs.job_with_permissions.permissions | ||
|
|
||
| Plan: 0 to add, 1 to change, 0 to delete, 1 unchanged | ||
|
|
||
| >>> [CLI] bundle plan -o json | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged | ||
|
|
||
| >>> [CLI] permissions get jobs [JOB_ID] | ||
| { | ||
| "access_control_list": [ | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":false, | ||
| "permission_level":"CAN_VIEW" | ||
| } | ||
| ], | ||
| "display_name":"viewer@example.com", | ||
| "user_name":"viewer@example.com" | ||
| }, | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":false, | ||
| "permission_level":"IS_OWNER" | ||
| } | ||
| ], | ||
| "display_name":"[USERNAME]", | ||
| "user_name":"[USERNAME]" | ||
| }, | ||
| { | ||
| "all_permissions": [ | ||
| { | ||
| "inherited":true, | ||
| "inherited_from_object": [ | ||
| "/jobs/" | ||
| ], | ||
| "permission_level":"CAN_MANAGE" | ||
| } | ||
| ], | ||
| "group_name":"admins" | ||
| } | ||
| ], | ||
| "object_id":"/jobs/[JOB_ID]", | ||
| "object_type":"job" | ||
| } |
7 changes: 7 additions & 0 deletions
7
acceptance/bundle/resources/permissions/jobs/added_remotely/remote_add.json
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,7 @@ | ||
| { | ||
| "access_control_list": [ | ||
| {"permission_level": "IS_OWNER", "user_name": "tester@databricks.com"}, | ||
| {"permission_level": "CAN_VIEW", "user_name": "viewer@example.com"}, | ||
| {"permission_level": "CAN_MANAGE", "group_name": "admin-team"} | ||
| ] | ||
| } |
18 changes: 18 additions & 0 deletions
18
acceptance/bundle/resources/permissions/jobs/added_remotely/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,18 @@ | ||
| trace $CLI bundle plan | ||
| trace $CLI bundle deploy | ||
| trace $CLI bundle plan | ||
|
|
||
| job_id="$(read_id.py jobs job_with_permissions)" | ||
| echo "$job_id:JOB_ID" >> ACC_REPLS | ||
|
|
||
| trace $CLI permissions get jobs "$job_id" | ||
|
|
||
| title "Add permissions out of band" | ||
| trace $CLI permissions set jobs "$job_id" --json @remote_add.json | ||
|
|
||
| trace $CLI bundle plan | ||
| trace $CLI bundle plan -o json > out.plan.$DATABRICKS_BUNDLE_ENGINE.json | ||
| trace $CLI bundle deploy | ||
| trace $CLI bundle plan | ||
|
|
||
| trace $CLI permissions get jobs "$job_id" |
1 change: 1 addition & 0 deletions
1
acceptance/bundle/resources/permissions/jobs/added_remotely/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 @@ | ||
| RecordRequests = false |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you include a comment that explains the reasoning?
This check enforces that server side defaults are only allowed for paths that end with a struct/map key. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added 3d18057