From c3ac311e9c48f2059a05a4794fe84529e64acc8e Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 16 Jan 2025 14:20:36 +0100 Subject: [PATCH] fix maxRounds check --- bundle/config/mutator/resolve_variable_references.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundle/config/mutator/resolve_variable_references.go b/bundle/config/mutator/resolve_variable_references.go index 23d35952e4..84c5c741c5 100644 --- a/bundle/config/mutator/resolve_variable_references.go +++ b/bundle/config/mutator/resolve_variable_references.go @@ -94,8 +94,9 @@ func (m *resolveVariableReferences) Apply(ctx context.Context, b *bundle.Bundle) varPath := dyn.NewPath(dyn.Key("var")) var diags diag.Diagnostics + maxRounds := 1 + m.extraRounds - for round := range 1 + m.extraRounds { + for round := range maxRounds { hasUpdates, newDiags := m.resolveOnce(b, prefixes, varPath) diags = diags.Extend(newDiags) @@ -108,12 +109,13 @@ func (m *resolveVariableReferences) Apply(ctx context.Context, b *bundle.Bundle) break } - if round >= maxResolutionRounds-1 { + if round >= maxRounds-1 { diags = diags.Append(diag.Diagnostic{ Severity: diag.Warning, Summary: fmt.Sprintf("Detected unresolved variables after %d resolution rounds", round+1), // Would be nice to include names of the variables there, but that would complicate things more }) + break } } return diags