Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIVIS-2938] Git tree uploader #154

Merged
merged 8 commits into from
Apr 9, 2024
Merged

Conversation

anmarchenko
Copy link
Member

@anmarchenko anmarchenko commented Apr 9, 2024

What does this PR do?
Adds Datadog::CI::Git::TreeUploader class that performs git metadata upload

Additional Notes
This is not done yet, there are several features coming in the next PRs:

  • add unshallowing logic
  • wrap TreeUploader in background worker
  • start git upload process when starting test session (behind configuration flag)
  • change library configuration logic to wait for git upload if require_git is true

How to test the change?
Tested on https://github.com/anmarchenko/sidekiq/tree/anmarchenko/datadog-ci-visibility with the following result in debug logs:

D, [2024-04-09T13:06:00.880158 #11671] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/git/tree_uploader.rb:27:in `call') Uploading git tree for repository git@github.com:anmarchenko/sidekiq.git
D, [2024-04-09T13:06:00.895630 #11671] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/git/tree_uploader.rb:66:in `split_known_commits') Checking the latest commits list with backend: ["192916705f15731ffd0154d338654faa25808faf", "eee691c84185dca1ac9f28f30b5d167ed5f62aa8", "e82b8884cb1763eef9a47a3548635c30dceaa710", "c83bde1bb54375f0f853f3680536403ea3c0b84d", "0778417584ffac06d4eafcae0ae3b0f5be3de8ef"]
D, [2024-04-09T13:06:00.895774 #11671] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/transport/http.rb:38:in `request') Sending post request: host=api.datad0g.com; port=443; ssl_enabled=true; compression_enabled=false; path=/api/v2/git/repository/search_commits; payload_size=407
D, [2024-04-09T13:06:01.437905 #11671] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/transport/http.rb:49:in `request') Received server response: Datadog::Core::Transport::HTTP::Adapters::Net::Response ok?:true unsupported?:false, not_found?:false, client_error?:false, server_error?:false, internal_error?:, payload:{"data":[{"id":"eee691c84185dca1ac9f28f30b5d167ed5f62aa8","type":"commit"},{"id":"e82b8884cb1763eef9a47a3548635c30dceaa710","type":"commit"},{"id":"c83bde1bb54375f0f853f3680536403ea3c0b84d","type":"commit"},{"id":"0778417584ffac06d4eafcae0ae3b0f5be3de8ef","type":"commit"}]}, http_response:#<Net::HTTPOK:0x000000011fab21e0>
D, [2024-04-09T13:06:01.438376 #11671] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/git/tree_uploader.rb:49:in `call') Uploading packfiles for commits: ["192916705f15731ffd0154d338654faa25808faf"]
D, [2024-04-09T13:06:01.490725 #11671] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/transport/http.rb:38:in `request') Sending post request: host=api.datad0g.com; port=443; ssl_enabled=true; compression_enabled=false; path=/api/v2/git/repository/packfile; payload_size=2968
D, [2024-04-09T13:06:02.193948 #11671] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/transport/http.rb:49:in `request') Received server response: Datadog::Core::Transport::HTTP::Adapters::Net::Response ok?:true unsupported?:false, not_found?:false, client_error?:false, server_error?:false, internal_error?:, payload:, http_response:#<Net::HTTPNoContent:0x0000000128414118>

@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.04%. Comparing base (ef80446) to head (91af388).

Additional details and impacted files
@@            Coverage Diff             @@
##              1.0     #154      +/-   ##
==========================================
+ Coverage   99.02%   99.04%   +0.01%     
==========================================
  Files         186      190       +4     
  Lines        8421     8595     +174     
  Branches      352      369      +17     
==========================================
+ Hits         8339     8513     +174     
  Misses         82       82              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anmarchenko anmarchenko marked this pull request as ready for review April 9, 2024 11:10
@anmarchenko anmarchenko requested review from a team as code owners April 9, 2024 11:10
@anmarchenko anmarchenko requested a review from tonyredondo April 9, 2024 11:10
@anmarchenko anmarchenko merged commit 86d6c60 into 1.0 Apr 9, 2024
23 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/git_tree_uploader branch April 9, 2024 16:34
@anmarchenko anmarchenko added this to the 1.0 milestone Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants