Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8236b12d
Commit
8236b12d
authored
Jun 14, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gpg signature model for gpg verification caching
parent
2f956fae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
0 deletions
+67
-0
app/models/gpg_signature.rb
app/models/gpg_signature.rb
+7
-0
db/migrate/20170613154149_create_gpg_signatures.rb
db/migrate/20170613154149_create_gpg_signatures.rb
+29
-0
db/schema.rb
db/schema.rb
+17
-0
spec/models/gpg_signature_spec.rb
spec/models/gpg_signature_spec.rb
+14
-0
No files found.
app/models/gpg_signature.rb
0 → 100644
View file @
8236b12d
class
GpgSignature
<
ActiveRecord
::
Base
belongs_to
:project
belongs_to
:gpg_key
validates
:commit_sha
,
presence:
true
validates
:project
,
presence:
true
end
db/migrate/20170613154149_create_gpg_signatures.rb
0 → 100644
View file @
8236b12d
class
CreateGpgSignatures
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
create_table
:gpg_signatures
do
|
t
|
t
.
string
:commit_sha
t
.
references
:project
,
index:
true
,
foreign_key:
true
t
.
references
:gpg_key
,
index:
true
,
foreign_key:
true
t
.
string
:gpg_key_primary_keyid
t
.
boolean
:valid_signature
t
.
timestamps_with_timezone
null:
false
end
add_concurrent_index
:gpg_signatures
,
:commit_sha
add_concurrent_index
:gpg_signatures
,
:gpg_key_primary_keyid
end
def
down
remove_concurrent_index
:gpg_signatures
,
:commit_sha
if
index_exists?
(
:gpg_signatures
,
:commit_sha
)
remove_concurrent_index
:gpg_signatures
,
:gpg_key_primary_keyid
if
index_exists?
(
:gpg_signatures
,
:gpg_key_primary_keyid
)
drop_table
:gpg_signatures
end
end
db/schema.rb
View file @
8236b12d
...
...
@@ -552,6 +552,21 @@ ActiveRecord::Schema.define(version: 20170725145659) do
add_index
"gpg_keys"
,
[
"primary_keyid"
],
name:
"index_gpg_keys_on_primary_keyid"
,
using: :btree
add_index
"gpg_keys"
,
[
"user_id"
],
name:
"index_gpg_keys_on_user_id"
,
using: :btree
create_table
"gpg_signatures"
,
force: :cascade
do
|
t
|
t
.
string
"commit_sha"
t
.
integer
"project_id"
t
.
integer
"gpg_key_id"
t
.
string
"gpg_key_primary_keyid"
t
.
boolean
"valid_signature"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
add_index
"gpg_signatures"
,
[
"commit_sha"
],
name:
"index_gpg_signatures_on_commit_sha"
,
using: :btree
add_index
"gpg_signatures"
,
[
"gpg_key_id"
],
name:
"index_gpg_signatures_on_gpg_key_id"
,
using: :btree
add_index
"gpg_signatures"
,
[
"gpg_key_primary_keyid"
],
name:
"index_gpg_signatures_on_gpg_key_primary_keyid"
,
using: :btree
add_index
"gpg_signatures"
,
[
"project_id"
],
name:
"index_gpg_signatures_on_project_id"
,
using: :btree
create_table
"identities"
,
force: :cascade
do
|
t
|
t
.
string
"extern_uid"
t
.
string
"provider"
...
...
@@ -1615,6 +1630,8 @@ ActiveRecord::Schema.define(version: 20170725145659) do
add_foreign_key
"events"
,
"projects"
,
name:
"fk_0434b48643"
,
on_delete: :cascade
add_foreign_key
"forked_project_links"
,
"projects"
,
column:
"forked_to_project_id"
,
name:
"fk_434510edb0"
,
on_delete: :cascade
add_foreign_key
"gpg_keys"
,
"users"
add_foreign_key
"gpg_signatures"
,
"gpg_keys"
add_foreign_key
"gpg_signatures"
,
"projects"
add_foreign_key
"issue_assignees"
,
"issues"
,
name:
"fk_b7d881734a"
,
on_delete: :cascade
add_foreign_key
"issue_assignees"
,
"users"
,
name:
"fk_5e0c8d9154"
,
on_delete: :cascade
add_foreign_key
"issue_metrics"
,
"issues"
,
on_delete: :cascade
...
...
spec/models/gpg_signature_spec.rb
0 → 100644
View file @
8236b12d
require
'rails_helper'
RSpec
.
describe
GpgSignature
do
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
belong_to
(
:gpg_key
)
}
end
describe
'validation'
do
subject
{
described_class
.
new
}
it
{
is_expected
.
to
validate_presence_of
(
:commit_sha
)
}
it
{
is_expected
.
to
validate_presence_of
(
:project
)
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment