2018-06-27 07:23:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-10 11:19:50 +00:00
|
|
|
class CreateGpgSignatureWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2017-07-10 11:19:50 +00:00
|
|
|
|
|
|
|
def perform(commit_sha, project_id)
|
|
|
|
project = Project.find_by(id: project_id)
|
2017-07-26 14:01:24 +00:00
|
|
|
return unless project
|
2017-07-10 11:19:50 +00:00
|
|
|
|
2017-08-24 12:21:26 +00:00
|
|
|
commit = project.commit(commit_sha)
|
|
|
|
|
|
|
|
return unless commit
|
|
|
|
|
2017-08-15 11:22:55 +00:00
|
|
|
# This calculates and caches the signature in the database
|
2017-08-24 12:21:26 +00:00
|
|
|
Gitlab::Gpg::Commit.new(commit).signature
|
2017-07-10 11:19:50 +00:00
|
|
|
end
|
|
|
|
end
|