argocd-autopilot
argocd-autopilot copied to clipboard
Installation example from README seems to fail
Hi, I am trying to run the bootstrapping process, every previous command was copy pasted from the README, changing the values where needed. It's a private repo. It did create the repo, but it is left empty.
argocd-autopilot repo bootstrap
INFO cloning repo: https://github.com/rocsys/backend-pipeline.git
INFO repository 'github.com/rocsys/backend-pipeline' was not found, trying to create it...
WARNING --provider not specified, assuming provider from url: github
INFO empty repository, initializing a new one with specified remote
FATAL failed to initialize repository: a branch named "refs/heads/master" already exists
tried to do a second run, thinking now that the repo is created it may follow a different and successful path through the code, which results in:
argocd-autopilot repo bootstrap
INFO cloning repo: https://github.com/rocsys/backend-pipeline.git
INFO empty repository, initializing a new one with specified remote
FATAL failed to initialize repository: a branch named "refs/heads/master" already exists
I could be wrong, but I tried to put some extra debug lines in the code and it seems like the repository is created on some in-memory file system, and then initialized by the gogit package. Then another initialize method seems to be called that tries to initialize on the same file system.
$ go run cmd/main.go repo bootstrap
TRACER 🔍 <- repository.go 224 Revision []
INFO cloning repo: https://github.com/rocsys/backend-pipeline.git
TRACER 🔍 <- repo.go 223 RunRepoBootstrap []
TRACER 🔍 <- common.go 42 func3 []
INFO empty repository, initializing a new one with specified remote
TRACER 🔍 <- repository.go 201 GetRepo []
TRACER 🔍 <- repository.go 408 func10 []
TRACER 🔍 <- repository.go 101 func5 []
DEBUG 6 init repo &{{<nil>} {map[] map[] map[] map[] map[]} [] {<nil>} map[] map[]} &{0xc00015c1a0}
TRACER 🔍 <- repository.go 414 func10 []
TRACER 🔍 <- repository.go 420 func10 []
DEBUG 6 &{0xc000f90570 {username [TOKENREMOVED]} 0xc000140010}
TRACER 🔍 <- repository.go 426 func10 []
DEBUG 6 &{0xc000f90570 {username [TOKENREMOVED]} 0xc000140010}
TRACER 🔍 <- repository.go 476 initBranch []
DEBUG 6 &{0xc000f90570 {username [TOKENREMOVED]} 0xc000140010}
TRACER 🔍 <- repository.go 482 initBranch []
DEBUG 6 &{0xc000f90570 {username [TOKENREMOVED]} 0xc000140010}
TRACER 🔍 <- repository.go 488 initBranch []
DEBUG 6 &{0xc000f90570 {username [TOKENREMOVED]} 0xc000140010}
TRACER 🔍 <- repository.go 497 initBranch []
DEBUG 6 &{0xc000f90570 {username [TOKENREMOVED]} 0xc000140010}
TRACER 🔍 <- repository.go 507 initBranch []
DEBUG 6 refs/heads/master
FATAL failed to initialize repository: a branch named "refs/heads/master" already exists
exit status 1
I see the same problem with v0.2.23.
If I set git config --global init.defaultBranch master I can reproduce the issue.
Using main, something else, or unsetting it should serve as a workaround.
I'm also seeing the same issue with v0.3.1.
I have master as the defaultBranch set in .gitconfig for backward-compatibility reasons, and this is causing a problem for me.