fix: branch planner plans against main instead of PR branch when using Flux Operator#1730
Open
maruina wants to merge 1 commit into
Open
fix: branch planner plans against main instead of PR branch when using Flux Operator#1730maruina wants to merge 1 commit into
maruina wants to merge 1 commit into
Conversation
Clear all higher-precedence GitRepository reference fields after DeepCopy() so only Branch takes effect on PR-specific sources. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Branch planner's
reconcileSourcecreates PR-specificGitRepositoryobjects by deep-copying the original source spec and settingspec.Reference.Branchto the PR branch.However, this doesn't work as expected when using a
FluxInstanceobject: with a spec similar tothis gets translated into a
GitRepositoryobject withFluxInstance.sync.ref: refs/heads/mainis mapped toGitRepository.spec.ref.name: refs/heads/mainand notspec.ref.branch.According to the Gitrepository type, the order of precedence is:
Name > Commit > SemVer > Tag > BranchThe problem is the branch planner's deep copy preserves that
namefield, which always wins overbranch.This causes PR plans to run against main instead of the PR branch.
This PR fix the issue by clearing those higher precedence field and setting just the branch