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
8a53aa17
Commit
8a53aa17
authored
Mar 23, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not try to obtain Let's Encrypt's certs if failed
parent
b6b8ee4e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
app/workers/pages_domain_ssl_renewal_cron_worker.rb
app/workers/pages_domain_ssl_renewal_cron_worker.rb
+5
-0
spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb
spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb
+6
-1
spec/workers/pages_domain_ssl_renewal_worker_spec.rb
spec/workers/pages_domain_ssl_renewal_worker_spec.rb
+2
-0
No files found.
app/workers/pages_domain_ssl_renewal_cron_worker.rb
View file @
8a53aa17
...
@@ -10,6 +10,11 @@ class PagesDomainSslRenewalCronWorker # rubocop:disable Scalability/IdempotentWo
...
@@ -10,6 +10,11 @@ class PagesDomainSslRenewalCronWorker # rubocop:disable Scalability/IdempotentWo
return
unless
::
Gitlab
::
LetsEncrypt
.
enabled?
return
unless
::
Gitlab
::
LetsEncrypt
.
enabled?
PagesDomain
.
need_auto_ssl_renewal
.
with_logging_info
.
find_each
do
|
domain
|
PagesDomain
.
need_auto_ssl_renewal
.
with_logging_info
.
find_each
do
|
domain
|
# Ideally that should be handled in PagesDomain.need_auto_ssl_renewal scope
# but it's hard to make scope work with feature flags
# once we remove feature flag we can modify scope to implement this behaviour
next
if
Feature
.
enabled?
(
:pages_letsencrypt_errors
,
domain
.
project
)
&&
domain
.
auto_ssl_failed
with_context
(
project:
domain
.
project
)
do
with_context
(
project:
domain
.
project
)
do
PagesDomainSslRenewalWorker
.
perform_async
(
domain
.
id
)
PagesDomainSslRenewalWorker
.
perform_async
(
domain
.
id
)
end
end
...
...
spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb
View file @
8a53aa17
...
@@ -21,6 +21,10 @@ describe PagesDomainSslRenewalCronWorker do
...
@@ -21,6 +21,10 @@ describe PagesDomainSslRenewalCronWorker do
let!
(
:domain_without_auto_certificate
)
do
let!
(
:domain_without_auto_certificate
)
do
create
(
:pages_domain
,
:without_certificate
,
:without_key
,
project:
project
,
auto_ssl_enabled:
true
)
create
(
:pages_domain
,
:without_certificate
,
:without_key
,
project:
project
,
auto_ssl_enabled:
true
)
end
end
let!
(
:domain_with_failed_auto_ssl
)
do
create
(
:pages_domain
,
:without_certificate
,
:without_key
,
project:
project
,
auto_ssl_enabled:
true
,
auto_ssl_failed:
true
)
end
let!
(
:domain_with_expired_auto_ssl
)
do
let!
(
:domain_with_expired_auto_ssl
)
do
create
(
:pages_domain
,
:letsencrypt
,
:with_expired_certificate
,
project:
project
)
create
(
:pages_domain
,
:letsencrypt
,
:with_expired_certificate
,
project:
project
)
...
@@ -34,7 +38,8 @@ describe PagesDomainSslRenewalCronWorker do
...
@@ -34,7 +38,8 @@ describe PagesDomainSslRenewalCronWorker do
end
end
[
domain
,
[
domain
,
domain_with_obtained_letsencrypt
].
each
do
|
domain
|
domain_with_obtained_letsencrypt
,
domain_with_failed_auto_ssl
].
each
do
|
domain
|
expect
(
PagesDomainSslRenewalWorker
).
not_to
receive
(
:perform_async
).
with
(
domain
.
id
)
expect
(
PagesDomainSslRenewalWorker
).
not_to
receive
(
:perform_async
).
with
(
domain
.
id
)
end
end
...
...
spec/workers/pages_domain_ssl_renewal_worker_spec.rb
View file @
8a53aa17
...
@@ -26,6 +26,8 @@ describe PagesDomainSslRenewalWorker do
...
@@ -26,6 +26,8 @@ describe PagesDomainSslRenewalWorker do
shared_examples
'does nothing'
do
shared_examples
'does nothing'
do
it
'does nothing'
do
it
'does nothing'
do
expect
(
::
PagesDomains
::
ObtainLetsEncryptCertificateService
).
not_to
receive
(
:new
)
expect
(
::
PagesDomains
::
ObtainLetsEncryptCertificateService
).
not_to
receive
(
:new
)
worker
.
perform
(
domain
.
id
)
end
end
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