Class: Datadog::CI::Remote::Component
- Inherits:
-
Object
- Object
- Datadog::CI::Remote::Component
- Defined in:
- lib/datadog/ci/remote/component.rb
Overview
Remote configuration component. Responsible for fetching library settings and configuring the library accordingly.
Instance Method Summary collapse
-
#configure(test_session) ⇒ Object
called on test session start, uses test session info to send configuration request to the backend.
-
#initialize(library_settings_client:) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(library_settings_client:) ⇒ Component
Returns a new instance of Component.
11 12 13 |
# File 'lib/datadog/ci/remote/component.rb', line 11 def initialize(library_settings_client:) @library_settings_client = library_settings_client end |
Instance Method Details
#configure(test_session) ⇒ Object
called on test session start, uses test session info to send configuration request to the backend
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/datadog/ci/remote/component.rb', line 16 def configure(test_session) library_configuration = @library_settings_client.fetch(test_session) # sometimes we can skip code coverage for default branch if there are no changes in the repository # backend needs git metadata uploaded for this test session to check if we can skip code coverage if library_configuration.require_git? Datadog.logger.debug { "Library configuration endpoint requires git upload to be finished, waiting..." } git_tree_upload_worker.wait_until_done Datadog.logger.debug { "Requesting library configuration again..." } library_configuration = @library_settings_client.fetch(test_session) if library_configuration.require_git? Datadog.logger.debug { "git metadata upload did not complete in time when configuring library" } end end # configure different components in parallel because they might block on HTTP requests configuration_workers = [ Worker.new { test_optimisation.configure(library_configuration, test_session) }, Worker.new { test_retries.configure(library_configuration, test_session) } ] # launch configuration workers configuration_workers.each(&:perform) # block until all workers are done (or 60 seconds has passed) configuration_workers.each(&:wait_until_done) end |