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
1fc33b5d
Commit
1fc33b5d
authored
Mar 26, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deployment_platform not memoizing values in correct way
parent
4e2644ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
14 deletions
+7
-14
app/models/concerns/deployment_platform.rb
app/models/concerns/deployment_platform.rb
+5
-3
ee/app/models/concerns/ee/deployment_platform.rb
ee/app/models/concerns/ee/deployment_platform.rb
+0
-9
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+2
-2
No files found.
app/models/concerns/deployment_platform.rb
View file @
1fc33b5d
module
DeploymentPlatform
# EE would override this and utilize environment argument
def
deployment_platform
(
environment:
nil
)
@deployment_platform
||=
@deployment_platform
||=
{}
@deployment_platform
[
environment
]
||=
begin
find_cluster_platform_kubernetes
(
environment:
environment
)
||
find_kubernetes_service_integration
||
build_cluster_and_deployment_platform
end
end
private
# EE would override this and utilize environment argument
def
find_cluster_platform_kubernetes
(
environment:
nil
)
clusters
.
enabled
.
default_environment
.
last
&
.
platform_kubernetes
end
private
def
find_kubernetes_service_integration
services
.
deployment
.
reorder
(
nil
).
find_by
(
active:
true
)
end
...
...
ee/app/models/concerns/ee/deployment_platform.rb
View file @
1fc33b5d
...
...
@@ -2,15 +2,6 @@ module EE
module
DeploymentPlatform
extend
::
Gitlab
::
Utils
::
Override
override
:deployment_platform
def
deployment_platform
(
environment:
nil
)
find_cluster_platform_kubernetes
(
environment:
environment
)
||
find_kubernetes_service_integration
||
build_cluster_and_deployment_platform
end
private
override
:find_cluster_platform_kubernetes
def
find_cluster_platform_kubernetes
(
environment:
nil
)
return
super
unless
environment
&&
feature_available?
(
:multiple_clusters
)
...
...
spec/models/environment_spec.rb
View file @
1fc33b5d
...
...
@@ -378,7 +378,7 @@ describe Environment do
shared_examples
'same behavior between KubernetesService and Platform::Kubernetes'
do
it
'returns the terminals from the deployment service'
do
expect
(
project
.
deployment_platform
)
expect
(
project
.
deployment_platform
(
environment:
environment
)
)
.
to
receive
(
:terminals
).
with
(
environment
)
.
and_return
(
:fake_terminals
)
...
...
@@ -419,7 +419,7 @@ describe Environment do
end
it
'returns the rollout status from the deployment service'
do
expect
(
project
.
deployment_platform
)
expect
(
project
.
deployment_platform
(
environment:
environment
)
)
.
to
receive
(
:rollout_status
).
with
(
environment
)
.
and_return
(
:fake_rollout_status
)
...
...
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