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
55693cc1
Commit
55693cc1
authored
Feb 03, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
c089cf73
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
110 additions
and
36 deletions
+110
-36
app/finders/pipelines_finder.rb
app/finders/pipelines_finder.rb
+1
-1
app/services/issuable/clone/attributes_rewriter.rb
app/services/issuable/clone/attributes_rewriter.rb
+20
-20
changelogs/unreleased/195888-import_to_find_group_objects_within_all_group_ancestors.yml
...port_to_find_group_objects_within_all_group_ancestors.yml
+5
-0
changelogs/unreleased/37745-optimize-pipelines-finder.yml
changelogs/unreleased/37745-optimize-pipelines-finder.yml
+5
-0
changelogs/unreleased/ab-projects-api-remove-unneeded-indexes.yml
...gs/unreleased/ab-projects-api-remove-unneeded-indexes.yml
+5
-0
danger/roulette/Dangerfile
danger/roulette/Dangerfile
+4
-0
db/migrate/20200130161817_drop_unneeded_indexes_for_projects_api_requests.rb
...161817_drop_unneeded_indexes_for_projects_api_requests.rb
+31
-0
db/schema.rb
db/schema.rb
+1
-6
doc/development/contributing/style_guides.md
doc/development/contributing/style_guides.md
+3
-1
doc/development/go_guide/index.md
doc/development/go_guide/index.md
+3
-3
doc/fixtures/gitlab_tanuki.png
doc/fixtures/gitlab_tanuki.png
+0
-0
doc/user/markdown.md
doc/user/markdown.md
+5
-0
lib/gitlab/import_export/group_project_object_builder.rb
lib/gitlab/import_export/group_project_object_builder.rb
+4
-2
spec/controllers/help_controller_spec.rb
spec/controllers/help_controller_spec.rb
+1
-1
spec/lib/gitlab/import_export/group_project_object_builder_spec.rb
...gitlab/import_export/group_project_object_builder_spec.rb
+22
-2
No files found.
app/finders/pipelines_finder.rb
View file @
55693cc1
...
...
@@ -39,7 +39,7 @@ class PipelinesFinder
# rubocop: disable CodeReuse/ActiveRecord
def
from_ids
(
ids
)
pipelines
.
unscoped
.
where
(
id:
ids
)
pipelines
.
unscoped
.
where
(
project_id:
project
.
id
,
id:
ids
)
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
app/services/issuable/clone/attributes_rewriter.rb
View file @
55693cc1
...
...
@@ -12,7 +12,7 @@ module Issuable
def
execute
update_attributes
=
{
labels:
cloneable_labels
}
milestone
=
cloneable_milestone
milestone
=
matching_milestone
(
original_entity
.
milestone
&
.
title
)
update_attributes
[
:milestone
]
=
milestone
if
milestone
.
present?
new_entity
.
update
(
update_attributes
)
...
...
@@ -23,11 +23,8 @@ module Issuable
private
def
cloneable_milestone
return
unless
new_entity
.
supports_milestone?
title
=
original_entity
.
milestone
&
.
title
return
unless
title
def
matching_milestone
(
title
)
return
if
title
.
blank?
||
!
new_entity
.
supports_milestone?
params
=
{
title:
title
,
project_ids:
new_entity
.
project
&
.
id
,
group_ids:
group
&
.
id
}
...
...
@@ -49,29 +46,32 @@ module Issuable
end
def
copy_resource_label_events
original_entity
.
resource_label_events
.
find_in_batches
do
|
batch
|
events
=
batch
.
map
do
|
event
|
entity_key
=
new_entity
.
is_a?
(
Issue
)
?
'issue_id'
:
'epic_id'
event
.
attributes
.
except
(
'id'
,
'reference'
,
'reference_html'
)
.
merge
(
entity_key
=>
new_entity
.
id
,
'action'
=>
ResourceLabelEvent
.
actions
[
event
.
action
])
end
entity_key
=
new_entity
.
class
.
name
.
underscore
.
foreign_key
Gitlab
::
Database
.
bulk_insert
(
ResourceLabelEvent
.
table_name
,
events
)
copy_events
(
ResourceLabelEvent
.
table_name
,
original_entity
.
resource_label_events
)
do
|
event
|
event
.
attributes
.
except
(
'id'
,
'reference'
,
'reference_html'
)
.
merge
(
entity_key
=>
new_entity
.
id
,
'action'
=>
ResourceLabelEvent
.
actions
[
event
.
action
])
end
end
def
copy_resource_weight_events
return
unless
original_entity
.
respond_to?
(
:resource_weight_events
)
original_entity
.
resource_weight_events
.
find_in_batches
do
|
batch
|
copy_events
(
ResourceWeightEvent
.
table_name
,
original_entity
.
resource_weight_events
)
do
|
event
|
event
.
attributes
.
except
(
'id'
,
'reference'
,
'reference_html'
)
.
merge
(
'issue_id'
=>
new_entity
.
id
)
end
end
def
copy_events
(
table_name
,
events_to_copy
)
events_to_copy
.
find_in_batches
do
|
batch
|
events
=
batch
.
map
do
|
event
|
event
.
attributes
.
except
(
'id'
,
'reference'
,
'reference_html'
)
.
merge
(
'issue_id'
=>
new_entity
.
id
)
end
yield
(
event
)
end
.
compact
Gitlab
::
Database
.
bulk_insert
(
ResourceWeightEvent
.
table_name
,
events
)
Gitlab
::
Database
.
bulk_insert
(
table_name
,
events
)
end
end
...
...
changelogs/unreleased/195888-import_to_find_group_objects_within_all_group_ancestors.yml
0 → 100644
View file @
55693cc1
---
title
:
Search group-level objects among all ancestors during project import
merge_request
:
author
:
type
:
changed
changelogs/unreleased/37745-optimize-pipelines-finder.yml
0 → 100644
View file @
55693cc1
---
title
:
Fix query performance in PipelinesFinder
merge_request
:
21092
author
:
type
:
performance
changelogs/unreleased/ab-projects-api-remove-unneeded-indexes.yml
0 → 100644
View file @
55693cc1
---
title
:
Remove unneeded indexes on projects table
merge_request
:
24086
author
:
type
:
performance
danger/roulette/Dangerfile
View file @
55693cc1
...
...
@@ -16,6 +16,10 @@ To spread load more evenly across eligible reviewers, Danger has randomly picked
a candidate for each review slot. Feel free to override this selection if you
think someone else would be better-suited, or the chosen person is unavailable.
To read more on how to use the reviewer roulette, please take a look at the
[Engineering workflow](https://about.gitlab.com/handbook/engineering/workflow/#basics)
and [code review guidelines](https://docs.gitlab.com/ee/development/code_review.html).
Once you've decided who will review this merge request, mention them as you
normally would! Danger does not (yet?) automatically notify them for you.
...
...
db/migrate/20200130161817_drop_unneeded_indexes_for_projects_api_requests.rb
0 → 100644
View file @
55693cc1
# frozen_string_literal: true
class
DropUnneededIndexesForProjectsApiRequests
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
def
up
indexes
=
%w(
index_projects_api_vis20_created_at_id_desc
index_projects_api_vis20_last_activity_at_id_desc
index_projects_api_vis20_updated_at_id_desc
index_projects_api_vis20_name_id_desc
index_projects_api_vis20_path_id_desc
)
indexes
.
each
do
|
index
|
remove_concurrent_index_by_name
:projects
,
index
end
end
def
down
columns
=
%i(created_at last_activity_at updated_at name path)
columns
.
each
do
|
column
|
add_concurrent_index
:projects
,
[
column
,
:id
],
where:
'visibility_level = 20'
,
order:
{
id: :desc
},
name:
"index_projects_api_vis20_
#{
column
}
_id_desc"
end
end
end
db/schema.rb
View file @
55693cc1
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2020_01_
29_035708
)
do
ActiveRecord
::
Schema
.
define
(
version:
2020_01_
30_161817
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_trgm"
...
...
@@ -3382,7 +3382,6 @@ ActiveRecord::Schema.define(version: 2020_01_29_035708) do
t
.
index
"lower((name)::text)"
,
name:
"index_projects_on_lower_name"
t
.
index
[
"created_at"
,
"id"
],
name:
"index_projects_api_created_at_id_desc"
,
order:
{
id: :desc
}
t
.
index
[
"created_at"
,
"id"
],
name:
"index_projects_api_vis20_created_at"
,
where:
"(visibility_level = 20)"
t
.
index
[
"created_at"
,
"id"
],
name:
"index_projects_api_vis20_created_at_id_desc"
,
order:
{
id: :desc
},
where:
"(visibility_level = 20)"
t
.
index
[
"created_at"
,
"id"
],
name:
"index_projects_on_created_at_and_id"
t
.
index
[
"creator_id"
],
name:
"index_projects_on_creator_id"
t
.
index
[
"description"
],
name:
"index_projects_on_description_trigram"
,
opclass: :gin_trgm_ops
,
using: :gin
...
...
@@ -3392,7 +3391,6 @@ ActiveRecord::Schema.define(version: 2020_01_29_035708) do
t
.
index
[
"id"
],
name:
"index_projects_on_mirror_and_mirror_trigger_builds_both_true"
,
where:
"((mirror IS TRUE) AND (mirror_trigger_builds IS TRUE))"
t
.
index
[
"last_activity_at"
,
"id"
],
name:
"index_projects_api_last_activity_at_id_desc"
,
order:
{
id: :desc
}
t
.
index
[
"last_activity_at"
,
"id"
],
name:
"index_projects_api_vis20_last_activity_at"
,
where:
"(visibility_level = 20)"
t
.
index
[
"last_activity_at"
,
"id"
],
name:
"index_projects_api_vis20_last_activity_at_id_desc"
,
order:
{
id: :desc
},
where:
"(visibility_level = 20)"
t
.
index
[
"last_activity_at"
,
"id"
],
name:
"index_projects_on_last_activity_at_and_id"
t
.
index
[
"last_repository_check_at"
],
name:
"index_projects_on_last_repository_check_at"
,
where:
"(last_repository_check_at IS NOT NULL)"
t
.
index
[
"last_repository_check_failed"
],
name:
"index_projects_on_last_repository_check_failed"
...
...
@@ -3403,13 +3401,11 @@ ActiveRecord::Schema.define(version: 2020_01_29_035708) do
t
.
index
[
"mirror_user_id"
],
name:
"index_projects_on_mirror_user_id"
t
.
index
[
"name"
,
"id"
],
name:
"index_projects_api_name_id_desc"
,
order:
{
id: :desc
}
t
.
index
[
"name"
,
"id"
],
name:
"index_projects_api_vis20_name"
,
where:
"(visibility_level = 20)"
t
.
index
[
"name"
,
"id"
],
name:
"index_projects_api_vis20_name_id_desc"
,
order:
{
id: :desc
},
where:
"(visibility_level = 20)"
t
.
index
[
"name"
,
"id"
],
name:
"index_projects_on_name_and_id"
t
.
index
[
"name"
],
name:
"index_projects_on_name_trigram"
,
opclass: :gin_trgm_ops
,
using: :gin
t
.
index
[
"namespace_id"
],
name:
"index_projects_on_namespace_id"
t
.
index
[
"path"
,
"id"
],
name:
"index_projects_api_path_id_desc"
,
order:
{
id: :desc
}
t
.
index
[
"path"
,
"id"
],
name:
"index_projects_api_vis20_path"
,
where:
"(visibility_level = 20)"
t
.
index
[
"path"
,
"id"
],
name:
"index_projects_api_vis20_path_id_desc"
,
order:
{
id: :desc
},
where:
"(visibility_level = 20)"
t
.
index
[
"path"
,
"id"
],
name:
"index_projects_on_path_and_id"
t
.
index
[
"path"
],
name:
"index_projects_on_path_trigram"
,
opclass: :gin_trgm_ops
,
using: :gin
t
.
index
[
"pending_delete"
],
name:
"index_projects_on_pending_delete"
...
...
@@ -3421,7 +3417,6 @@ ActiveRecord::Schema.define(version: 2020_01_29_035708) do
t
.
index
[
"star_count"
],
name:
"index_projects_on_star_count"
t
.
index
[
"updated_at"
,
"id"
],
name:
"index_projects_api_updated_at_id_desc"
,
order:
{
id: :desc
}
t
.
index
[
"updated_at"
,
"id"
],
name:
"index_projects_api_vis20_updated_at"
,
where:
"(visibility_level = 20)"
t
.
index
[
"updated_at"
,
"id"
],
name:
"index_projects_api_vis20_updated_at_id_desc"
,
order:
{
id: :desc
},
where:
"(visibility_level = 20)"
t
.
index
[
"updated_at"
,
"id"
],
name:
"index_projects_on_updated_at_and_id"
end
...
...
doc/development/contributing/style_guides.md
View file @
55693cc1
...
...
@@ -4,7 +4,9 @@
You're strongly advised to install
[
Overcommit
](
https://github.com/sds/overcommit
)
to automatically check for
static analysis offenses before committing locally:
static analysis offenses before committing locally.
In your GitLab source directory run:
```
shell
cd
tooling/overcommit
&&
make
&&
cd
-
...
...
doc/development/go_guide/index.md
View file @
55693cc1
...
...
@@ -52,9 +52,9 @@ Web servers can take advantages of middlewares like [Secure](https://github.com/
Many of our projects are too small to have full-time maintainers. That's why we
have a shared pool of Go reviewers at GitLab. To find a reviewer, use the
[
Engineering Projects
](
https://about.gitlab.com/handbook/engineering/projects/
)
page in the handbook. "GitLab Community Edition (CE)" and "GitLab Community
Edition (EE)" both have a "Go" section with its list of reviewers
.
[
"Go" section
](
https://about.gitlab.com/handbook/engineering/projects/#gitlab_reviewers_go
)
of the "GitLab" project on the Engineering Projects
page in the handbook
.
To add yourself to this list, add the following to your profile in the
[
team.yml
](
https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/data/team.yml
)
...
...
doc/fixtures/gitlab_tanuki.png
deleted
100644 → 0
View file @
c089cf73
2.49 KB
doc/user/markdown.md
View file @
55693cc1
...
...
@@ -896,6 +896,11 @@ Reference-style (hover to see title text):
[
logo
]:
img/markdown_logo.png
"Title Text"
```
<!--
DO NOT change the name of markdown_logo.png. This is used for a test
in spec/controllers/help_controller_spec.rb.
-->
Inline-style (hover to see title text):
![
alt text
](
img/markdown_logo.png
"Title Text"
)
...
...
lib/gitlab/import_export/group_project_object_builder.rb
View file @
55693cc1
...
...
@@ -50,7 +50,7 @@ module Gitlab
def
where_clause_base
[].
tap
do
|
clauses
|
clauses
<<
table
[
:project_id
].
eq
(
project
.
id
)
if
project
clauses
<<
table
[
:group_id
].
eq
(
group
.
id
)
if
group
clauses
<<
table
[
:group_id
].
in
(
group
.
self_and_ancestors_ids
)
if
group
end
.
reduce
(
:or
)
end
...
...
@@ -60,7 +60,9 @@ module Gitlab
end
def
prepare_attributes
attributes
.
except
(
'group'
).
tap
do
|
atts
|
attributes
.
dup
.
tap
do
|
atts
|
atts
.
delete
(
'group'
)
unless
epic?
if
label?
atts
[
'type'
]
=
'ProjectLabel'
# Always create project labels
elsif
milestone?
...
...
spec/controllers/help_controller_spec.rb
View file @
55693cc1
...
...
@@ -111,7 +111,7 @@ describe HelpController do
it
'renders the raw file'
do
get
:show
,
params:
{
path:
'
fixtures/gitlab_tanuki
'
path:
'
user/img/markdown_logo
'
},
format: :png
expect
(
response
).
to
be_successful
...
...
spec/lib/gitlab/import_export/group_project_object_builder_spec.rb
View file @
55693cc1
...
...
@@ -3,13 +3,15 @@
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
GroupProjectObjectBuilder
do
let
(
:project
)
do
let!
(
:group
)
{
create
(
:group
,
:private
)
}
let!
(
:subgroup
)
{
create
(
:group
,
:private
,
parent:
group
)
}
let!
(
:project
)
do
create
(
:project
,
:repository
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
,
group:
create
(
:group
)
)
group:
subgroup
)
end
let
(
:lru_cache
)
{
subject
.
send
(
:lru_cache
)
}
...
...
@@ -75,6 +77,15 @@ describe Gitlab::ImportExport::GroupProjectObjectBuilder do
'group'
=>
project
.
group
)).
to
eq
(
group_label
)
end
it
'finds the existing group label in root ancestor'
do
group_label
=
create
(
:group_label
,
name:
'group label'
,
group:
group
)
expect
(
described_class
.
build
(
Label
,
'title'
=>
'group label'
,
'project'
=>
project
,
'group'
=>
group
)).
to
eq
(
group_label
)
end
it
'creates a new label'
do
label
=
described_class
.
build
(
Label
,
'title'
=>
'group label'
,
...
...
@@ -95,6 +106,15 @@ describe Gitlab::ImportExport::GroupProjectObjectBuilder do
'group'
=>
project
.
group
)).
to
eq
(
milestone
)
end
it
'finds the existing group milestone in root ancestor'
do
milestone
=
create
(
:milestone
,
name:
'group milestone'
,
group:
group
)
expect
(
described_class
.
build
(
Milestone
,
'title'
=>
'group milestone'
,
'project'
=>
project
,
'group'
=>
group
)).
to
eq
(
milestone
)
end
it
'creates a new milestone'
do
milestone
=
described_class
.
build
(
Milestone
,
'title'
=>
'group milestone'
,
...
...
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