2017-06-14 07:17:34 +00:00
|
|
|
class GpgSignature < ActiveRecord::Base
|
2017-07-20 13:44:15 +00:00
|
|
|
include ShaAttribute
|
|
|
|
|
|
|
|
sha_attribute :commit_sha
|
|
|
|
sha_attribute :gpg_key_primary_keyid
|
|
|
|
|
2017-06-14 07:17:34 +00:00
|
|
|
belongs_to :project
|
|
|
|
belongs_to :gpg_key
|
|
|
|
|
|
|
|
validates :commit_sha, presence: true
|
2017-07-25 19:20:48 +00:00
|
|
|
validates :project_id, presence: true
|
2017-06-15 10:43:04 +00:00
|
|
|
validates :gpg_key_primary_keyid, presence: true
|
2017-07-06 08:17:09 +00:00
|
|
|
|
2017-07-25 14:23:52 +00:00
|
|
|
def gpg_key_primary_keyid
|
|
|
|
super&.upcase
|
|
|
|
end
|
|
|
|
|
2017-07-06 08:17:09 +00:00
|
|
|
def commit
|
|
|
|
project.commit(commit_sha)
|
|
|
|
end
|
2017-08-15 11:22:55 +00:00
|
|
|
|
|
|
|
def gpg_commit
|
2017-08-24 12:21:26 +00:00
|
|
|
Gitlab::Gpg::Commit.new(commit)
|
2017-08-15 11:22:55 +00:00
|
|
|
end
|
2017-06-14 07:17:34 +00:00
|
|
|
end
|