centraldogma icon indicating copy to clipboard operation
centraldogma copied to clipboard

Support Git clone over HTTP in Central Dogma.

Open minwoox opened this issue 9 months ago • 3 comments

Motivation: Adding support for Git clone over HTTP in Central Dogma server would enhance its capabilities and make it more user-friendly. This PR partially addressed #543. Please note that I didn't impelent Git over HTTP fully because:

  • We have APIs for commit separately.
  • The underlying Git repository could be changed to another format instead of Git.

Modifications:

  • Added support for Git clone over HTTP to Central Dogma.

Result:

  • You can now clone your repositories via Git clone over HTTP.
    git clone -c http.extraHeader="Authorization: Bearer your-token" https://your-dogma.com/foo/bar.git
    

References:

  • https://git-scm.com/docs/protocol-v2/
  • https://git-scm.com/docs/protocol-capabilities/
  • https://www.git-scm.com/docs/http-protocol
  • https://www.git-scm.com/docs/git-upload-pack
  • https://git-scm.com/docs/protocol-common
  • https://git-scm.com/docs/pack-format/

The CLI command that allows you to view the packets being sent and received:

GIT_TRACE=2 GIT_CURL_VERBOSE=2 GIT_TRACE_PERFORMANCE=2 GIT_TRACE_PACK_ACCESS=2 GIT_TRACE_PACKET=2 GIT_TRACE_PACKFILE=2 GIT_TRACE_SETUP=2 GIT_TRACE_SHALLOW=2  git clone --depth=1 https://github.com/line/armeria.git

minwoox avatar May 08 '24 07:05 minwoox

As a follow-up, could you also add an integration test that makes sure if this implementation works with Spring Cloud Config Server?

Thanks! Created. 😉 https://github.com/line/centraldogma/issues/955

minwoox avatar May 09 '24 08:05 minwoox

@trustin, thanks! All addressed. 😉

minwoox avatar May 09 '24 10:05 minwoox

Codecov Report

Attention: Patch coverage is 81.39535% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 66.47%. Comparing base (aae194c) to head (f3079e9). Report is 11 commits behind head on main.

:exclamation: Current head f3079e9 differs from pull request most recent head 7c93f12. Consider uploading reports for the commit 7c93f12 to get more accurate results

Files Patch % Lines
...ntraldogma/server/internal/api/GitHttpService.java 84.21% 8 Missing and 4 partials :warning:
...er/internal/storage/project/ProjectApiManager.java 33.33% 1 Missing and 1 partial :warning:
...rnal/storage/repository/DefaultMetaRepository.java 0.00% 1 Missing :warning:
...internal/storage/repository/RepositoryWrapper.java 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #954      +/-   ##
============================================
- Coverage     66.86%   66.47%   -0.40%     
- Complexity     3529     3581      +52     
============================================
  Files           370      377       +7     
  Lines         14531    14859     +328     
  Branches       1563     1594      +31     
============================================
+ Hits           9716     9877     +161     
- Misses         3936     4097     +161     
- Partials        879      885       +6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 09 '24 10:05 codecov[bot]