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
6aab0a1c
Commit
6aab0a1c
authored
Aug 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
e3c2ec2c
0555bc64
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
81 additions
and
32 deletions
+81
-32
app/serializers/analytics_issue_entity.rb
app/serializers/analytics_issue_entity.rb
+1
-1
changelogs/unreleased/fix-name-vs-path-problem-for-cycle-analytics.yml
...released/fix-name-vs-path-problem-for-cycle-analytics.yml
+5
-0
doc/administration/plugins.md
doc/administration/plugins.md
+31
-1
doc/user/project/pipelines/settings.md
doc/user/project/pipelines/settings.md
+7
-0
lib/gitlab/cycle_analytics/base_query.rb
lib/gitlab/cycle_analytics/base_query.rb
+10
-3
lib/gitlab/cycle_analytics/code_event_fetcher.rb
lib/gitlab/cycle_analytics/code_event_fetcher.rb
+1
-3
lib/gitlab/cycle_analytics/issue_event_fetcher.rb
lib/gitlab/cycle_analytics/issue_event_fetcher.rb
+1
-3
lib/gitlab/cycle_analytics/issue_helper.rb
lib/gitlab/cycle_analytics/issue_helper.rb
+10
-3
lib/gitlab/cycle_analytics/plan_event_fetcher.rb
lib/gitlab/cycle_analytics/plan_event_fetcher.rb
+1
-3
lib/gitlab/cycle_analytics/plan_helper.rb
lib/gitlab/cycle_analytics/plan_helper.rb
+4
-2
lib/gitlab/cycle_analytics/production_event_fetcher.rb
lib/gitlab/cycle_analytics/production_event_fetcher.rb
+0
-1
lib/gitlab/cycle_analytics/review_event_fetcher.rb
lib/gitlab/cycle_analytics/review_event_fetcher.rb
+1
-3
spec/serializers/analytics_issue_entity_spec.rb
spec/serializers/analytics_issue_entity_spec.rb
+3
-3
spec/serializers/analytics_issue_serializer_spec.rb
spec/serializers/analytics_issue_serializer_spec.rb
+3
-3
spec/serializers/analytics_merge_request_serializer_spec.rb
spec/serializers/analytics_merge_request_serializer_spec.rb
+3
-3
No files found.
app/serializers/analytics_issue_entity.rb
View file @
6aab0a1c
...
@@ -26,6 +26,6 @@ class AnalyticsIssueEntity < Grape::Entity
...
@@ -26,6 +26,6 @@ class AnalyticsIssueEntity < Grape::Entity
private
private
def
url_to
(
route
,
object
)
def
url_to
(
route
,
object
)
public_send
(
"
#{
route
}
_url"
,
object
[
:
path
],
object
[
:name
],
object
[
:iid
].
to_s
)
# rubocop:disable GitlabSecurity/PublicSend
public_send
(
"
#{
route
}
_url"
,
object
[
:
namespace_path
],
object
[
:project_path
],
object
[
:iid
].
to_s
)
# rubocop:disable GitlabSecurity/PublicSend
end
end
end
end
changelogs/unreleased/fix-name-vs-path-problem-for-cycle-analytics.yml
0 → 100644
View file @
6aab0a1c
---
title
:
Fix broken issue links and possible 500 error on cycle analytics page when project name and path are different
merge_request
:
31471
author
:
type
:
fixed
doc/administration/plugins.md
View file @
6aab0a1c
...
@@ -52,7 +52,37 @@ as appropriate. The plugins file list is updated for each event, there is no
...
@@ -52,7 +52,37 @@ as appropriate. The plugins file list is updated for each event, there is no
need to restart GitLab to apply a new plugin.
need to restart GitLab to apply a new plugin.
If a plugin executes with non-zero exit code or GitLab fails to execute it, a
If a plugin executes with non-zero exit code or GitLab fails to execute it, a
message will be logged to
`plugin.log`
.
message will be logged to:
-
`gitlab-rails/plugin.log`
in an Omnibus installation.
-
`log/plugin.log`
in a source installation.
## Creating plugins
Below is an example that will only response on the event
`project_create`
and
will inform the admins from the GitLab instance that a new project has been created.
```
ruby
# By using the embedded ruby version we eliminate the possibility that our chosen language
# would be unavailable from
#!/opt/gitlab/embedded/bin/ruby
require
'json'
require
'mail'
# The incoming variables are in JSON format so we need to parse it first.
ARGS
=
JSON
.
parse
(
STDIN
.
read
)
# We only want to trigger this plugin on the event project_create
return
unless
ARGS
[
'event_name'
]
==
'project_create'
# We will inform our admins of our gitlab instance that a new project is created
Mail
.
deliver
do
from
'info@gitlab_instance.com'
to
'admin@gitlab_instance.com'
subject
"new project "
+
ARGS
[
'name'
]
body
ARGS
[
'owner_name'
]
+
'created project '
+
ARGS
[
'name'
]
end
```
## Validation
## Validation
...
...
doc/user/project/pipelines/settings.md
View file @
6aab0a1c
...
@@ -76,6 +76,13 @@ Here are some valid examples:
...
@@ -76,6 +76,13 @@ Here are some valid examples:
-
`my/path/.gitlab-ci.yml`
-
`my/path/.gitlab-ci.yml`
-
`my/path/.my-custom-file.yml`
-
`my/path/.my-custom-file.yml`
The path can be customized at a project level. To customize the path:
1.
Go to the project's
**Settings > CI / CD**
.
1.
Expand the
**General pipelines**
section.
1.
Provide a value in the
**Custom CI config path**
field.
1.
Click
**Save changes**
.
## Test coverage parsing
## Test coverage parsing
If you use test coverage in your code, GitLab can capture its output in the
If you use test coverage in your code, GitLab can capture its output in the
...
...
lib/gitlab/cycle_analytics/base_query.rb
View file @
6aab0a1c
...
@@ -19,9 +19,10 @@ module Gitlab
...
@@ -19,9 +19,10 @@ module Gitlab
.
join
(
projects_table
).
on
(
issue_table
[
:project_id
].
eq
(
projects_table
[
:id
]))
.
join
(
projects_table
).
on
(
issue_table
[
:project_id
].
eq
(
projects_table
[
:id
]))
.
join
(
routes_table
).
on
(
projects_table
[
:namespace_id
].
eq
(
routes_table
[
:source_id
]))
.
join
(
routes_table
).
on
(
projects_table
[
:namespace_id
].
eq
(
routes_table
[
:source_id
]))
.
project
(
issue_table
[
:project_id
].
as
(
"project_id"
))
.
project
(
issue_table
[
:project_id
].
as
(
"project_id"
))
.
where
(
issue_table
[
:project_id
].
in
(
project_ids
))
.
project
(
projects_table
[
:path
].
as
(
"project_path"
))
.
where
(
routes_table
[
:source_type
].
eq
(
'Namespace'
))
.
project
(
routes_table
[
:path
].
as
(
"namespace_path"
))
.
where
(
issue_table
[
:created_at
].
gteq
(
options
[
:from
]))
query
=
limit_query
(
query
,
project_ids
)
# Load merge_requests
# Load merge_requests
...
@@ -30,6 +31,12 @@ module Gitlab
...
@@ -30,6 +31,12 @@ module Gitlab
query
query
end
end
def
limit_query
(
query
,
project_ids
)
query
.
where
(
issue_table
[
:project_id
].
in
(
project_ids
))
.
where
(
routes_table
[
:source_type
].
eq
(
'Namespace'
))
.
where
(
issue_table
[
:created_at
].
gteq
(
options
[
:from
]))
end
def
load_merge_requests
(
query
)
def
load_merge_requests
(
query
)
query
.
join
(
mr_table
,
Arel
::
Nodes
::
OuterJoin
)
query
.
join
(
mr_table
,
Arel
::
Nodes
::
OuterJoin
)
.
on
(
mr_table
[
:id
].
eq
(
mr_closing_issues_table
[
:merge_request_id
]))
.
on
(
mr_table
[
:id
].
eq
(
mr_closing_issues_table
[
:merge_request_id
]))
...
...
lib/gitlab/cycle_analytics/code_event_fetcher.rb
View file @
6aab0a1c
...
@@ -11,9 +11,7 @@ module Gitlab
...
@@ -11,9 +11,7 @@ module Gitlab
mr_table
[
:id
],
mr_table
[
:id
],
mr_table
[
:created_at
],
mr_table
[
:created_at
],
mr_table
[
:state
],
mr_table
[
:state
],
mr_table
[
:author_id
],
mr_table
[
:author_id
]]
projects_table
[
:name
],
routes_table
[
:path
]]
@order
=
mr_table
[
:created_at
]
@order
=
mr_table
[
:created_at
]
super
(
*
args
)
super
(
*
args
)
...
...
lib/gitlab/cycle_analytics/issue_event_fetcher.rb
View file @
6aab0a1c
...
@@ -10,9 +10,7 @@ module Gitlab
...
@@ -10,9 +10,7 @@ module Gitlab
issue_table
[
:iid
],
issue_table
[
:iid
],
issue_table
[
:id
],
issue_table
[
:id
],
issue_table
[
:created_at
],
issue_table
[
:created_at
],
issue_table
[
:author_id
],
issue_table
[
:author_id
]]
projects_table
[
:name
],
routes_table
[
:path
]]
super
(
*
args
)
super
(
*
args
)
end
end
...
...
lib/gitlab/cycle_analytics/issue_helper.rb
View file @
6aab0a1c
...
@@ -8,12 +8,19 @@ module Gitlab
...
@@ -8,12 +8,19 @@ module Gitlab
.
join
(
projects_table
).
on
(
issue_table
[
:project_id
].
eq
(
projects_table
[
:id
]))
.
join
(
projects_table
).
on
(
issue_table
[
:project_id
].
eq
(
projects_table
[
:id
]))
.
join
(
routes_table
).
on
(
projects_table
[
:namespace_id
].
eq
(
routes_table
[
:source_id
]))
.
join
(
routes_table
).
on
(
projects_table
[
:namespace_id
].
eq
(
routes_table
[
:source_id
]))
.
project
(
issue_table
[
:project_id
].
as
(
"project_id"
))
.
project
(
issue_table
[
:project_id
].
as
(
"project_id"
))
.
where
(
issue_table
[
:project_id
].
in
(
project_ids
))
.
project
(
projects_table
[
:path
].
as
(
"project_path"
))
.
project
(
routes_table
[
:path
].
as
(
"namespace_path"
))
query
=
limit_query
(
query
,
project_ids
)
query
end
def
limit_query
(
query
,
project_ids
)
query
.
where
(
issue_table
[
:project_id
].
in
(
project_ids
))
.
where
(
routes_table
[
:source_type
].
eq
(
'Namespace'
))
.
where
(
routes_table
[
:source_type
].
eq
(
'Namespace'
))
.
where
(
issue_table
[
:created_at
].
gteq
(
options
[
:from
]))
.
where
(
issue_table
[
:created_at
].
gteq
(
options
[
:from
]))
.
where
(
issue_metrics_table
[
:first_added_to_board_at
].
not_eq
(
nil
).
or
(
issue_metrics_table
[
:first_associated_with_milestone_at
].
not_eq
(
nil
)))
.
where
(
issue_metrics_table
[
:first_added_to_board_at
].
not_eq
(
nil
).
or
(
issue_metrics_table
[
:first_associated_with_milestone_at
].
not_eq
(
nil
)))
query
end
end
end
end
end
end
...
...
lib/gitlab/cycle_analytics/plan_event_fetcher.rb
View file @
6aab0a1c
...
@@ -10,9 +10,7 @@ module Gitlab
...
@@ -10,9 +10,7 @@ module Gitlab
issue_table
[
:iid
],
issue_table
[
:iid
],
issue_table
[
:id
],
issue_table
[
:id
],
issue_table
[
:created_at
],
issue_table
[
:created_at
],
issue_table
[
:author_id
],
issue_table
[
:author_id
]]
projects_table
[
:name
],
routes_table
[
:path
]]
super
(
*
args
)
super
(
*
args
)
end
end
...
...
lib/gitlab/cycle_analytics/plan_helper.rb
View file @
6aab0a1c
...
@@ -8,14 +8,16 @@ module Gitlab
...
@@ -8,14 +8,16 @@ module Gitlab
.
join
(
projects_table
).
on
(
issue_table
[
:project_id
].
eq
(
projects_table
[
:id
]))
.
join
(
projects_table
).
on
(
issue_table
[
:project_id
].
eq
(
projects_table
[
:id
]))
.
join
(
routes_table
).
on
(
projects_table
[
:namespace_id
].
eq
(
routes_table
[
:source_id
]))
.
join
(
routes_table
).
on
(
projects_table
[
:namespace_id
].
eq
(
routes_table
[
:source_id
]))
.
project
(
issue_table
[
:project_id
].
as
(
"project_id"
))
.
project
(
issue_table
[
:project_id
].
as
(
"project_id"
))
.
project
(
projects_table
[
:path
].
as
(
"project_path"
))
.
project
(
routes_table
[
:path
].
as
(
"namespace_path"
))
.
where
(
issue_table
[
:project_id
].
in
(
project_ids
))
.
where
(
issue_table
[
:project_id
].
in
(
project_ids
))
.
where
(
routes_table
[
:source_type
].
eq
(
'Namespace'
))
.
where
(
routes_table
[
:source_type
].
eq
(
'Namespace'
))
query
=
add_conditions_to
_query
(
query
)
query
=
limit
_query
(
query
)
query
query
end
end
def
add_conditions_to
_query
(
query
)
def
limit
_query
(
query
)
query
.
where
(
issue_table
[
:created_at
].
gteq
(
options
[
:from
]))
query
.
where
(
issue_table
[
:created_at
].
gteq
(
options
[
:from
]))
.
where
(
issue_metrics_table
[
:first_added_to_board_at
].
not_eq
(
nil
).
or
(
issue_metrics_table
[
:first_associated_with_milestone_at
].
not_eq
(
nil
)))
.
where
(
issue_metrics_table
[
:first_added_to_board_at
].
not_eq
(
nil
).
or
(
issue_metrics_table
[
:first_associated_with_milestone_at
].
not_eq
(
nil
)))
.
where
(
issue_metrics_table
[
:first_mentioned_in_commit_at
].
not_eq
(
nil
))
.
where
(
issue_metrics_table
[
:first_mentioned_in_commit_at
].
not_eq
(
nil
))
...
...
lib/gitlab/cycle_analytics/production_event_fetcher.rb
View file @
6aab0a1c
...
@@ -11,7 +11,6 @@ module Gitlab
...
@@ -11,7 +11,6 @@ module Gitlab
issue_table
[
:id
],
issue_table
[
:id
],
issue_table
[
:created_at
],
issue_table
[
:created_at
],
issue_table
[
:author_id
],
issue_table
[
:author_id
],
projects_table
[
:name
],
routes_table
[
:path
]]
routes_table
[
:path
]]
super
(
*
args
)
super
(
*
args
)
...
...
lib/gitlab/cycle_analytics/review_event_fetcher.rb
View file @
6aab0a1c
...
@@ -11,9 +11,7 @@ module Gitlab
...
@@ -11,9 +11,7 @@ module Gitlab
mr_table
[
:id
],
mr_table
[
:id
],
mr_table
[
:created_at
],
mr_table
[
:created_at
],
mr_table
[
:state
],
mr_table
[
:state
],
mr_table
[
:author_id
],
mr_table
[
:author_id
]]
projects_table
[
:name
],
routes_table
[
:path
]]
super
(
*
args
)
super
(
*
args
)
end
end
...
...
spec/serializers/analytics_issue_entity_spec.rb
View file @
6aab0a1c
...
@@ -10,12 +10,12 @@ describe AnalyticsIssueEntity do
...
@@ -10,12 +10,12 @@ describe AnalyticsIssueEntity do
id:
"1"
,
id:
"1"
,
created_at:
"2016-11-12 15:04:02.948604"
,
created_at:
"2016-11-12 15:04:02.948604"
,
author:
user
,
author:
user
,
name:
project
.
name
,
project_path:
project
.
path
,
path:
project
.
namespace
namespace_path:
project
.
namespace
.
route
.
path
}
}
end
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
name:
'my project'
)
}
let
(
:request
)
{
EntityRequest
.
new
(
entity: :merge_request
)
}
let
(
:request
)
{
EntityRequest
.
new
(
entity: :merge_request
)
}
let
(
:entity
)
do
let
(
:entity
)
do
...
...
spec/serializers/analytics_issue_serializer_spec.rb
View file @
6aab0a1c
...
@@ -8,7 +8,7 @@ describe AnalyticsIssueSerializer do
...
@@ -8,7 +8,7 @@ describe AnalyticsIssueSerializer do
end
end
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
name:
'my project'
)
}
let
(
:resource
)
do
let
(
:resource
)
do
{
{
total_time:
"172802.724419"
,
total_time:
"172802.724419"
,
...
@@ -17,8 +17,8 @@ describe AnalyticsIssueSerializer do
...
@@ -17,8 +17,8 @@ describe AnalyticsIssueSerializer do
id:
"1"
,
id:
"1"
,
created_at:
"2016-11-12 15:04:02.948604"
,
created_at:
"2016-11-12 15:04:02.948604"
,
author:
user
,
author:
user
,
name:
project
.
name
,
project_path:
project
.
path
,
path:
project
.
namespace
namespace_path:
project
.
namespace
.
route
.
path
}
}
end
end
...
...
spec/serializers/analytics_merge_request_serializer_spec.rb
View file @
6aab0a1c
...
@@ -8,7 +8,7 @@ describe AnalyticsMergeRequestSerializer do
...
@@ -8,7 +8,7 @@ describe AnalyticsMergeRequestSerializer do
end
end
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
name:
'my project'
)
}
let
(
:resource
)
do
let
(
:resource
)
do
{
{
total_time:
"172802.724419"
,
total_time:
"172802.724419"
,
...
@@ -18,8 +18,8 @@ describe AnalyticsMergeRequestSerializer do
...
@@ -18,8 +18,8 @@ describe AnalyticsMergeRequestSerializer do
state:
'open'
,
state:
'open'
,
created_at:
"2016-11-12 15:04:02.948604"
,
created_at:
"2016-11-12 15:04:02.948604"
,
author:
user
,
author:
user
,
name:
project
.
name
,
project_path:
project
.
path
,
path:
project
.
namespace
namespace_path:
project
.
namespace
.
route
.
path
}
}
end
end
...
...
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