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
2f429887
Commit
2f429887
authored
Jan 28, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
41e0294d
fdd90a25
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
132 additions
and
15 deletions
+132
-15
.gitlab/ci/global.gitlab-ci.yml
.gitlab/ci/global.gitlab-ci.yml
+4
-4
app/assets/javascripts/feature_flags/components/feature_flags_table.vue
...ascripts/feature_flags/components/feature_flags_table.vue
+1
-1
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+6
-0
changelogs/unreleased/299087-track-assignees-and-reviewers-for-merge-requests.yml
...9087-track-assignees-and-reviewers-for-merge-requests.yml
+5
-0
changelogs/unreleased/allow-environment-scopes-to-wrap-feature-flags.yml
...leased/allow-environment-scopes-to-wrap-feature-flags.yml
+5
-0
config/feature_flags/development/usage_data_i_code_review_user_assigned.yml
...gs/development/usage_data_i_code_review_user_assigned.yml
+8
-0
config/feature_flags/development/usage_data_i_code_review_user_review_requested.yml
...opment/usage_data_i_code_review_user_review_requested.yml
+8
-0
doc/ci/jobs/index.md
doc/ci/jobs/index.md
+9
-9
ee/spec/services/ee/merge_requests/update_service_spec.rb
ee/spec/services/ee/merge_requests/update_service_spec.rb
+20
-0
lib/gitlab/usage_data_counters/known_events/common.yml
lib/gitlab/usage_data_counters/known_events/common.yml
+10
-0
lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
...ge_data_counters/merge_request_activity_unique_counter.rb
+16
-0
spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
...ta_counters/merge_request_activity_unique_counter_spec.rb
+16
-0
spec/services/merge_requests/update_service_spec.rb
spec/services/merge_requests/update_service_spec.rb
+24
-1
No files found.
.gitlab/ci/global.gitlab-ci.yml
View file @
2f429887
...
...
@@ -75,7 +75,7 @@
services
:
-
name
:
postgres:11.6
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
-
name
:
redis:
4
.0-alpine
-
name
:
redis:
5
.0-alpine
variables
:
POSTGRES_HOST_AUTH_METHOD
:
trust
...
...
@@ -84,7 +84,7 @@
services
:
-
name
:
postgres:12
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
-
name
:
redis:
4
.0-alpine
-
name
:
redis:
5
.0-alpine
variables
:
POSTGRES_HOST_AUTH_METHOD
:
trust
...
...
@@ -93,7 +93,7 @@
services
:
-
name
:
postgres:11.6
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
-
name
:
redis:
4
.0-alpine
-
name
:
redis:
5
.0-alpine
-
name
:
elasticsearch:7.9.2
command
:
[
"
elasticsearch"
,
"
-E"
,
"
discovery.type=single-node"
]
variables
:
...
...
@@ -104,7 +104,7 @@
services
:
-
name
:
postgres:12
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
-
name
:
redis:
4
.0-alpine
-
name
:
redis:
5
.0-alpine
-
name
:
elasticsearch:7.9.2
command
:
[
"
elasticsearch"
,
"
-E"
,
"
discovery.type=single-node"
]
variables
:
...
...
app/assets/javascripts/feature_flags/components/feature_flags_table.vue
View file @
2f429887
...
...
@@ -199,7 +199,7 @@ export default {
:key=
"strategy.id"
data-testid=
"strategy-badge"
variant=
"info"
class=
"gl-mr-3 gl-mt-2"
class=
"gl-mr-3 gl-mt-2
gl-white-space-normal gl-text-left gl-px-5
"
>
{{
strategyBadgeText
(
strategy
)
}}
</gl-badge
>
</
template
>
...
...
app/services/merge_requests/update_service.rb
View file @
2f429887
...
...
@@ -109,6 +109,9 @@ module MergeRequests
create_assignee_note
(
merge_request
,
old_assignees
)
notification_service
.
async
.
reassigned_merge_request
(
merge_request
,
current_user
,
old_assignees
)
todo_service
.
reassigned_assignable
(
merge_request
,
current_user
,
old_assignees
)
new_assignees
=
merge_request
.
assignees
-
old_assignees
merge_request_activity_counter
.
track_users_assigned_to_mr
(
users:
new_assignees
)
end
def
handle_reviewers_change
(
merge_request
,
old_reviewers
)
...
...
@@ -117,6 +120,9 @@ module MergeRequests
notification_service
.
async
.
changed_reviewer_of_merge_request
(
merge_request
,
current_user
,
old_reviewers
)
todo_service
.
reassigned_reviewable
(
merge_request
,
current_user
,
old_reviewers
)
invalidate_cache_counts
(
merge_request
,
users:
affected_reviewers
.
compact
)
new_reviewers
=
merge_request
.
reviewers
-
old_reviewers
merge_request_activity_counter
.
track_users_review_requested
(
users:
new_reviewers
)
end
def
create_branch_change_note
(
issuable
,
branch_type
,
old_branch
,
new_branch
)
...
...
changelogs/unreleased/299087-track-assignees-and-reviewers-for-merge-requests.yml
0 → 100644
View file @
2f429887
---
title
:
Track the number of users who are assigned and get requested for reviews
merge_request
:
52194
author
:
type
:
other
changelogs/unreleased/allow-environment-scopes-to-wrap-feature-flags.yml
0 → 100644
View file @
2f429887
---
title
:
Allow Environment Scopes to Wrap on Feature Flags Table
merge_request
:
52617
author
:
type
:
fixed
config/feature_flags/development/usage_data_i_code_review_user_assigned.yml
0 → 100644
View file @
2f429887
---
name
:
usage_data_i_code_review_user_assigned
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52194
rollout_issue_url
:
milestone
:
'
13.9'
type
:
development
group
:
group::code review
default_enabled
:
true
config/feature_flags/development/usage_data_i_code_review_user_review_requested.yml
0 → 100644
View file @
2f429887
---
name
:
usage_data_i_code_review_user_review_requested
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52194
rollout_issue_url
:
milestone
:
'
13.9'
type
:
development
group
:
group::code review
default_enabled
:
true
doc/ci/jobs/index.md
View file @
2f429887
...
...
@@ -196,8 +196,8 @@ You can create [collapsible sections in job logs](#expand-and-collapse-job-log-s
by manually outputting special codes
that GitLab uses to determine what sections to collapse:
-
Section start marker:
`section_start:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
+
`TEXT_OF_SECTION_HEADER`
-
Section end marker:
`section_end:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
-
Section start marker:
`
\e[0K
section_start:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
+
`TEXT_OF_SECTION_HEADER`
-
Section end marker:
`
\e[0K
section_end:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
You must add these codes to the script section of the CI configuration. For example,
using
`echo`
:
...
...
@@ -205,9 +205,9 @@ using `echo`:
```
yaml
job1
:
script
:
-
echo -e "section_start:`date +%s`:my_first_section\r\e[0KHeader of the 1st collapsible section"
-
echo -e "
\e[0K
section_start:`date +%s`:my_first_section\r\e[0KHeader of the 1st collapsible section"
-
echo 'this line should be hidden when collapsed'
-
echo -e "section_end:`date +%s`:my_first_section\r\e[0K"
-
echo -e "
\e[0K
section_end:`date +%s`:my_first_section\r\e[0K"
```
In the example above:
...
...
@@ -223,9 +223,9 @@ In the example above:
Sample raw job log:
```
plaintext
section_start:1560896352:my_first_section\r\e[0KHeader of the 1st collapsible section
\e[0K
section_start:1560896352:my_first_section\r\e[0KHeader of the 1st collapsible section
this line should be hidden when collapsed
section_end:1560896353:my_first_section\r\e[0K
\e[0K
section_end:1560896353:my_first_section\r\e[0K
```
### Pre-collapse sections
...
...
@@ -236,7 +236,7 @@ You can make the job log automatically collapse collapsible sections by adding t
Add
`[collapsed=true]`
after the section name and before the
`\r`
. The section end marker
remains unchanged:
-
Section start marker with
`[collapsed=true]`
:
`section_start:UNIX_TIMESTAMP:SECTION_NAME[collapsed=true]\r\e[0K`
+
`TEXT_OF_SECTION_HEADER`
-
Section start marker with
`[collapsed=true]`
:
`
\e[0K
section_start:UNIX_TIMESTAMP:SECTION_NAME[collapsed=true]\r\e[0K`
+
`TEXT_OF_SECTION_HEADER`
-
Section end marker:
`section_end:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
Add the updated section start text to the CI configuration. For example,
...
...
@@ -245,7 +245,7 @@ using `echo`:
```
yaml
job1
:
script
:
-
echo -e "section_start:`date +%s`:my_first_section[collapsed=true]\r\e[0KHeader of the 1st collapsible section"
-
echo -e "
\e[0K
section_start:`date +%s`:my_first_section[collapsed=true]\r\e[0KHeader of the 1st collapsible section"
-
echo 'this line should be hidden automatically after loading the job log'
-
echo -e "section_end:`date +%s`:my_first_section\r\e[0K"
-
echo -e "
\e[0K
section_end:`date +%s`:my_first_section\r\e[0K"
```
ee/spec/services/ee/merge_requests/update_service_spec.rb
View file @
2f429887
...
...
@@ -330,5 +330,25 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
update_merge_request
(
title:
'Title'
)
end
context
'updating assignee_ids'
do
it
'updates the tracking when user ids are valid'
do
expect
(
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
)
.
to
receive
(
:track_users_assigned_to_mr
)
.
with
(
users:
[
user
,
user2
])
update_merge_request
(
assignee_ids:
[
user
.
id
,
user2
.
id
])
end
end
context
'updating reviewers_ids'
do
it
'updates the tracking when user ids are valid'
do
expect
(
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
)
.
to
receive
(
:track_users_review_requested
)
.
with
(
users:
[
user
,
user2
])
update_merge_request
(
reviewer_ids:
[
user
.
id
,
user2
.
id
])
end
end
end
end
lib/gitlab/usage_data_counters/known_events/common.yml
View file @
2f429887
...
...
@@ -541,6 +541,16 @@
category
:
code_review
aggregation
:
weekly
feature_flag
:
usage_data_i_code_review_user_apply_suggestion
-
name
:
i_code_review_user_assigned
redis_slot
:
code_review
category
:
code_review
aggregation
:
weekly
feature_flag
:
usage_data_i_code_review_user_assigned
-
name
:
i_code_review_user_review_requested
redis_slot
:
code_review
category
:
code_review
aggregation
:
weekly
feature_flag
:
usage_data_i_code_review_user_review_requested
# Terraform
-
name
:
p_terraform_state_api_unique_users
category
:
terraform
...
...
lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
View file @
2f429887
...
...
@@ -22,6 +22,8 @@ module Gitlab
MR_APPLY_SUGGESTION_ACTION
=
'i_code_review_user_apply_suggestion'
MR_RESOLVE_THREAD_ACTION
=
'i_code_review_user_resolve_thread'
MR_UNRESOLVE_THREAD_ACTION
=
'i_code_review_user_unresolve_thread'
MR_ASSIGNED_USERS_ACTION
=
'i_code_review_user_assigned'
MR_REVIEW_REQUESTED_USERS_ACTION
=
'i_code_review_user_review_requested'
class
<<
self
def
track_mr_diffs_action
(
merge_request
:)
...
...
@@ -88,6 +90,14 @@ module Gitlab
track_unique_action_by_user
(
MR_APPLY_SUGGESTION_ACTION
,
user
)
end
def
track_users_assigned_to_mr
(
users
:)
track_unique_action_by_users
(
MR_ASSIGNED_USERS_ACTION
,
users
)
end
def
track_users_review_requested
(
users
:)
track_unique_action_by_users
(
MR_REVIEW_REQUESTED_USERS_ACTION
,
users
)
end
private
def
track_unique_action_by_merge_request
(
action
,
merge_request
)
...
...
@@ -100,6 +110,12 @@ module Gitlab
track_unique_action
(
action
,
user
.
id
)
end
def
track_unique_action_by_users
(
action
,
users
)
return
if
users
.
blank?
track_unique_action
(
action
,
users
.
map
(
&
:id
))
end
def
track_unique_action
(
action
,
value
)
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
track_usage_event
(
action
,
value
)
end
...
...
spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
View file @
2f429887
...
...
@@ -180,4 +180,20 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
let
(
:action
)
{
described_class
::
MR_APPLY_SUGGESTION_ACTION
}
end
end
describe
'.track_users_assigned_to_mr'
do
subject
{
described_class
.
track_users_assigned_to_mr
(
users:
[
user
])
}
it_behaves_like
'a tracked merge request unique event'
do
let
(
:action
)
{
described_class
::
MR_ASSIGNED_USERS_ACTION
}
end
end
describe
'.track_users_review_requested'
do
subject
{
described_class
.
track_users_review_requested
(
users:
[
user
])
}
it_behaves_like
'a tracked merge request unique event'
do
let
(
:action
)
{
described_class
::
MR_REVIEW_REQUESTED_USERS_ACTION
}
end
end
end
spec/services/merge_requests/update_service_spec.rb
View file @
2f429887
...
...
@@ -143,7 +143,7 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
let
(
:opts
)
{
{
reviewer_ids:
[
user2
.
id
]
}
}
context
'when merge_request_reviewers feature is disabled'
do
before
(
:context
)
do
before
do
stub_feature_flags
(
merge_request_reviewers:
false
)
end
...
...
@@ -152,6 +152,13 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
expect
(
note
).
to
be_nil
end
it
'does not update the tracking'
do
expect
(
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
)
.
not_to
receive
(
:track_users_review_requested
)
update_merge_request
(
reviewer_ids:
[
user
.
id
])
end
end
context
'when merge_request_reviewers feature is enabled'
do
...
...
@@ -165,6 +172,14 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
expect
(
note
).
not_to
be_nil
expect
(
note
.
note
).
to
include
"requested review from
#{
user2
.
to_reference
}
"
end
it
'updates the tracking'
do
expect
(
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
)
.
to
receive
(
:track_users_review_requested
)
.
with
(
users:
[
user
])
update_merge_request
(
reviewer_ids:
[
user
.
id
])
end
end
end
...
...
@@ -794,6 +809,14 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
expect
(
merge_request
.
assignee_ids
).
to
eq
([
user
.
id
])
end
it
'updates the tracking when user ids are valid'
do
expect
(
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
)
.
to
receive
(
:track_users_assigned_to_mr
)
.
with
(
users:
[
user
])
update_merge_request
(
assignee_ids:
[
user
.
id
])
end
it
'does not update assignee_id when user cannot read issue'
do
non_member
=
create
(
:user
)
original_assignees
=
merge_request
.
assignees
...
...
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