diff options
Diffstat (limited to 'app')
4 files changed, 35 insertions, 11 deletions
diff --git a/app/services/ci/list_config_variables_service.rb b/app/services/ci/list_config_variables_service.rb index c791a89b804..5320c5be0e9 100644 --- a/app/services/ci/list_config_variables_service.rb +++ b/app/services/ci/list_config_variables_service.rb @@ -29,7 +29,7 @@ module Ci user: current_user, sha: sha).execute - result.valid? ? result.variables_with_data : {} + result.valid? ? result.root_variables_with_data : {} end # Required for ReactiveCaching, it is also used in `reactive_cache_worker_finder` diff --git a/app/services/ci/play_build_service.rb b/app/services/ci/play_build_service.rb index fbf2aad1991..b7aec57f3e3 100644 --- a/app/services/ci/play_build_service.rb +++ b/app/services/ci/play_build_service.rb @@ -5,21 +5,27 @@ module Ci def execute(build, job_variables_attributes = nil) check_access!(build, job_variables_attributes) - # Try to enqueue the build, otherwise create a duplicate. - # - if build.enqueue - build.tap do |build| - build.update!(user: current_user, job_variables_attributes: job_variables_attributes || []) - - AfterRequeueJobService.new(project, current_user).execute(build) - end + if build.can_enqueue? + build.user = current_user + build.job_variables_attributes = job_variables_attributes || [] + build.enqueue! + + AfterRequeueJobService.new(project, current_user).execute(build) + + build else - Ci::RetryJobService.new(project, current_user).execute(build)[:job] + retry_build(build) end + rescue StateMachines::InvalidTransition + retry_build(build.reset) end private + def retry_build(build) + Ci::RetryJobService.new(project, current_user).execute(build)[:job] + end + def check_access!(build, job_variables_attributes) raise Gitlab::Access::AccessDeniedError unless can?(current_user, :play_job, build) diff --git a/app/services/packages/maven/metadata/base_create_xml_service.rb b/app/services/packages/maven/metadata/base_create_xml_service.rb index 4d5cab4978e..3b0d93e1dfb 100644 --- a/app/services/packages/maven/metadata/base_create_xml_service.rb +++ b/app/services/packages/maven/metadata/base_create_xml_service.rb @@ -8,13 +8,16 @@ module Packages INDENT_SPACE = 2 - def initialize(metadata_content:, package:) + def initialize(metadata_content:, package:, logger: nil) @metadata_content = metadata_content @package = package + @logger = logger || Gitlab::AppJsonLogger end private + attr_reader :logger + def xml_doc strong_memoize(:xml_doc) do Nokogiri::XML(@metadata_content) do |config| diff --git a/app/services/packages/maven/metadata/create_versions_xml_service.rb b/app/services/packages/maven/metadata/create_versions_xml_service.rb index 13b6efa8650..c2ac7fea703 100644 --- a/app/services/packages/maven/metadata/create_versions_xml_service.rb +++ b/app/services/packages/maven/metadata/create_versions_xml_service.rb @@ -67,6 +67,12 @@ module Packages def update_release return false if release_coherent? + unless release_xml_node.present? + log_malformed_content('Missing release tag') + + return false + end + if release_from_database release_xml_node.content = release_from_database else @@ -159,6 +165,15 @@ module Packages non_snapshot_versions_from_database.last end end + + def log_malformed_content(reason) + logger.warn( + message: 'A malformed metadata file has been encountered', + reason: reason, + project_id: @package.project_id, + package_id: @package.id + ) + end end end end |