Repository navigation
direct: drop legacy empty-ID state entries on delete instead of failing #7676
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
582510c
acc: deploy and destroy fail on a legacy empty-ID state entry
denik de13721
direct: drop legacy empty-ID state entries on delete instead of failing
denik 0d0b993
Add PR link to changelog fragment
denik 49b2f03
direct: document empty-ID state entries in the Gone comments
denik 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * `bundle destroy` and `bundle deploy` no longer fail with "internal error, missing in state" when the state holds an empty-ID entry left by an interrupted recreate in an older CLI. ([#7676](https://github.com/databricks/cli/pull/7676)) |
11 changes: 11 additions & 0 deletions
11
acceptance/bundle/destroy/empty-id-in-state/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,11 @@ | ||
| bundle: | ||
| name: empty-id-in-state | ||
|
|
||
| resources: | ||
| jobs: | ||
| foo: | ||
| name: foo | ||
| bar: | ||
| name: bar | ||
| baz: | ||
| name: baz | ||
9 changes: 9 additions & 0 deletions
9
acceptance/bundle/destroy/empty-id-in-state/databricks_no_bar.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,9 @@ | ||
| bundle: | ||
| name: empty-id-in-state | ||
|
|
||
| resources: | ||
| jobs: | ||
| foo: | ||
| name: foo | ||
| baz: | ||
| name: baz |
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,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/empty-id-in-state/default/files... | ||
| Created jobs.bar | ||
| Created jobs.baz | ||
| Created jobs.foo | ||
| Files: 2 uploaded, 0 deleted | ||
| Resources: 3 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| === An empty-ID entry for a resource in config is planned as a create | ||
|
|
||
| >>> [CLI] bundle plan | ||
| create jobs.foo | ||
|
|
||
| Plan: 1 to add, 0 to change, 0 to delete, 2 unchanged | ||
|
|
||
| === An empty-ID entry for a resource removed from config | ||
|
|
||
| >>> cp databricks_no_bar.yml databricks.yml | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/empty-id-in-state/default/files... | ||
| Created jobs.foo | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 1 unchanged | ||
| ["resources.jobs.baz","resources.jobs.foo"] | ||
|
|
||
| === An empty-ID entry on destroy | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.jobs.foo | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/empty-id-in-state/default | ||
|
|
||
| Destroy: 1 deleted | ||
| no state file |
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 @@ | ||
| state_file=".databricks/bundle/default/resources.json" | ||
|
|
||
| # CLIs before #5173 recorded an empty-ID entry when the create step of a recreate failed. | ||
| blank_id() { | ||
| jq ".state[\"resources.jobs.$1\"].__id__ = \"\"" "$state_file" > state.tmp && mv state.tmp "$state_file" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you use update_file.py helper? (it fails loudly if it cannot do replacement) |
||
| } | ||
|
|
||
| show_state() { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can print_state.py be used? |
||
| if [ -f "$state_file" ]; then jq -c '.state | keys' "$state_file"; else echo "no state file"; fi | ||
| } | ||
|
|
||
| trace $CLI bundle deploy | ||
|
|
||
| title "An empty-ID entry for a resource in config is planned as a create" | ||
| blank_id foo | ||
| trace $CLI bundle plan | ||
|
|
||
| title "An empty-ID entry for a resource removed from config" | ||
| blank_id bar | ||
| trace cp databricks_no_bar.yml databricks.yml | ||
| trace $CLI bundle deploy | ||
| show_state | ||
|
|
||
| title "An empty-ID entry on destroy" | ||
| blank_id baz | ||
| trace $CLI bundle destroy --auto-approve | ||
| show_state | ||
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,6 @@ | ||
| Cloud = false | ||
|
|
||
| Ignore = [ | ||
| "databricks_no_bar.yml", | ||
| ".databricks/" | ||
| ] |
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.
instead of two yaml files, use one with comments like this:
then run grep -v when you need to get rid of bar