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
7352f8d2
Commit
7352f8d2
authored
Feb 29, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'es_wiki_on_push' into ee_master
parents
74e960e5
3a45e27e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/workers/post_receive.rb
app/workers/post_receive.rb
+12
-0
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+11
-0
No files found.
CHANGELOG-EE
View file @
7352f8d2
...
...
@@ -4,6 +4,7 @@ v 8.6.0 (unreleased)
- [Elastic] Add elastic checker to gitlab:check
- [Elastic] Added UPDATE_INDEX option to rake task
- [Elasticsearch] Removing repository and wiki index after removing project
- [Elastic] Update index on push to wiki
v 8.5.1
- Fix adding pages domain to projects in groups
...
...
app/workers/post_receive.rb
View file @
7352f8d2
...
...
@@ -14,6 +14,8 @@ class PostReceive
repo_path
.
gsub!
(
/\.git\z/
,
""
)
repo_path
.
gsub!
(
/\A\//
,
""
)
update_wiki_es_indexes
(
repo_path
)
project
=
Project
.
find_with_namespace
(
repo_path
)
if
project
.
nil?
...
...
@@ -59,4 +61,14 @@ class PostReceive
def
log
(
message
)
Gitlab
::
GitLogger
.
error
(
"POST-RECEIVE:
#{
message
}
"
)
end
def
update_wiki_es_indexes
(
repo_path
)
return
unless
repo_path
=~
/wiki\z/
&&
Gitlab
.
config
.
elasticsearch
.
enabled
project
=
Project
.
find_with_namespace
(
repo_path
.
gsub
(
/\.wiki\z/
,
""
))
if
project
project
.
wiki
.
index_blobs
end
end
end
spec/workers/post_receive_spec.rb
View file @
7352f8d2
...
...
@@ -21,6 +21,17 @@ describe PostReceive do
PostReceive
.
new
.
perform
(
pwd
(
project
),
key_id
,
base64_changes
)
end
it
"triggers wiki index update"
do
allow
(
Gitlab
.
config
.
elasticsearch
).
to
receive
(
:enabled
).
and_return
(
true
)
expect
(
Project
).
to
receive
(
:find_with_namespace
).
with
(
project
.
path_with_namespace
).
and_return
(
project
)
expect
(
Project
).
to
receive
(
:find_with_namespace
).
with
(
"
#{
project
.
path_with_namespace
}
.wiki"
).
and_return
(
nil
)
expect_any_instance_of
(
ProjectWiki
).
to
receive
(
:index_blobs
)
repo_path
=
"
#{
pwd
(
project
)
}
.wiki"
PostReceive
.
new
.
perform
(
repo_path
,
key_id
,
base64_changes
)
end
it
"does not run if the author is not in the project"
do
allow
(
Key
).
to
receive
(
:find_by
).
with
(
hash_including
(
id:
anything
()))
{
nil
}
...
...
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