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
76667af2
Commit
76667af2
authored
Feb 09, 2021
by
Changzheng Liu
Committed by
Dylan Griffith
Feb 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove target_name parameter from Elasticsearch rake tasks
parent
9da4bd72
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
157 deletions
+21
-157
doc/integration/elasticsearch.md
doc/integration/elasticsearch.md
+10
-140
ee/changelogs/unreleased/296608_remove_target_name.yml
ee/changelogs/unreleased/296608_remove_target_name.yml
+5
-0
ee/lib/tasks/gitlab/elastic.rake
ee/lib/tasks/gitlab/elastic.rake
+5
-8
ee/spec/tasks/gitlab/elastic_rake_spec.rb
ee/spec/tasks/gitlab/elastic_rake_spec.rb
+1
-9
No files found.
doc/integration/elasticsearch.md
View file @
76667af2
This diff is collapsed.
Click to expand it.
ee/changelogs/unreleased/296608_remove_target_name.yml
0 → 100644
View file @
76667af2
---
title
:
Remove target_name parameter from Elasticsearch rake tasks
merge_request
:
52958
author
:
type
:
changed
ee/lib/tasks/gitlab/elastic.rake
View file @
76667af2
...
...
@@ -60,14 +60,11 @@ namespace :gitlab do
end
desc
"GitLab | Elasticsearch | Create empty indexes and assigns an alias for each"
task
:create_empty_index
,
[
:target_name
]
=>
[
:environment
]
do
|
t
,
args
|
task
create_empty_index:
[
:environment
]
do
|
t
,
args
|
with_alias
=
ENV
[
"SKIP_ALIAS"
].
nil?
options
=
{}
# only create an index at the specified name
options
[
:index_name
]
=
args
[
:target_name
]
unless
with_alias
helper
=
Gitlab
::
Elastic
::
Helper
.
new
(
target_name:
args
[
:target_name
])
helper
=
Gitlab
::
Elastic
::
Helper
.
default
index_name
=
helper
.
create_empty_index
(
with_alias:
with_alias
,
options:
options
)
# with_alias is used to support interacting with a specific index (such as when reclaiming the production index
...
...
@@ -89,8 +86,8 @@ namespace :gitlab do
end
desc
"GitLab | Elasticsearch | Delete all indexes"
task
:delete_index
,
[
:target_name
]
=>
[
:environment
]
do
|
t
,
args
|
helper
=
Gitlab
::
Elastic
::
Helper
.
new
(
target_name:
args
[
:target_name
])
task
delete_index:
[
:environment
]
do
|
t
,
args
|
helper
=
Gitlab
::
Elastic
::
Helper
.
default
if
helper
.
delete_index
puts
"Index/alias '
#{
helper
.
target_name
}
' has been deleted"
.
color
(
:green
)
...
...
@@ -115,7 +112,7 @@ namespace :gitlab do
end
desc
"GitLab | Elasticsearch | Recreate indexes"
task
:recreate_index
,
[
:target_name
]
=>
[
:environment
]
do
|
t
,
args
|
task
recreate_index:
[
:environment
]
do
|
t
,
args
|
Rake
::
Task
[
"gitlab:elastic:delete_index"
].
invoke
(
*
args
)
Rake
::
Task
[
"gitlab:elastic:create_empty_index"
].
invoke
(
*
args
)
end
...
...
ee/spec/tasks/gitlab/elastic_rake_spec.rb
View file @
76667af2
...
...
@@ -21,18 +21,14 @@ RSpec.describe 'gitlab:elastic namespace rake tasks', :elastic do
end
context
'when SKIP_ALIAS environment variable is set'
do
let
(
:secondary_index_name
)
{
"gitlab-test-
#{
Time
.
now
.
strftime
(
"%Y%m%d-%H%M"
)
}
"
}
before
do
stub_env
(
'SKIP_ALIAS'
,
'1'
)
end
after
do
es_helper
.
delete_index
(
index_name:
secondary_index_name
)
es_helper
.
client
.
indices
.
delete
(
index:
"
#{
es_helper
.
target_name
}
*"
)
end
subject
{
run_rake_task
(
'gitlab:elastic:create_empty_index'
,
secondary_index_name
)
}
it
'does not alias the new index'
do
expect
{
subject
}.
not_to
change
{
es_helper
.
alias_exists?
(
name:
es_helper
.
target_name
)
}
end
...
...
@@ -44,10 +40,6 @@ RSpec.describe 'gitlab:elastic namespace rake tasks', :elastic do
expect
{
subject
}.
not_to
change
{
es_helper
.
index_exists?
(
index_name:
migration_index_name
)
}
end
it
'creates an index at the specified name'
do
expect
{
subject
}.
to
change
{
es_helper
.
index_exists?
(
index_name:
secondary_index_name
)
}.
from
(
false
).
to
(
true
)
end
Gitlab
::
Elastic
::
Helper
::
ES_SEPARATE_CLASSES
.
each
do
|
class_name
|
describe
"
#{
class_name
}
"
do
it
"does not create a standalone index"
do
...
...
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