2018-11-09 13:39:43 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-15 08:22:37 -04:00
|
|
|
module Gitlab
|
|
|
|
module Gpg
|
|
|
|
class InvalidGpgSignatureUpdater
|
|
|
|
def initialize(gpg_key)
|
|
|
|
@gpg_key = gpg_key
|
|
|
|
end
|
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2017-06-15 08:22:37 -04:00
|
|
|
def run
|
2021-12-13 07:12:59 -05:00
|
|
|
CommitSignatures::GpgSignature
|
2017-07-26 04:24:46 -04:00
|
|
|
.select(:id, :commit_sha, :project_id)
|
2021-12-13 07:12:59 -05:00
|
|
|
.where('gpg_key_id IS NULL OR verification_status <> ?', CommitSignatures::GpgSignature.verification_statuses[:verified])
|
2017-09-29 18:55:36 -04:00
|
|
|
.where(gpg_key_primary_keyid: @gpg_key.keyids)
|
2017-10-07 11:47:53 -04:00
|
|
|
.find_each { |sig| sig.gpg_commit&.update_signature!(sig) }
|
2017-06-15 08:22:37 -04:00
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2017-06-15 08:22:37 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|