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
0715b53b
Commit
0715b53b
authored
Apr 12, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
b2d21327
c61fd077
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
35 deletions
+50
-35
app/models/wiki_page.rb
app/models/wiki_page.rb
+3
-1
app/services/clusters/applications/install_service.rb
app/services/clusters/applications/install_service.rb
+8
-1
app/services/clusters/applications/patch_service.rb
app/services/clusters/applications/patch_service.rb
+8
-2
app/services/clusters/applications/upgrade_service.rb
app/services/clusters/applications/upgrade_service.rb
+20
-16
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+5
-3
spec/services/clusters/applications/install_service_spec.rb
spec/services/clusters/applications/install_service_spec.rb
+2
-4
spec/services/clusters/applications/patch_service_spec.rb
spec/services/clusters/applications/patch_service_spec.rb
+2
-4
spec/services/clusters/applications/upgrade_service_spec.rb
spec/services/clusters/applications/upgrade_service_spec.rb
+2
-4
No files found.
app/models/wiki_page.rb
View file @
0715b53b
...
...
@@ -31,7 +31,9 @@ class WikiPage
pages
.
each_with_object
([])
do
|
page
,
grouped_pages
|
next
grouped_pages
<<
page
unless
page
.
directory
.
present?
directory
=
grouped_pages
.
find
{
|
dir
|
dir
.
slug
==
page
.
directory
}
directory
=
grouped_pages
.
find
do
|
obj
|
obj
.
is_a?
(
WikiDirectory
)
&&
obj
.
slug
==
page
.
directory
end
next
directory
.
pages
<<
page
if
directory
...
...
app/services/clusters/applications/install_service.rb
View file @
0715b53b
...
...
@@ -7,6 +7,13 @@ module Clusters
return
unless
app
.
scheduled?
app
.
make_installing!
install
end
private
def
install
log_event
(
:begin_install
)
helm_api
.
install
(
install_command
)
...
...
@@ -18,7 +25,7 @@ module Clusters
app
.
make_errored!
(
"Kubernetes error:
#{
e
.
error_code
}
"
)
rescue
StandardError
=>
e
log_error
(
e
)
app
.
make_errored!
(
"Can't start installation process."
)
app
.
make_errored!
(
'Failed to install.'
)
end
end
end
...
...
app/services/clusters/applications/patch_service.rb
View file @
0715b53b
...
...
@@ -8,6 +8,12 @@ module Clusters
app
.
make_updating!
patch
end
private
def
patch
log_event
(
:begin_patch
)
helm_api
.
update
(
update_command
)
...
...
@@ -16,10 +22,10 @@ module Clusters
ClusterWaitForAppInstallationWorker
::
INTERVAL
,
app
.
name
,
app
.
id
)
rescue
Kubeclient
::
HttpError
=>
e
log_error
(
e
)
app
.
make_
update_
errored!
(
"Kubernetes error:
#{
e
.
error_code
}
"
)
app
.
make_errored!
(
"Kubernetes error:
#{
e
.
error_code
}
"
)
rescue
StandardError
=>
e
log_error
(
e
)
app
.
make_
update_errored!
(
"Can't start update process."
)
app
.
make_
errored!
(
'Failed to update.'
)
end
end
end
...
...
app/services/clusters/applications/upgrade_service.rb
View file @
0715b53b
...
...
@@ -6,12 +6,17 @@ module Clusters
def
execute
return
unless
app
.
scheduled?
begin
app
.
make_updating!
log_event
(
:begin_upgrade
)
upgrade
end
private
def
upgrade
# install_command works with upgrades too
# as it basically does `helm upgrade --install`
log_event
(
:begin_upgrade
)
helm_api
.
update
(
install_command
)
log_event
(
:schedule_wait_for_upgrade
)
...
...
@@ -19,11 +24,10 @@ module Clusters
ClusterWaitForAppInstallationWorker
::
INTERVAL
,
app
.
name
,
app
.
id
)
rescue
Kubeclient
::
HttpError
=>
e
log_error
(
e
)
app
.
make_updat
e_errored!
(
"Kubernetes error:
#{
e
.
error_code
}
"
)
app
.
mak
e_errored!
(
"Kubernetes error:
#{
e
.
error_code
}
"
)
rescue
StandardError
=>
e
log_error
(
e
)
app
.
make_update_errored!
(
"Can't start upgrade process."
)
end
app
.
make_errored!
(
'Failed to upgrade.'
)
end
end
end
...
...
spec/models/wiki_page_spec.rb
View file @
0715b53b
...
...
@@ -22,6 +22,7 @@ describe WikiPage do
create_page
(
'dir_1/dir_1_1/page_3'
,
'content'
)
create_page
(
'page_1'
,
'content'
)
create_page
(
'dir_1/page_2'
,
'content'
)
create_page
(
'dir_2'
,
'page with dir name'
)
create_page
(
'dir_2/page_5'
,
'content'
)
create_page
(
'page_6'
,
'content'
)
create_page
(
'dir_2/page_4'
,
'content'
)
...
...
@@ -29,6 +30,7 @@ describe WikiPage do
let
(
:page_1
)
{
wiki
.
find_page
(
'page_1'
)
}
let
(
:page_6
)
{
wiki
.
find_page
(
'page_6'
)
}
let
(
:page_dir_2
)
{
wiki
.
find_page
(
'dir_2'
)
}
let
(
:dir_1
)
do
WikiDirectory
.
new
(
'dir_1'
,
[
wiki
.
find_page
(
'dir_1/page_2'
)])
...
...
@@ -44,7 +46,7 @@ describe WikiPage do
context
'sort by title'
do
let
(
:grouped_entries
)
{
described_class
.
group_by_directory
(
wiki
.
pages
)
}
let
(
:expected_grouped_entries
)
{
[
dir_1_1
,
dir_1
,
dir_2
,
page_1
,
page_6
]
}
let
(
:expected_grouped_entries
)
{
[
dir_1_1
,
dir_1
,
page_dir_2
,
dir_2
,
page_1
,
page_6
]
}
it
'returns an array with pages and directories'
do
grouped_entries
.
each_with_index
do
|
page_or_dir
,
i
|
...
...
@@ -59,7 +61,7 @@ describe WikiPage do
context
'sort by created_at'
do
let
(
:grouped_entries
)
{
described_class
.
group_by_directory
(
wiki
.
pages
(
sort:
'created_at'
))
}
let
(
:expected_grouped_entries
)
{
[
dir_1_1
,
page_1
,
dir_1
,
dir_2
,
page_6
]
}
let
(
:expected_grouped_entries
)
{
[
dir_1_1
,
page_1
,
dir_1
,
page_dir_2
,
dir_2
,
page_6
]
}
it
'returns an array with pages and directories'
do
grouped_entries
.
each_with_index
do
|
page_or_dir
,
i
|
...
...
@@ -73,7 +75,7 @@ describe WikiPage do
end
it
'returns an array with retained order with directories at the top'
do
expected_order
=
[
'dir_1/dir_1_1/page_3'
,
'dir_1/page_2'
,
'dir_2/page_4'
,
'dir_2/page_5'
,
'page_1'
,
'page_6'
]
expected_order
=
[
'dir_1/dir_1_1/page_3'
,
'dir_1/page_2'
,
'dir_2
'
,
'dir_2
/page_4'
,
'dir_2/page_5'
,
'page_1'
,
'page_6'
]
grouped_entries
=
described_class
.
group_by_directory
(
wiki
.
pages
)
...
...
spec/services/clusters/applications/install_service_spec.rb
View file @
0715b53b
...
...
@@ -58,7 +58,7 @@ describe Clusters::Applications::InstallService do
let
(
:error
)
{
StandardError
.
new
(
'something bad happened'
)
}
before
do
expect
(
application
).
to
receive
(
:make_installing!
).
once
.
and_raise
(
error
)
expect
(
helm_client
).
to
receive
(
:install
).
with
(
install_command
)
.
and_raise
(
error
)
end
include_examples
'logs kubernetes errors'
do
...
...
@@ -68,12 +68,10 @@ describe Clusters::Applications::InstallService do
end
it
'make the application errored'
do
expect
(
helm_client
).
not_to
receive
(
:install
)
service
.
execute
expect
(
application
).
to
be_errored
expect
(
application
.
status_reason
).
to
eq
(
"Can't start installation process."
)
expect
(
application
.
status_reason
).
to
eq
(
'Failed to install.'
)
end
end
end
...
...
spec/services/clusters/applications/patch_service_spec.rb
View file @
0715b53b
...
...
@@ -66,16 +66,14 @@ describe Clusters::Applications::PatchService do
end
before
do
expect
(
application
).
to
receive
(
:make_updating!
).
once
.
and_raise
(
error
)
expect
(
helm_client
).
to
receive
(
:update
).
with
(
update_command
)
.
and_raise
(
error
)
end
it
'make the application errored'
do
expect
(
helm_client
).
not_to
receive
(
:update
)
service
.
execute
expect
(
application
).
to
be_update_errored
expect
(
application
.
status_reason
).
to
eq
(
"Can't start update process."
)
expect
(
application
.
status_reason
).
to
eq
(
'Failed to update.'
)
end
end
end
...
...
spec/services/clusters/applications/upgrade_service_spec.rb
View file @
0715b53b
...
...
@@ -60,7 +60,7 @@ describe Clusters::Applications::UpgradeService do
let
(
:error
)
{
StandardError
.
new
(
'something bad happened'
)
}
before
do
expect
(
application
).
to
receive
(
:make_updating!
).
once
.
and_raise
(
error
)
expect
(
helm_client
).
to
receive
(
:update
).
with
(
install_command
)
.
and_raise
(
error
)
end
include_examples
'logs kubernetes errors'
do
...
...
@@ -70,12 +70,10 @@ describe Clusters::Applications::UpgradeService do
end
it
'make the application errored'
do
expect
(
helm_client
).
not_to
receive
(
:update
)
service
.
execute
expect
(
application
).
to
be_update_errored
expect
(
application
.
status_reason
).
to
eq
(
"Can't start upgrade process."
)
expect
(
application
.
status_reason
).
to
eq
(
'Failed to upgrade.'
)
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