diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /app/services/ci/register_job_service.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'app/services/ci/register_job_service.rb')
-rw-r--r-- | app/services/ci/register_job_service.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 8969b95b81f..b357855db12 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -4,6 +4,8 @@ module Ci # This class responsible for assigning # proper pending build to runner on runner API request class RegisterJobService + include ::Gitlab::Ci::Artifacts::Logger + attr_reader :runner, :metrics TEMPORARY_LOCK_TIMEOUT = 3.seconds @@ -220,10 +222,26 @@ module Ci # We need to use the presenter here because Gitaly calls in the presenter # may fail, and we need to ensure the response has been generated. presented_build = ::Ci::BuildRunnerPresenter.new(build) # rubocop:disable CodeReuse/Presenter + + log_artifacts_context(build) + log_build_dependencies_size(presented_build) + build_json = ::API::Entities::Ci::JobRequest::Response.new(presented_build).to_json Result.new(build, build_json, true) end + def log_build_dependencies_size(presented_build) + return unless ::Feature.enabled?(:ci_build_dependencies_artifacts_logger, type: :ops) + + presented_build.all_dependencies.then do |dependencies| + size = dependencies.sum do |build| + build.available_artifacts? ? build.artifacts_file.size : 0 + end + + log_build_dependencies(size: size, count: dependencies.size) if size > 0 + end + end + def assign_runner!(build, params) build.runner_id = runner.id build.runner_session_attributes = params[:session] if params[:session].present? |