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
a68d0dd0
Commit
a68d0dd0
authored
Apr 17, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
5966e367
0de554ed
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
108 additions
and
23 deletions
+108
-23
app/models/notification_recipient.rb
app/models/notification_recipient.rb
+8
-12
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+2
-2
changelogs/unreleased/fix-extra-emails-for-custom-notifications.yml
.../unreleased/fix-extra-emails-for-custom-notifications.yml
+5
-0
doc/administration/monitoring/prometheus/index.md
doc/administration/monitoring/prometheus/index.md
+16
-2
doc/ci/merge_request_pipelines/index.md
doc/ci/merge_request_pipelines/index.md
+7
-1
doc/update/mysql_to_postgresql.md
doc/update/mysql_to_postgresql.md
+1
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+60
-2
spec/support/helpers/email_helpers.rb
spec/support/helpers/email_helpers.rb
+3
-1
spec/support/helpers/notification_helpers.rb
spec/support/helpers/notification_helpers.rb
+6
-2
No files found.
app/models/notification_recipient.rb
View file @
a68d0dd0
...
...
@@ -47,14 +47,14 @@ class NotificationRecipient
def
suitable_notification_level?
case
notification_level
when
:disabled
,
nil
false
when
:custom
custom_enabled?
||
%i[participating mention]
.
include?
(
@type
)
when
:watch
,
:participating
!
action_excluded?
when
:mention
@type
==
:mention
when
:participating
!
excluded_participating_action?
&&
%i[participating mention watch]
.
include?
(
@type
)
when
:custom
custom_enabled?
||
%i[participating mention]
.
include?
(
@type
)
when
:watch
!
excluded_watcher_action?
else
false
end
...
...
@@ -100,18 +100,14 @@ class NotificationRecipient
end
end
def
action_excluded?
excluded_watcher_action?
||
excluded_participating_action?
end
def
excluded_watcher_action?
return
false
unless
@custom_action
&&
notification_level
==
:watch
return
false
unless
@custom_action
NotificationSetting
::
EXCLUDED_WATCHER_EVENTS
.
include?
(
@custom_action
)
end
def
excluded_participating_action?
return
false
unless
@custom_action
&&
notification_level
==
:participating
return
false
unless
@custom_action
NotificationSetting
::
EXCLUDED_PARTICIPATING_EVENTS
.
include?
(
@custom_action
)
end
...
...
app/services/notification_recipient_service.rb
View file @
a68d0dd0
...
...
@@ -135,7 +135,7 @@ module NotificationRecipientService
global_users_ids
=
user_ids_with_project_level_global
.
concat
(
user_ids_with_group_level_global
)
user_ids
+=
user_ids_with_global_level_custom
(
global_users_ids
,
custom_action
)
add_recipients
(
user_scope
.
where
(
id:
user_ids
),
:
watch
,
nil
)
add_recipients
(
user_scope
.
where
(
id:
user_ids
),
:
custom
,
nil
)
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
@@ -391,7 +391,7 @@ module NotificationRecipientService
def
build!
return
[]
unless
project
add_recipients
(
project
.
team
.
maintainers
,
:
watch
,
nil
)
add_recipients
(
project
.
team
.
maintainers
,
:
mention
,
nil
)
end
def
acting_user
...
...
changelogs/unreleased/fix-extra-emails-for-custom-notifications.yml
0 → 100644
View file @
a68d0dd0
---
title
:
Fix extra emails for custom notifications
merge_request
:
25607
author
:
type
:
fixed
doc/administration/monitoring/prometheus/index.md
View file @
a68d0dd0
...
...
@@ -98,11 +98,13 @@ To use an external Prometheus server:
```ruby
gitlab_monitor['listen_address'] = '0.0.0.0'
sidekiq['listen_address'] = '0.0.0.0'
gitlab_monitor['listen_port'] = '9168'
gitaly['prometheus_listen_addr'] = "0.0.0.0:9236"
node_exporter['listen_address'] = '0.0.0.0:9100'
redis_exporter['listen_address'] = '0.0.0.0:9121'
postgres_exporter['listen_address'] = '0.0.0.0:9187'
gitaly['prometheus_listen_addr'] = "0.0.0.0:9236"
gitlab_workhorse['prometheus_listen_addr'] = "0.0.0.0:9229"
```
1.
Install and set up a dedicated Prometheus instance, if necessary, using the
[
official installation instructions
](
https://prometheus.io/docs/prometheus/latest/installation/
)
.
...
...
@@ -112,6 +114,18 @@ To use an external Prometheus server:
gitlab_rails['monitoring_whitelist'] = ['127.0.0.0/8', '192.168.0.1']
```
1.
To scrape nginx metrics, you'll also need to configure nginx to allow the Prometheus server
IP. For example:
```ruby
nginx['status']['options'] = {
"server_tokens" => "off",
"access_log" => "off",
"allow" => "192.168.0.1",
"deny" => "all",
}
```
1.
[
Reconfigure GitLab
][
reconfigure
]
to apply the changes
1.
Edit the Prometheus server's configuration file.
1.
Add each node's exporters to the Prometheus server's
...
...
doc/ci/merge_request_pipelines/index.md
View file @
a68d0dd0
# Pipelines for merge requests
NOTE:
**Note**
:
As of GitLab 11.10, pipelines for merge requests require GitLab Runner 11.9
or higher due to the
[
recent refspecs
changes
](
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25504
)
.
Anything lower will cause the pipeline to fail.
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/15310) in GitLab 11.6.
Usually, when you create a new merge request, a pipeline runs with the
...
...
doc/update/mysql_to_postgresql.md
View file @
a68d0dd0
...
...
@@ -41,7 +41,7 @@ Debian/Ubuntu:
sudo
apt-get
install
pgloader
```
For other distributions, follow the instructions in Post
r
greSQL's
For other distributions, follow the instructions in PostgreSQL's
[
download page
](
https://www.postgresql.org/download/
)
to add their repository
and then install
`pgloader`
.
...
...
spec/services/notification_service_spec.rb
View file @
a68d0dd0
...
...
@@ -643,6 +643,64 @@ describe NotificationService, :mailer do
end
end
describe
'Participating project notification settings have priority over group and global settings if available'
do
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:maintainer
)
{
group
.
add_owner
(
create
(
:user
,
username:
'maintainer'
)).
user
}
let!
(
:user1
)
{
group
.
add_developer
(
create
(
:user
,
username:
'user_with_project_and_custom_setting'
)).
user
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
group
)
}
let
(
:issue
)
{
create
:issue
,
project:
project
,
assignees:
[
assignee
],
description:
''
}
before
do
reset_delivered_emails!
create_notification_setting
(
user1
,
project
,
:participating
)
end
context
'custom on group'
do
[
nil
,
true
].
each
do
|
new_issue_value
|
value_caption
=
new_issue_value
||
'nil'
it
"does not send an email to user1 when a new issue is created and new_issue is set to
#{
value_caption
}
"
do
update_custom_notification
(
:new_issue
,
user1
,
resource:
group
,
value:
new_issue_value
)
notification
.
new_issue
(
issue
,
maintainer
)
should_not_email
(
user1
)
end
end
end
context
'watch on group'
do
it
'does not send an email'
do
user1
.
notification_settings_for
(
group
).
update!
(
level: :watch
)
notification
.
new_issue
(
issue
,
maintainer
)
should_not_email
(
user1
)
end
end
context
'custom on global, global on group'
do
it
'does not send an email'
do
user1
.
notification_settings_for
(
nil
).
update!
(
level: :custom
)
user1
.
notification_settings_for
(
group
).
update!
(
level: :global
)
notification
.
new_issue
(
issue
,
maintainer
)
should_not_email
(
user1
)
end
end
context
'watch on global, global on group'
do
it
'does not send an email'
do
user1
.
notification_settings_for
(
nil
).
update!
(
level: :watch
)
user1
.
notification_settings_for
(
group
).
update!
(
level: :global
)
notification
.
new_issue
(
issue
,
maintainer
)
should_not_email
(
user1
)
end
end
end
describe
'Issues'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
group
)
}
...
...
@@ -660,7 +718,7 @@ describe NotificationService, :mailer do
end
describe
'#new_issue'
do
it
do
it
'notifies the expected users'
do
notification
.
new_issue
(
issue
,
@u_disabled
)
should_email
(
assignee
)
...
...
@@ -1639,7 +1697,7 @@ describe NotificationService, :mailer do
end
describe
'#project_was_moved'
do
it
do
it
'notifies the expected users'
do
notification
.
project_was_moved
(
project
,
"gitlab/gitlab"
)
should_email
(
@u_watcher
)
...
...
spec/support/helpers/email_helpers.rb
View file @
a68d0dd0
...
...
@@ -16,7 +16,9 @@ module EmailHelpers
end
def
should_email
(
user
,
times:
1
,
recipients:
email_recipients
)
expect
(
sent_to_user
(
user
,
recipients:
recipients
)).
to
eq
(
times
)
amount
=
sent_to_user
(
user
,
recipients:
recipients
)
failed_message
=
lambda
{
"User
#{
user
.
username
}
(
#{
user
.
id
}
): email test failed (expected
#{
times
}
, got
#{
amount
}
)"
}
expect
(
amount
).
to
eq
(
times
),
failed_message
end
def
should_not_email
(
user
,
recipients:
email_recipients
)
...
...
spec/support/helpers/notification_helpers.rb
View file @
a68d0dd0
...
...
@@ -17,11 +17,15 @@ module NotificationHelpers
def
create_user_with_notification
(
level
,
username
,
resource
=
project
)
user
=
create
(
:user
,
username:
username
)
create_notification_setting
(
user
,
resource
,
level
)
user
end
def
create_notification_setting
(
user
,
resource
,
level
)
setting
=
user
.
notification_settings_for
(
resource
)
setting
.
level
=
level
setting
.
save
user
end
# Create custom notifications
...
...
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