Repository navigation
Quote resource keys in bundle config sync paths #7328
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
+215
−20
Merged
Changes from all commits
Commits
Show all changes
3 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
27 changes: 27 additions & 0 deletions
27
acceptance/bundle/config-remote-sync/resource_keys/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,27 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| variables: | ||
| notebook_root: | ||
| default: /Users/{{workspace_user_name}} | ||
|
|
||
| resources: | ||
| jobs: | ||
| "job with spaces": | ||
| name: spaced-job | ||
| tasks: | ||
| - task_key: main | ||
| timeout_seconds: 60 | ||
| notebook_task: | ||
| notebook_path: ${var.notebook_root}/notebook | ||
| "job's\"quotes": | ||
| name: quoted-job | ||
| tasks: | ||
| - task_key: main | ||
| timeout_seconds: 60 | ||
| notebook_task: | ||
| notebook_path: ${var.notebook_root}/notebook | ||
|
|
||
| targets: | ||
| default: | ||
| mode: development |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/config-remote-sync/resource_keys/out.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,3 @@ | ||
| Cloud = false | ||
| GOOS.windows = false | ||
| EnvMatrix.DMS = ["", "true"] |
110 changes: 110 additions & 0 deletions
110
acceptance/bundle/config-remote-sync/resource_keys/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,110 @@ | ||
|
|
||
| >>> [CLI] bundle deploy -qq | ||
|
|
||
| === Edit job with spaces remotely | ||
| === Sync only job with spaces | ||
| >>> [CLI] bundle config-remote-sync --select-ids jobs:[JOB WITH SPACES_ID] --save | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.job with spaces | ||
| description: add | ||
| tasks[task_key='main'].notebook_task.notebook_path: replace | ||
| tasks[task_key='main'].timeout_seconds: replace | ||
|
|
||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
| --- databricks.yml.backup | ||
| +++ databricks.yml | ||
| @@ -12,7 +12,8 @@ | ||
| tasks: | ||
| - task_key: main | ||
| - timeout_seconds: 60 | ||
| + timeout_seconds: 900 | ||
| notebook_task: | ||
| - notebook_path: ${var.notebook_root}/notebook | ||
| + notebook_path: ${var.notebook_root}/notebook_updated | ||
| + description: Remote description | ||
| "job's\"quotes": | ||
| name: quoted-job | ||
|
|
||
| === Syncing job with spaces again is idempotent | ||
| >>> [CLI] bundle config-remote-sync --select-ids jobs:[JOB WITH SPACES_ID] --save | ||
| No changes detected. | ||
|
|
||
|
|
||
| === Add a sibling task in job with spaces | ||
| >>> [CLI] bundle config-remote-sync --select-ids jobs:[JOB WITH SPACES_ID] --save | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.job with spaces | ||
| tasks[task_key='added']: add | ||
|
|
||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
| --- databricks.yml.backup | ||
| +++ databricks.yml | ||
| @@ -15,4 +15,7 @@ | ||
| notebook_task: | ||
| notebook_path: ${var.notebook_root}/notebook_updated | ||
| + - notebook_task: | ||
| + notebook_path: ${var.notebook_root}/notebook_updated_sibling | ||
| + task_key: added | ||
| description: Remote description | ||
| "job's\"quotes": | ||
|
|
||
| === Edit job's"quotes remotely | ||
| === Sync only job's"quotes | ||
| >>> [CLI] bundle config-remote-sync --select-ids jobs:[JOB'S\"QUOTES_ID] --save | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.job's"quotes | ||
| description: add | ||
| tasks[task_key='main'].notebook_task.notebook_path: replace | ||
| tasks[task_key='main'].timeout_seconds: replace | ||
|
|
||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
| --- databricks.yml.backup | ||
| +++ databricks.yml | ||
| @@ -23,7 +23,8 @@ | ||
| tasks: | ||
| - task_key: main | ||
| - timeout_seconds: 60 | ||
| + timeout_seconds: 900 | ||
| notebook_task: | ||
| - notebook_path: ${var.notebook_root}/notebook | ||
| + notebook_path: ${var.notebook_root}/notebook_updated | ||
| + description: Remote description | ||
|
|
||
| targets: | ||
|
|
||
| === Syncing job's"quotes again is idempotent | ||
| >>> [CLI] bundle config-remote-sync --select-ids jobs:[JOB'S\"QUOTES_ID] --save | ||
| No changes detected. | ||
|
|
||
|
|
||
| === Add a sibling task in job's"quotes | ||
| >>> [CLI] bundle config-remote-sync --select-ids jobs:[JOB'S\"QUOTES_ID] --save | ||
| Detected changes in 1 resource(s): | ||
|
|
||
| Resource: resources.jobs.job's"quotes | ||
| tasks[task_key='added']: add | ||
|
|
||
|
|
||
|
|
||
| >>> diff.py databricks.yml.backup databricks.yml | ||
| --- databricks.yml.backup | ||
| +++ databricks.yml | ||
| @@ -26,4 +26,7 @@ | ||
| notebook_task: | ||
| notebook_path: ${var.notebook_root}/notebook_updated | ||
| + - notebook_task: | ||
| + notebook_path: ${var.notebook_root}/notebook_updated_sibling | ||
| + task_key: added | ||
| description: Remote description | ||
|
|
||
|
|
||
| >>> [CLI] bundle destroy --auto-approve -qq |
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,45 @@ | ||
| #!/bin/bash | ||
|
|
||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve -qq | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| trace $CLI bundle deploy -qq | ||
|
|
||
| for key in 'job with spaces' "job's\"quotes"; do | ||
| job_id="$(read_id.py "$key")" | ||
|
|
||
| title "Edit $key remotely" | ||
| edit_resource.py jobs "$job_id" <<'PYEDIT' | ||
| r["tasks"][0]["timeout_seconds"] = 900 | ||
| r["tasks"][0]["notebook_task"]["notebook_path"] += "_updated" | ||
| r["description"] = "Remote description" | ||
| PYEDIT | ||
|
|
||
| title "Sync only $key" | ||
| cp databricks.yml databricks.yml.backup | ||
| trace $CLI bundle config-remote-sync --select-ids "jobs:$job_id" --save | ||
| trace diff.py databricks.yml.backup databricks.yml | ||
| rm databricks.yml.backup | ||
|
|
||
| title "Syncing $key again is idempotent" | ||
| trace $CLI bundle config-remote-sync --select-ids "jobs:$job_id" --save | contains.py "No changes detected." | ||
|
|
||
| title "Add a sibling task in $key" | ||
| edit_resource.py jobs "$job_id" <<'PYEDIT' | ||
| r["tasks"].append({ | ||
| "task_key": "added", | ||
| "notebook_task": { | ||
| "notebook_path": r["tasks"][0]["notebook_task"]["notebook_path"] + "_sibling" | ||
| }, | ||
| }) | ||
| PYEDIT | ||
|
|
||
| cp databricks.yml databricks.yml.backup | ||
| trace $CLI bundle config-remote-sync --select-ids "jobs:$job_id" --save | ||
| trace diff.py databricks.yml.backup databricks.yml | ||
| rm databricks.yml.backup | ||
| done |
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,4 @@ | ||
| RecordRequests = false | ||
| Ignore = [".databricks", "databricks.yml", "databricks.yml.backup"] | ||
|
|
||
| Env.DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC = "true" |
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
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
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
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.
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.
seems you can have ther same issue with fieldPath? you can do structpath.StringKey(resourcePath, fieldPath).String() for reliable representation.