Repository navigation
fix(project): skip defaultBranch late-init for empty repo - #459
Open
henrysachs wants to merge 1 commit into
Open
henrysachs wants to merge 1 commit into
henrysachs wants to merge 1 commit into
Conversation
GitLab reports default_branch for empty repos although the branch does not exist and rejects it on edit. Signed-off-by: Henry Sachs <henry.sachs@deutschebahn.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.
Description of your changes
Fixes #444
I have:
make reviewable testto ensure this PR is ready for review. Rango build ./...,go test ./pkg/... ./apis/...,go generatefor apis and pkg (no diff), andgolangci-linton touched packages.Why
A
Projectwithout a repository goesSynced: Falseon its first update. GitLab reportsdefault_branch: mainandempty_repo: truefor an empty project. Observe late-initializeddefaultBranchfrom that value. Every later update sentdefault_branch=mainback, and GitLab rejects it withCould not change HEAD: branch 'main' does not exist.What changed
lateInitializeskipsdefaultBranchwhileempty_repois true. It late-inits as before once the repo has a commit.defaultBranchis kept on empty repos, so GitLab's error still surfaces instead of being dropped.TestLateInitializeDefaultBranchfor empty/non-empty repo with unset/explicit spec.Scope
Project controller late-init only. No API or CRD change. Drift check for
defaultBranchis unchanged; an unset spec is never compared.Verification
default_branch: main,empty_repo: true.PUT default_branch=mainreturns 400Could not change HEAD.PUT description=xreturns 200.TestLateInitializeDefaultBranch/EmptyRepoUnset.Projectwith onlyname: Ready,defaultBranchunset. Description change:Synced=True, GitLab shows the new description.README.mdonmainvia API:empty_repo: false,defaultBranchlate-inits tomain. A further description change staysSynced=True.Projectwith explicitdefaultBranch: mainon an empty repo: update fails with GitLab'sCould not change HEADerror, as intended.How has this code been tested
See Verification.