-
Notifications
You must be signed in to change notification settings - Fork 184
Add prompt when a pipeline recreation or deletion happens #1672
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 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
105a3df
Add prompt when a pipeline recreation happens
shreyas-goenka d270727
grammer nit
shreyas-goenka 27af70e
rename
shreyas-goenka a0bc111
Merge remote-tracking branch 'origin' into prompt-on-pipeline-recreate
shreyas-goenka d6c564d
add the why
shreyas-goenka 7e3a453
fix test
shreyas-goenka d9ed8eb
add multiline message
shreyas-goenka 8d2c2ab
Merge remote-tracking branch 'origin' into prompt-on-pipeline-recreate
shreyas-goenka 2f7fa97
add test for pipeline delete as well
shreyas-goenka ec413af
Merge remote-tracking branch 'origin' into prompt-on-pipeline-recreate
shreyas-goenka 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
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,67 @@ | ||
| package phases | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| terraformlib "github.com/databricks/cli/libs/terraform" | ||
| tfjson "github.com/hashicorp/terraform-json" | ||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestParseTerraformActions(t *testing.T) { | ||
| changes := []*tfjson.ResourceChange{ | ||
| { | ||
| Type: "databricks_pipeline", | ||
| Change: &tfjson.Change{ | ||
| Actions: tfjson.Actions{tfjson.ActionCreate}, | ||
| }, | ||
| Name: "create pipeline", | ||
| }, | ||
| { | ||
| Type: "databricks_pipeline", | ||
| Change: &tfjson.Change{ | ||
| Actions: tfjson.Actions{tfjson.ActionDelete}, | ||
| }, | ||
| Name: "delete pipeline", | ||
| }, | ||
| { | ||
| Type: "databricks_pipeline", | ||
| Change: &tfjson.Change{ | ||
| Actions: tfjson.Actions{tfjson.ActionDelete, tfjson.ActionCreate}, | ||
| }, | ||
| Name: "recreate pipeline", | ||
| }, | ||
| { | ||
| Type: "databricks_whatever", | ||
| Change: &tfjson.Change{ | ||
| Actions: tfjson.Actions{tfjson.ActionDelete, tfjson.ActionCreate}, | ||
| }, | ||
| Name: "recreate whatever", | ||
| }, | ||
| } | ||
|
|
||
| res := parseTerraformActions(changes, func(typ string, actions tfjson.Actions) bool { | ||
| if typ != "databricks_pipeline" { | ||
| return false | ||
| } | ||
|
|
||
| if actions.Delete() || actions.Replace() { | ||
| return true | ||
| } | ||
|
|
||
| return false | ||
| }) | ||
|
|
||
| assert.Equal(t, []terraformlib.Action{ | ||
| { | ||
| Action: terraformlib.ActionTypeDelete, | ||
| ResourceType: "databricks_pipeline", | ||
| ResourceName: "delete pipeline", | ||
| }, | ||
| { | ||
| Action: terraformlib.ActionTypeRecreate, | ||
| ResourceType: "databricks_pipeline", | ||
| ResourceName: "recreate pipeline", | ||
| }, | ||
| }, res) | ||
| } |
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
8 changes: 8 additions & 0 deletions
8
internal/bundle/bundles/recreate_pipeline/databricks_template_schema.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,8 @@ | ||
| { | ||
| "properties": { | ||
| "unique_id": { | ||
| "type": "string", | ||
| "description": "Unique ID for the schema and pipeline names" | ||
| } | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
internal/bundle/bundles/recreate_pipeline/template/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 @@ | ||
| bundle: | ||
| name: "bundle-playground" | ||
|
|
||
| variables: | ||
| catalog: | ||
| description: The catalog the DLT pipeline should use. | ||
| default: main | ||
|
|
||
|
|
||
| resources: | ||
| pipelines: | ||
| foo: | ||
| name: test-pipeline-{{.unique_id}} | ||
| libraries: | ||
| - notebook: | ||
| path: ./nb.sql | ||
| development: true | ||
| catalog: ${var.catalog} | ||
|
|
||
| include: | ||
| - "*.yml" | ||
|
|
||
| targets: | ||
| development: | ||
| default: 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,2 @@ | ||
| -- Databricks notebook source | ||
| select 1 |
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.
Uh oh!
There was an error while loading. Please reload this page.