Skip to content

Commit

Permalink
fix maxRounds check
Browse files Browse the repository at this point in the history
  • Loading branch information
denik committed Jan 16, 2025
1 parent 9d91d72 commit c3ac311
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bundle/config/mutator/resolve_variable_references.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit c3ac311

Please sign in to comment.