DataDog / datadog-ci-rb

Ruby library for Datadog test visibility
https://docs.datadoghq.com/continuous_integration/tests/ruby
Other
8 stars 4 forks source link

[CIVIS-2938] Git tree uploader #154

Closed anmarchenko closed 6 months ago

anmarchenko commented 6 months ago

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:

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 commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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 ```

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