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

ci_secure_files.rb « verify « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9bb7f7260c447c0f606adb386b9d9f382fed1e22 (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
33
34
35
36
37
38
39
# frozen_string_literal: true

module Gitlab
  module Verify
    class CiSecureFiles < BatchVerifier
      def name
        'CI Secure Files'
      end

      def describe(object)
        "SecureFile: #{object.id}"
      end

      private

      # rubocop: disable CodeReuse/ActiveRecord
      def all_relation
        ::Ci::SecureFile.all
      end
      # rubocop: enable CodeReuse/ActiveRecord

      def local?(secure_file)
        secure_file.local?
      end

      def expected_checksum(secure_file)
        secure_file.checksum
      end

      def actual_checksum(secure_file)
        Digest::SHA256.hexdigest(secure_file.file.read)
      end

      def remote_object_exists?(secure_file)
        secure_file.file.file.exists?
      end
    end
  end
end