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
5a963965
Commit
5a963965
authored
Jun 21, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
3587a23b
82f5d90e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
108 additions
and
23 deletions
+108
-23
app/assets/javascripts/environments/components/container.vue
app/assets/javascripts/environments/components/container.vue
+1
-0
app/assets/javascripts/environments/components/environments_app.vue
.../javascripts/environments/components/environments_app.vue
+6
-0
app/assets/javascripts/environments/components/environments_table.vue
...avascripts/environments/components/environments_table.vue
+7
-0
app/assets/javascripts/environments/index.js
app/assets/javascripts/environments/index.js
+2
-0
app/assets/javascripts/environments/mixins/container_mixin.js
...assets/javascripts/environments/mixins/container_mixin.js
+5
-0
app/views/projects/environments/index.html.haml
app/views/projects/environments/index.html.haml
+1
-0
changelogs/unreleased/63513-ensure-gitlab-jsoncache-includes-the-gitlab-version-in-the-cache-key.yml
...soncache-includes-the-gitlab-version-in-the-cache-key.yml
+5
-0
lib/gitlab/json_cache.rb
lib/gitlab/json_cache.rb
+2
-2
lib/gitlab/kubernetes.rb
lib/gitlab/kubernetes.rb
+8
-0
spec/lib/gitlab/json_cache_spec.rb
spec/lib/gitlab/json_cache_spec.rb
+47
-21
spec/lib/gitlab/kubernetes_spec.rb
spec/lib/gitlab/kubernetes_spec.rb
+24
-0
No files found.
app/assets/javascripts/environments/components/container.vue
View file @
5a963965
...
...
@@ -57,6 +57,7 @@ export default {
:user-callouts-path=
"userCalloutsPath"
:lock-promotion-svg-path=
"lockPromotionSvgPath"
:help-canary-deployments-path=
"helpCanaryDeploymentsPath"
:deploy-boards-help-path=
"deployBoardsHelpPath"
/>
<table-pagination
...
...
app/assets/javascripts/environments/components/environments_app.vue
View file @
5a963965
...
...
@@ -43,6 +43,11 @@ export default {
type
:
String
,
required
:
true
,
},
deployBoardsHelpPath
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
},
created
()
{
...
...
@@ -112,6 +117,7 @@ export default {
:user-callouts-path=
"userCalloutsPath"
:lock-promotion-svg-path=
"lockPromotionSvgPath"
:help-canary-deployments-path=
"helpCanaryDeploymentsPath"
:deploy-boards-help-path=
"deployBoardsHelpPath"
@
onChangePage=
"onChangePage"
>
<empty-state
...
...
app/assets/javascripts/environments/components/environments_table.vue
View file @
5a963965
...
...
@@ -22,6 +22,11 @@ export default {
required
:
true
,
default
:
()
=>
[],
},
deployBoardsHelpPath
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
canReadEnvironment
:
{
type
:
Boolean
,
required
:
false
,
...
...
@@ -106,8 +111,10 @@ export default {
<div
class=
"deploy-board-container"
>
<deploy-board
:deploy-board-data=
"model.deployBoardData"
:deploy-boards-help-path=
"deployBoardsHelpPath"
:is-loading=
"model.isLoadingDeployBoard"
:is-empty=
"model.isEmptyDeployBoard"
:has-legacy-app-label=
"model.hasLegacyAppLabel"
:logs-path=
"model.logs_path"
/>
</div>
...
...
app/assets/javascripts/environments/index.js
View file @
5a963965
...
...
@@ -20,6 +20,7 @@ export default () =>
endpoint
:
environmentsData
.
environmentsDataEndpoint
,
newEnvironmentPath
:
environmentsData
.
newEnvironmentPath
,
helpPagePath
:
environmentsData
.
helpPagePath
,
deployBoardsHelpPath
:
environmentsData
.
deployBoardsHelpPath
,
cssContainerClass
:
environmentsData
.
cssClass
,
canCreateEnvironment
:
parseBoolean
(
environmentsData
.
canCreateEnvironment
),
canReadEnvironment
:
parseBoolean
(
environmentsData
.
canReadEnvironment
),
...
...
@@ -31,6 +32,7 @@ export default () =>
endpoint
:
this
.
endpoint
,
newEnvironmentPath
:
this
.
newEnvironmentPath
,
helpPagePath
:
this
.
helpPagePath
,
deployBoardsHelpPath
:
this
.
deployBoardsHelpPath
,
cssContainerClass
:
this
.
cssContainerClass
,
canCreateEnvironment
:
this
.
canCreateEnvironment
,
canReadEnvironment
:
this
.
canReadEnvironment
,
...
...
app/assets/javascripts/environments/mixins/container_mixin.js
View file @
5a963965
...
...
@@ -25,5 +25,10 @@ export default {
required
:
false
,
default
:
null
,
},
deployBoardsHelpPath
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
},
};
app/views/projects/environments/index.html.haml
View file @
5a963965
...
...
@@ -6,4 +6,5 @@
"can-create-environment"
=>
can?
(
current_user
,
:create_environment
,
@project
).
to_s
,
"new-environment-path"
=>
new_project_environment_path
(
@project
),
"help-page-path"
=>
help_page_path
(
"ci/environments"
),
"deploy-boards-help-path"
=>
help_page_path
(
"user/project/deploy_boards"
,
anchor:
"enabling-deploy-boards"
),
"css-class"
=>
container_class
}
}
changelogs/unreleased/63513-ensure-gitlab-jsoncache-includes-the-gitlab-version-in-the-cache-key.yml
0 → 100644
View file @
5a963965
---
title
:
Include the GitLab version in the cache key for Gitlab::JsonCache
merge_request
:
29938
author
:
type
:
fixed
lib/gitlab/json_cache.rb
View file @
5a963965
...
...
@@ -22,10 +22,10 @@ module Gitlab
expanded_cache_key
=
[
namespace
,
key
].
compact
if
cache_key_with_version
expanded_cache_key
<<
Rails
.
version
expanded_cache_key
<<
[
Gitlab
::
VERSION
,
Rails
.
version
]
end
expanded_cache_key
.
join
(
':'
)
expanded_cache_key
.
flatten
.
join
(
':'
).
freeze
end
def
expire
(
key
)
...
...
lib/gitlab/kubernetes.rb
View file @
5a963965
...
...
@@ -43,6 +43,14 @@ module Gitlab
})
end
def
filter_by_legacy_label
(
items
,
app
,
env
)
legacy_items
=
filter_by_label
(
items
,
{
app:
env
})
non_legacy_items
=
filter_by_project_environment
(
legacy_items
,
app
,
env
)
legacy_items
-
non_legacy_items
end
# Converts a pod (as returned by the kubernetes API) into a terminal
def
terminals_for_pod
(
api_url
,
namespace
,
pod
)
metadata
=
pod
.
fetch
(
"metadata"
,
{})
...
...
spec/lib/gitlab/json_cache_spec.rb
View file @
5a963965
...
...
@@ -6,7 +6,7 @@ describe Gitlab::JsonCache do
let
(
:backend
)
{
double
(
'backend'
).
as_null_object
}
let
(
:namespace
)
{
'geo'
}
let
(
:key
)
{
'foo'
}
let
(
:expanded_key
)
{
"
#{
namespace
}
:
#{
key
}
:
#{
Rails
.
version
}
"
}
let
(
:expanded_key
)
{
"
#{
namespace
}
:
#{
key
}
:
#{
Gitlab
::
VERSION
}
:
#{
Rails
.
version
}
"
}
set
(
:broadcast_message
)
{
create
(
:broadcast_message
)
}
subject
(
:cache
)
{
described_class
.
new
(
namespace:
namespace
,
backend:
backend
)
}
...
...
@@ -35,42 +35,68 @@ describe Gitlab::JsonCache do
describe
'#cache_key'
do
context
'when namespace is not defined'
do
it
'expands out the key with Rails version'
do
cache
=
described_class
.
new
(
cache_key_with_version:
true
)
context
'when cache_key_with_version is true'
do
it
'expands out the key with GitLab, and Rails versions'
do
cache
=
described_class
.
new
(
cache_key_with_version:
true
)
cache_key
=
cache
.
cache_key
(
key
)
cache_key
=
cache
.
cache_key
(
key
)
expect
(
cache_key
).
to
eq
(
"
#{
key
}
:
#{
Rails
.
version
}
"
)
expect
(
cache_key
).
to
eq
(
"
#{
key
}
:
#{
Gitlab
::
VERSION
}
:
#{
Rails
.
version
}
"
)
end
end
end
context
'when cache_key_with_version is tru
e'
do
it
'expands out the key with namespace and Rails version
'
do
cache
=
described_class
.
new
(
namespace:
namespace
,
cache_key_with_version:
tru
e
)
context
'when cache_key_with_version is fals
e'
do
it
'returns the key
'
do
cache
=
described_class
.
new
(
namespace:
nil
,
cache_key_with_version:
fals
e
)
cache_key
=
cache
.
cache_key
(
key
)
cache_key
=
cache
.
cache_key
(
key
)
expect
(
cache_key
).
to
eq
(
"
#{
namespace
}
:
#{
key
}
:
#{
Rails
.
version
}
"
)
expect
(
cache_key
).
to
eq
(
key
)
end
end
end
context
'when cache_key_with_version is false'
do
it
'expands out the key with namespace'
do
cache
=
described_class
.
new
(
namespace:
namespace
,
cache_key_with_version:
false
)
context
'when namespace is nil'
do
context
'when cache_key_with_version is true'
do
it
'expands out the key with GitLab, and Rails versions'
do
cache
=
described_class
.
new
(
cache_key_with_version:
true
)
cache_key
=
cache
.
cache_key
(
key
)
cache_key
=
cache
.
cache_key
(
key
)
expect
(
cache_key
).
to
eq
(
"
#{
namespace
}
:
#{
key
}
"
)
expect
(
cache_key
).
to
eq
(
"
#{
key
}
:
#{
Gitlab
::
VERSION
}
:
#{
Rails
.
version
}
"
)
end
end
context
'when cache_key_with_version is false'
do
it
'returns the key'
do
cache
=
described_class
.
new
(
namespace:
nil
,
cache_key_with_version:
false
)
cache_key
=
cache
.
cache_key
(
key
)
expect
(
cache_key
).
to
eq
(
key
)
end
end
end
context
'when namespace is nil, and cache_key_with_version is false'
do
it
'returns the key'
do
cache
=
described_class
.
new
(
namespace:
nil
,
cache_key_with_version:
false
)
context
'when namespace is set'
do
context
'when cache_key_with_version is true'
do
it
'expands out the key with namespace and Rails version'
do
cache
=
described_class
.
new
(
namespace:
namespace
,
cache_key_with_version:
true
)
cache_key
=
cache
.
cache_key
(
key
)
cache_key
=
cache
.
cache_key
(
key
)
expect
(
cache_key
).
to
eq
(
"
#{
namespace
}
:
#{
key
}
:
#{
Gitlab
::
VERSION
}
:
#{
Rails
.
version
}
"
)
end
end
expect
(
cache_key
).
to
eq
(
key
)
context
'when cache_key_with_version is false'
do
it
'expands out the key with namespace'
do
cache
=
described_class
.
new
(
namespace:
namespace
,
cache_key_with_version:
false
)
cache_key
=
cache
.
cache_key
(
key
)
expect
(
cache_key
).
to
eq
(
"
#{
namespace
}
:
#{
key
}
"
)
end
end
end
end
...
...
spec/lib/gitlab/kubernetes_spec.rb
View file @
5a963965
...
...
@@ -67,6 +67,30 @@ describe Gitlab::Kubernetes do
end
end
describe
'#filter_by_legacy_label'
do
let
(
:non_matching_pod
)
{
kube_pod
(
environment_slug:
'production'
,
project_slug:
'my-cool-app'
)
}
let
(
:non_matching_pod_2
)
do
kube_pod
(
environment_slug:
'production'
,
project_slug:
'my-cool-app'
).
tap
do
|
pod
|
pod
[
'metadata'
][
'labels'
][
'app'
]
=
'production'
end
end
let
(
:matching_pod
)
do
kube_pod
.
tap
do
|
pod
|
pod
[
'metadata'
][
'annotations'
].
delete
(
'app.gitlab.com/env'
)
pod
[
'metadata'
][
'annotations'
].
delete
(
'app.gitlab.com/app'
)
pod
[
'metadata'
][
'labels'
][
'app'
]
=
'production'
end
end
it
'returns matching labels'
do
items
=
[
non_matching_pod
,
non_matching_pod_2
,
matching_pod
]
expect
(
filter_by_legacy_label
(
items
,
'my-cool-app'
,
'production'
)).
to
contain_exactly
(
matching_pod
)
end
end
describe
'#to_kubeconfig'
do
let
(
:token
)
{
'TOKEN'
}
let
(
:ca_pem
)
{
'PEM'
}
...
...
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