Skip to content

Commit 3ca6773

Browse files
committed
use IsEqual, fix run_as
1 parent 89bf0cc commit 3ca6773

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

acceptance/bundle/migrate/runas/out.plan.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"changes": {
3838
"run_as": {
3939
"action": "skip",
40-
"reason": "field_triggers",
40+
"reason": "override",
4141
"old": {
4242
"service_principal_name": "[UUID]"
4343
},

bundle/direct/bundle_plan.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func prepareChanges(ctx context.Context, adapter *dresources.Adapter, localDiff,
361361
}
362362
} else {
363363
entry.Remote = ch.Old
364-
if !reflect.DeepEqual(entry.New, ch.New) {
364+
if !structdiff.IsEqual(entry.New, ch.New) {
365365
// this is not fatal (may result in unexpected drift or undetected change but not incorrect deploy), but good to log this
366366
log.Warnf(ctx, "unexpected local and remote diffs (%T, %T); entry=%v ch=%v", entry.New, ch.New, entry, ch)
367367
}
@@ -387,7 +387,7 @@ func addPerFieldActions(ctx context.Context, adapter *dresources.Adapter, change
387387
// Note, we only consider struct fields here. Adding/removing elements to/from maps and slices should trigger updates.
388388
ch.Action = deployplan.ActionTypeSkipString
389389
ch.Reason = deployplan.ReasonServerSideDefault
390-
} else if reflect.DeepEqual(ch.Remote, ch.New) {
390+
} else if structdiff.IsEqual(ch.Remote, ch.New) {
391391
ch.Action = deployplan.ActionTypeSkipString
392392
ch.Reason = deployplan.ReasonRemoteAlreadySet
393393
} else if action, ok := fieldTriggers[pathString]; ok {

bundle/direct/dresources/pipeline.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55

66
"github.com/databricks/cli/bundle/config/resources"
77
"github.com/databricks/cli/bundle/deployplan"
8+
"github.com/databricks/cli/libs/structs/structdiff"
9+
"github.com/databricks/cli/libs/structs/structpath"
810
"github.com/databricks/cli/libs/utils"
911
"github.com/databricks/databricks-sdk-go"
1012
"github.com/databricks/databricks-sdk-go/service/pipelines"
@@ -125,12 +127,22 @@ func (*ResourcePipeline) FieldTriggers() map[string]deployplan.ActionType {
125127
"storage": deployplan.ActionTypeRecreate,
126128
"ingestion_definition.connection_name": deployplan.ActionTypeRecreate,
127129
"ingestion_definition.ingestion_gateway_id": deployplan.ActionTypeRecreate,
128-
"run_as": deployplan.ActionTypeSkip,
129130
}
130131

131132
return result
132133
}
133134

135+
func (*ResourcePipeline) OverrideChangeDesc(ctx context.Context, path *structpath.PathNode, ch *ChangeDesc, _ *pipelines.GetPipelineResponse) error {
136+
if path.String() == "run_as" {
137+
if structdiff.IsEqual(ch.Old, ch.New) {
138+
ch.Action = deployplan.ActionTypeSkipString
139+
ch.Reason = "override"
140+
}
141+
}
142+
143+
return nil
144+
}
145+
134146
// Note, terraform provider either
135147
// a) reads back state at least once and fails create if state is "failed"
136148
// b) repeatededly reads state until state is "running" (if spec.Contionous is set).

0 commit comments

Comments
 (0)