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
aec045de
Commit
aec045de
authored
Sep 25, 2020
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'use_testing_license_key' into 'master'
Add test encryption key See merge request gitlab-org/gitlab!42475
parents
998f8f87
3e62d6ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
2 deletions
+27
-2
.test_license_encryption_key.pub
.test_license_encryption_key.pub
+9
-0
config/initializers/0_license.rb
config/initializers/0_license.rb
+2
-1
ee/app/models/license.rb
ee/app/models/license.rb
+2
-1
ee/changelogs/unreleased/use_testing_license_key.yml
ee/changelogs/unreleased/use_testing_license_key.yml
+5
-0
ee/spec/models/license_spec.rb
ee/spec/models/license_spec.rb
+9
-0
No files found.
.test_license_encryption_key.pub
0 → 100644
View file @
aec045de
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtgemxR8RUJXi3p7G/dkh
Yuln1L4lA6GtQsT83X0yTVDbLVsI2C6bepsRjGiLV0R/9JGvTojORx+9F/ZQAiEC
g6QXWasAOSmrzr4EjADG6cWcCnOju8hX9yib1HUIBxl+jHkmXP3NPuwyb8p2G149
EG1o4apEqE5RtqV/Xyx/u57xTYYZShJ/c7o4iA8xvt6IAKFPFKpQwb5hv4KvUZBP
h0xG2qvOjDu430fK8JclPlXHqPjXDkXOZyLd4FvRStdEQU3RVXvUQfuGt/tOMS7J
nPQ94fr/xdaEbcEtIlr32+tcgsMWyhqtDCPUWJT1aRPviUgaJKLoVs8tRKwYMV9+
1wIDAQAB
-----END PUBLIC KEY-----
config/initializers/0_license.rb
View file @
aec045de
# frozen_string_literal: true
# frozen_string_literal: true
Gitlab
.
ee
do
Gitlab
.
ee
do
public_key_file
=
File
.
read
(
Rails
.
root
.
join
(
".license_encryption_key.pub"
))
prefix
=
ENV
[
'GITLAB_LICENSE_MODE'
]
==
'test'
?
'test_'
:
''
public_key_file
=
File
.
read
(
Rails
.
root
.
join
(
".
#{
prefix
}
license_encryption_key.pub"
))
public_key
=
OpenSSL
::
PKey
::
RSA
.
new
(
public_key_file
)
public_key
=
OpenSSL
::
PKey
::
RSA
.
new
(
public_key_file
)
Gitlab
::
License
.
encryption_key
=
public_key
Gitlab
::
License
.
encryption_key
=
public_key
rescue
rescue
...
...
ee/app/models/license.rb
View file @
aec045de
...
@@ -286,7 +286,8 @@ class License < ApplicationRecord
...
@@ -286,7 +286,8 @@ class License < ApplicationRecord
end
end
def
history
def
history
all
.
sort_by
{
|
license
|
[
license
.
starts_at
,
license
.
created_at
,
license
.
expires_at
]
}.
reverse
decryptable_licenses
=
all
.
select
{
|
license
|
license
.
license
.
present?
}
decryptable_licenses
.
sort_by
{
|
license
|
[
license
.
starts_at
,
license
.
created_at
,
license
.
expires_at
]
}.
reverse
end
end
private
private
...
...
ee/changelogs/unreleased/use_testing_license_key.yml
0 → 100644
View file @
aec045de
---
title
:
Add license encryption key for testing purposes
merge_request
:
42475
author
:
type
:
added
ee/spec/models/license_spec.rb
View file @
aec045de
...
@@ -849,6 +849,15 @@ RSpec.describe License do
...
@@ -849,6 +849,15 @@ RSpec.describe License do
described_class
.
delete_all
described_class
.
delete_all
end
end
it
'does not include the undecryptable license'
do
undecryptable_license
=
create
(
:license
)
allow
(
undecryptable_license
).
to
receive
(
:license
).
and_return
(
nil
)
allow
(
License
).
to
receive
(
:all
).
and_return
([
undecryptable_license
])
expect
(
described_class
.
history
.
map
(
&
:id
)).
to
be_empty
end
it
'returns the licenses sorted by created_at, starts_at and expires_at descending'
do
it
'returns the licenses sorted by created_at, starts_at and expires_at descending'
do
today
=
Date
.
current
today
=
Date
.
current
now
=
Time
.
current
now
=
Time
.
current
...
...
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