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
|
|
|
|
GpgSignature
|
2017-07-26 04:24:46 -04:00
|
|
|
.select(:id, :commit_sha, :project_id)
|
2017-08-31 14:43:24 -04:00
|
|
|
.where('gpg_key_id IS NULL OR verification_status <> ?', 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
|