Skip to content

Commit 4a693c0

Browse files
authored
Apply presets before applying defaults (#2778)
## Why Presets should have more priority and need to see the configuration before common defaults are applied, because this mutator is making decisions based on presence of user-provided fields in the configuration. This does not matter currently where we only have few defaults, but will start to matter once we add more, like in #2767 Previous PR #2777 makes it possible to move this without issues. ## Tests Existing tests for empty resource added in #2771 and #2774
1 parent 842bcd6 commit 4a693c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bundle/config/mutator/resourcemutator/resource_mutator.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ func applyInitializeMutators(ctx context.Context, b *bundle.Bundle) diag.Diagnos
3535
// OR corresponding fields on ForEachTask if that is present
3636
// Overrides job compute settings with a specified cluster ID for development or testing
3737
OverrideCompute(),
38+
39+
// ApplyPresets should have more priority than defaults below, so it should be run first
40+
ApplyPresets(),
3841
)
3942

4043
if diags.HasError() {
@@ -58,8 +61,6 @@ func applyInitializeMutators(ctx context.Context, b *bundle.Bundle) diag.Diagnos
5861
}
5962

6063
diags = diags.Extend(bundle.ApplySeq(ctx, b,
61-
ApplyPresets(),
62-
6364
// Reads (typed): b.Config.Resources.Jobs (checks job configurations)
6465
// Updates (typed): b.Config.Resources.Jobs[].Queue (sets Queue.Enabled to true for jobs without queue settings)
6566
// Enable queueing for jobs by default, following the behavior from API 2.2+.

0 commit comments

Comments
 (0)