Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nextchanges/bundles/triggers-pause-presets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Apply `presets.trigger_pause_status` and the development mode pause default to `triggers[]` entries on jobs. ([#7450](https://github.com/databricks/cli/pull/7450))
44 changes: 44 additions & 0 deletions acceptance/bundle/presets/triggers_pause_status/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
bundle:
name: test-bundle

resources:
jobs:
mixed_cron:
name: mixed_cron
triggers:
- schedule:
quartz_cron_expression: "0 0 0 1 1 ? 2099"
timezone_id: UTC
- schedule:
quartz_cron_expression: "0 0 0 2 1 ? 2099"
timezone_id: UTC
pause_status: UNPAUSED

file_arrival:
name: file_arrival
triggers:
- file_arrival:
url: /Volumes/main/default/landing/

table_update:
name: table_update
triggers:
- table_update:
table_names:
- main.default.src
- schedule:
quartz_cron_expression: "0 0 0 3 1 ? 2099"
timezone_id: UTC
pause_status: PAUSED

targets:
no_preset:
default: true
paused:
presets:
trigger_pause_status: PAUSED
unpaused:
presets:
trigger_pause_status: UNPAUSED
dev:
mode: development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cloud = false
EnvMatrix.DMS = ["", "true"]
68 changes: 68 additions & 0 deletions acceptance/bundle/presets/triggers_pause_status/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

=== Target: no_preset

>>> [CLI] bundle validate -t no_preset -o json
{
"file_arrival": [
null
],
"mixed_cron": [
null,
"UNPAUSED"
],
"table_update": [
null,
"PAUSED"
]
}

=== Target: paused

>>> [CLI] bundle validate -t paused -o json
{
"file_arrival": [
"PAUSED"
],
"mixed_cron": [
"PAUSED",
"UNPAUSED"
],
"table_update": [
"PAUSED",
"PAUSED"
]
}

=== Target: unpaused

>>> [CLI] bundle validate -t unpaused -o json
{
"file_arrival": [
"UNPAUSED"
],
"mixed_cron": [
"UNPAUSED",
"UNPAUSED"
],
"table_update": [
"UNPAUSED",
"PAUSED"
]
}

=== Target: dev

>>> [CLI] bundle validate -t dev -o json
{
"file_arrival": [
"PAUSED"
],
"mixed_cron": [
"PAUSED",
"UNPAUSED"
],
"table_update": [
"PAUSED",
"PAUSED"
]
}
4 changes: 4 additions & 0 deletions acceptance/bundle/presets/triggers_pause_status/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
for target in no_preset paused unpaused dev; do
title "Target: $target"
trace $CLI bundle validate -t $target -o json | jq '.resources.jobs | map_values([.triggers[].pause_status])'
done
5 changes: 5 additions & 0 deletions bundle/config/mutator/resourcemutator/apply_presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos
if j.Trigger != nil && j.Trigger.PauseStatus == "" {
j.Trigger.PauseStatus = paused
}
for i := range j.Triggers {
if j.Triggers[i].PauseStatus == "" {
j.Triggers[i].PauseStatus = paused
}
}
}
}

Expand Down
Loading