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
ee18ca2f
Commit
ee18ca2f
authored
Jun 24, 2019
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename method to not clash with #cluster
We will introduce #cluster at a later stage. Also deprecate this method
parent
25adee56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
8 deletions
+9
-8
app/models/deployment.rb
app/models/deployment.rb
+2
-1
lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb
lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb
+1
-1
spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb
...gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb
+4
-4
spec/models/deployment_spec.rb
spec/models/deployment_spec.rb
+2
-2
No files found.
app/models/deployment.rb
View file @
ee18ca2f
...
...
@@ -84,7 +84,8 @@ class Deployment < ApplicationRecord
Commit
.
truncate_sha
(
sha
)
end
def
cluster
# Deprecated - will be replaced by a persisted cluster_id
def
deployment_platform_cluster
environment
.
deployment_platform
&
.
cluster
end
...
...
lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb
View file @
ee18ca2f
...
...
@@ -21,7 +21,7 @@ module Gitlab
private
def
deployment_cluster
build
.
deployment
&
.
cluster
build
.
deployment
&
.
deployment_platform_
cluster
end
def
kubernetes_namespace
...
...
spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb
View file @
ee18ca2f
...
...
@@ -23,7 +23,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
let
(
:cluster
)
{
create
(
:cluster
,
:group
)
}
before
do
allow
(
build
.
deployment
).
to
receive
(
:cluster
).
and_return
(
cluster
)
allow
(
build
.
deployment
).
to
receive
(
:
deployment_platform_
cluster
).
and_return
(
cluster
)
end
it
{
is_expected
.
to
be_truthy
}
...
...
@@ -55,7 +55,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
context
'and no cluster to deploy to'
do
before
do
expect
(
deployment
.
cluster
).
to
be_nil
expect
(
deployment
.
deployment_platform_
cluster
).
to
be_nil
end
it
{
is_expected
.
to
be_falsey
}
...
...
@@ -73,7 +73,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
let
(
:cluster
)
{
create
(
:cluster
,
:group
)
}
before
do
allow
(
build
.
deployment
).
to
receive
(
:cluster
).
and_return
(
cluster
)
allow
(
build
.
deployment
).
to
receive
(
:
deployment_platform_
cluster
).
and_return
(
cluster
)
end
it
'creates a kubernetes namespace'
do
...
...
@@ -90,7 +90,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
context
'completion is not required'
do
before
do
expect
(
deployment
.
cluster
).
to
be_nil
expect
(
deployment
.
deployment_platform_
cluster
).
to
be_nil
end
it
'does not create a namespace'
do
...
...
spec/models/deployment_spec.rb
View file @
ee18ca2f
...
...
@@ -380,12 +380,12 @@ describe Deployment do
end
end
describe
'#cluster'
do
describe
'#
deployment_platform_
cluster'
do
let
(
:deployment
)
{
create
(
:deployment
)
}
let
(
:project
)
{
deployment
.
project
}
let
(
:environment
)
{
deployment
.
environment
}
subject
{
deployment
.
cluster
}
subject
{
deployment
.
deployment_platform_
cluster
}
before
do
expect
(
project
).
to
receive
(
:deployment_platform
)
...
...
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