diff --git a/acceptance/bundle/config-remote-sync/formatting_preserved/databricks.yml.tmpl b/acceptance/bundle/config-remote-sync/formatting_preserved/databricks.yml.tmpl index 22fa31dd68..f35086833f 100644 --- a/acceptance/bundle/config-remote-sync/formatting_preserved/databricks.yml.tmpl +++ b/acceptance/bundle/config-remote-sync/formatting_preserved/databricks.yml.tmpl @@ -23,3 +23,8 @@ resources: tags: env: dev # environment tag team: data-eng + + # Flow-style formatting (should be preserved) + parameters: + - {name: catalog, default: main} + - {name: schema, default: dev} diff --git a/acceptance/bundle/config-remote-sync/formatting_preserved/output.txt b/acceptance/bundle/config-remote-sync/formatting_preserved/output.txt index 524b261d24..7cb9de25a6 100644 --- a/acceptance/bundle/config-remote-sync/formatting_preserved/output.txt +++ b/acceptance/bundle/config-remote-sync/formatting_preserved/output.txt @@ -31,9 +31,14 @@ Resource: resources.jobs.my_job + max_concurrent_runs: 5 # Task configuration tasks: -@@ -19,5 +17,4 @@ +@@ -19,10 +17,8 @@ node_type_id: [NODE_TYPE_ID] num_workers: 1 # inline comment about workers - # Tags for categorization tags: + env: dev # environment tag + team: data-eng +- + # Flow-style formatting (should be preserved) + parameters: diff --git a/acceptance/bundle/config-remote-sync/job_fields/out.test.toml b/acceptance/bundle/config-remote-sync/job_fields/out.test.toml index 382d99ed10..152a1f10a9 100644 --- a/acceptance/bundle/config-remote-sync/job_fields/out.test.toml +++ b/acceptance/bundle/config-remote-sync/job_fields/out.test.toml @@ -1,5 +1,6 @@ Local = true Cloud = true +RequiresUnityCatalog = true [GOOS] windows = false diff --git a/acceptance/bundle/config-remote-sync/job_fields/output.txt b/acceptance/bundle/config-remote-sync/job_fields/output.txt index a434e8c53c..e117ad9d1c 100644 --- a/acceptance/bundle/config-remote-sync/job_fields/output.txt +++ b/acceptance/bundle/config-remote-sync/job_fields/output.txt @@ -14,7 +14,9 @@ Resource: resources.jobs.my_job email_notifications.on_failure: add parameters: replace tags['team']: add - trigger.periodic.interval: replace + trigger.pause_status: add + trigger.periodic: remove + trigger.table_update: add @@ -29,7 +31,7 @@ Resource: resources.jobs.my_job - resources: jobs: -@@ -8,12 +7,17 @@ +@@ -8,13 +7,19 @@ on_success: - success@example.com + no_alert_for_skipped_runs: true @@ -47,12 +49,16 @@ Resource: resources.jobs.my_job + - default: us-east-1 + name: region trigger: - periodic: +- periodic: - interval: 1 -+ interval: 2 - unit: DAYS +- unit: DAYS ++ pause_status: UNPAUSED ++ table_update: ++ table_names: ++ - samples.nyctaxi.trips environments: -@@ -31,5 +35,6 @@ + - environment_key: default +@@ -31,5 +36,6 @@ node_type_id: [NODE_TYPE_ID] num_workers: 1 - diff --git a/acceptance/bundle/config-remote-sync/job_fields/script b/acceptance/bundle/config-remote-sync/job_fields/script index 29dd2d3104..d09c724e3c 100755 --- a/acceptance/bundle/config-remote-sync/job_fields/script +++ b/acceptance/bundle/config-remote-sync/job_fields/script @@ -13,7 +13,8 @@ edit_resource.py jobs $job_id < 0 { + current = current.Content[0] + } + + for _, n := range node.AsSlice() { + current.Style &^= yaml.FlowStyle + + if key, ok := n.StringKey(); ok { + if current.Kind != yaml.MappingNode { + return + } + found := false + // current.Content: [key1, val1, key2, val2, ...] + for i := 0; i+1 < len(current.Content); i += 2 { + if current.Content[i].Value == key { + current = current.Content[i+1] + found = true + break + } + } + if !found { + return + } + continue + } + + if idx, ok := n.Index(); ok { + if current.Kind != yaml.SequenceNode || idx < 0 || idx >= len(current.Content) { + return + } + current = current.Content[idx] + continue + } + + return + } + + clearFlowStyleNodes(current) +} + +func clearFlowStyleNodes(node *yaml.Node) { + node.Style &^= yaml.FlowStyle + for _, child := range node.Content { + clearFlowStyleNodes(child) + } +}