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
f66daa0b
Commit
f66daa0b
authored
Apr 18, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable push and tag push events for the primary Geo system hook
Closes #1752
parent
de5170d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
+43
-0
app/models/geo_node.rb
app/models/geo_node.rb
+2
-0
db/migrate/20170419063751_remove_push_events_from_geo_primary_system_hook.rb
...063751_remove_push_events_from_geo_primary_system_hook.rb
+27
-0
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+14
-0
No files found.
app/models/geo_node.rb
View file @
f66daa0b
...
...
@@ -141,6 +141,8 @@ class GeoNode < ActiveRecord::Base
if
self
.
primary?
self
.
oauth_application
=
nil
update_clone_url
self
.
system_hook
.
push_events
=
false
self
.
system_hook
.
tag_push_events
=
false
else
update_oauth_application!
update_system_hook!
...
...
db/migrate/20170419063751_remove_push_events_from_geo_primary_system_hook.rb
0 → 100644
View file @
f66daa0b
class
RemovePushEventsFromGeoPrimarySystemHook
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
# Older version of Geo added push and tag push events to the
# primary system hook. This would cause unnecessary hooks to be
# fired.
def
up
return
unless
geo_enabled?
execute
<<-
SQL
UPDATE web_hooks
SET push_events = false, tag_push_events = false WHERE
type = 'SystemHook' AND
id = (
SELECT system_hook_id FROM geo_nodes WHERE
host =
#{
quote
(
Gitlab
.
config
.
gitlab
.
host
)
}
AND
port =
#{
quote
(
Gitlab
.
config
.
gitlab
.
port
)
}
AND
relative_url_root =
#{
quote
(
Gitlab
.
config
.
gitlab
.
relative_url_root
)
}
);
SQL
end
def
geo_enabled?
select_all
(
"SELECT 1 FROM geo_nodes"
).
present?
end
end
spec/models/geo_node_spec.rb
View file @
f66daa0b
...
...
@@ -46,6 +46,20 @@ describe GeoNode, type: :model do
end
end
context
'system hooks'
do
it
'primary creates a system hook with no push events'
do
hook
=
primary_node
.
system_hook
expect
(
hook
.
push_events
).
to
be_falsey
expect
(
hook
.
tag_push_events
).
to
be_falsey
end
it
'secondary creates a system hook with push events'
do
hook
=
new_node
.
system_hook
expect
(
hook
.
push_events
).
to
be_truthy
expect
(
hook
.
tag_push_events
).
to
be_truthy
end
end
context
'prevent locking yourself out'
do
subject
do
GeoNode
.
new
(
host:
Gitlab
.
config
.
gitlab
.
host
,
...
...
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