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
2e9b88c1
Commit
2e9b88c1
authored
Jun 02, 2020
by
João Pereira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip configure rake task if container registry is misconfigured
parent
2d436941
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
lib/tasks/gitlab/container_registry.rake
lib/tasks/gitlab/container_registry.rake
+6
-1
spec/tasks/gitlab/container_registry_rake_spec.rb
spec/tasks/gitlab/container_registry_rake_spec.rb
+13
-2
No files found.
lib/tasks/gitlab/container_registry.rake
View file @
2e9b88c1
...
...
@@ -2,10 +2,15 @@ namespace :gitlab do
namespace
:container_registry
do
desc
"GitLab | Container Registry | Configure"
task
configure: :gitlab_environment
do
configure
end
def
configure
registry_config
=
Gitlab
.
config
.
registry
unless
registry_config
.
enabled
&&
registry_config
.
api_url
.
presence
raise
'Registry is not enabled or registry api url is not present.'
puts
"Registry is not enabled or registry api url is not present."
.
color
(
:yellow
)
return
end
warn_user_is_not_gitlab
...
...
spec/tasks/gitlab/container_registry_rake_spec.rb
View file @
2e9b88c1
...
...
@@ -16,10 +16,21 @@ describe 'gitlab:container_registry namespace rake tasks' do
stub_container_registry_config
(
enabled:
true
,
api_url:
api_url
)
end
subject
{
run_rake_task
(
'gitlab:container_registry:configure'
)
}
shared_examples
'invalid config'
do
it
'does not update the application settings'
do
expect
{
run_rake_task
(
'gitlab:container_registry:configure'
)
}
.
to
raise_error
(
/Registry is not enabled or registry api url is not present./
)
expect
(
application_settings
).
not_to
receive
(
:update!
)
subject
end
it
'does not raise an error'
do
expect
{
subject
}.
not_to
raise_error
end
it
'prints a warning message'
do
expect
{
subject
}.
to
output
(
/Registry is not enabled or registry api url is not present./
).
to_stdout
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