Welcome to mirror list, hosted at ThFree Co, Russian Federation.

delete_service.rb « job_artifacts « ci « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 65cae03312e793dbaec7059b1e129d19e428a6ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module Ci
  module JobArtifacts
    class DeleteService
      include BaseServiceUtility

      def initialize(build)
        @build = build
      end

      def execute
        if build.project.refreshing_build_artifacts_size?
          Gitlab::ProjectStatsRefreshConflictsLogger.warn_artifact_deletion_during_stats_refresh(
            method: 'Ci::JobArtifacts::DeleteService#execute',
            project_id: build.project_id
          )
        end

        # fix_expire_at is false because in this case we want to explicitly delete the job artifacts
        # this flag is a workaround that will be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/355833
        Ci::JobArtifacts::DestroyBatchService.new(build.job_artifacts.erasable, fix_expire_at: false).execute

        ServiceResponse.success
      end

      private

      attr_reader :build
    end
  end
end