flipt-io / flipt

Enterprise-ready, GitOps enabled, CloudNative feature management solution
https://flipt.io
GNU General Public License v3.0
3.63k stars 197 forks source link

[Bug]: GitOps for Azure DevOps repos doesn't work (over HTTP) #3476

Open baterja opened 1 day ago

baterja commented 1 day ago

Bug Description

Error: performing initial clone: unexpected client error: unexpected requesting "https://dev.azure.com/org/project/_git/repo/git-upload-pack" status code: 400

Essentially we hit https://github.com/go-git/go-git/issues/64. Technically it's not flipt issue per se, but I wanted to report it there for visibility (so it will also show up in go-git issue as mentioned in another repo).

Version Info

1.48.1

Search

Steps to Reproduce

docker run -it --rm -p 8080:8080 -p 9000:9000 -e FLIPT_STORAGE_TYPE=git -e FLIPT_STORAGE_GIT_DIRECTORY="src/" -e FLIPT_STORAGE_GIT_REPOSITORY="https://dev.azure.com/org/project/_git/repo" -e FLIPT_STORAGE_GIT_REF=branch_name -e FLIPT_STORAGE_GIT_AUTHENTICATION_BASIC_USERNAME=<username> -e FLIPT_STORAGE_GIT_AUTHENTICATION_BASIC_PASSWORD=<PAT> flipt/flipt:v1.48.1

Expected Behavior

Being able to clone Azure DevOps repositories just like every other git repo.

Additional Context

No response

GeorgeMac commented 1 day ago

Thanks for raising this @baterja 🙏 I see some folks updating from 5.10 to 5.11 and claiming that solves it, but we're on 5.12 (and we were on 5.12 for Flipt version 1.48.1 too). So that is a mystery 🤔 I wonder if they regressed.

GeorgeMac commented 1 day ago

I think I see, go-git doesn't fully support multi_ack and only support v2 cloning, not subsequent fetches. We clone and subsequently (continously) fetch in Flipt. Hmmm pesky.

GeorgeMac commented 1 day ago

I think we also have to manually remove mutli-ack and multi-ack-detailed from the unsupported capabilities list: https://github.com/fluxcd/go-git/blob/9c7d2df0f3b85745bea4d764e51ab9e811bf644d/plumbing/protocol/packp/srvresp.go#L49-L51

In order for the initial clone to work, which is why you see the error immediately. We could definitely remove that first and see what happens (I expect subsequent fetches might be problematic).

A lazy and expensive fix to get Azure unblocked might be to switch to periodic full clones with these capabilities removed from the unsupported list. It would get things unblocked at-least. Maybe if we're brave enough, we could lend some cycles to investigating the work required to add multi-ack support to go-git (I assume this is a very non-trivial exercise).