diff options
Diffstat (limited to 'app/presenters/ci/build_runner_presenter.rb')
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 33b7899f912..5e35bfc79ef 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -27,14 +27,13 @@ module Ci def git_depth if git_depth_variable git_depth_variable[:value] - elsif Feature.enabled?(:ci_project_git_depth, default_enabled: true) + else project.ci_default_git_depth end.to_i end def refspecs specs = [] - specs << refspec_for_pipeline_ref if should_expose_merge_request_ref? specs << refspec_for_persistent_ref if persistent_ref_exist? if git_depth > 0 @@ -50,23 +49,10 @@ module Ci private - # We will stop exposing merge request refs when we fully depend on persistent refs - # (i.e. remove `refspec_for_pipeline_ref` when we remove `depend_on_persistent_pipeline_ref` feature flag.) - # `ci_force_exposing_merge_request_refs` is an extra feature flag that allows us to - # forcibly expose MR refs even if the `depend_on_persistent_pipeline_ref` feature flag enabled. - # This is useful when we see an unexpected behaviors/reports from users. - # See https://gitlab.com/gitlab-org/gitlab/issues/35140. - def should_expose_merge_request_ref? - return false unless merge_request_ref? - return true if Feature.enabled?(:ci_force_exposing_merge_request_refs, project) - - Feature.disabled?(:depend_on_persistent_pipeline_ref, project, default_enabled: true) - end - def create_archive(artifacts) return unless artifacts[:untracked] || artifacts[:paths] - { + archive = { artifact_type: :archive, artifact_format: :zip, name: artifacts[:name], @@ -75,6 +61,12 @@ module Ci when: artifacts[:when], expire_in: artifacts[:expire_in] } + + if artifacts.dig(:exclude).present? && ::Gitlab::Ci::Features.artifacts_exclude_enabled? + archive.merge(exclude: artifacts[:exclude]) + else + archive + end end def create_reports(reports, expire_in:) @@ -100,15 +92,18 @@ module Ci "+#{Gitlab::Git::TAG_REF_PREFIX}#{ref}:#{RUNNER_REMOTE_TAG_PREFIX}#{ref}" end - def refspec_for_pipeline_ref - "+#{ref}:#{ref}" - end - def refspec_for_persistent_ref "+#{persistent_ref_path}:#{persistent_ref_path}" end def persistent_ref_exist? + ## + # Persistent refs for pipelines definitely exist from GitLab 12.4, + # hence, we don't need to check the ref existence before passing it to runners. + # Checking refs pressurizes gitaly node and should be avoided. + # Issue: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/2143 + return true if Feature.enabled?(:ci_skip_persistent_ref_existence_check) + pipeline.persistent_ref.exist? end |