Commit Graph

3376 Commits

Author SHA1 Message Date
Douwe Maan b2c5363da1 Rename to_fuzzy_arel to fuzzy_arel_match 2017-11-24 17:28:50 +01:00
Sean McGivern 89c9d2ad6b Merge branch 'dm-fix-registry-with-sudo-token' into 'master'
Fix pulling and pushing using a personal access token with the sudo scope

Closes #40466

See merge request gitlab-org/gitlab-ce!15571
2017-11-24 09:09:38 +00:00
Douwe Maan fad4ab7d56 Merge branch 'pawel/update_prometheus_gem_to_well_tested_version' into 'master'
Update Prometheus Gem version and disable Prometheus method call instrumentation by default.

Closes gitlab-ee#4139 and #40457

See merge request gitlab-org/gitlab-ce!15558
2017-11-24 09:01:12 +00:00
Pawel Chojnacki 46cd2d93bb Use feature flag instead of application settigns to control if method calls should be instrumented 2017-11-23 23:39:10 +01:00
Pawel Chojnacki 0051b5fbcc Use only real duration to measure method call performance via Prometheus 2017-11-23 23:33:01 +01:00
Pawel Chojnacki efe4cab92b check method timing threshold when observing method performance 2017-11-23 23:33:01 +01:00
James Lopez fdd7a4cb1b Fix hashed storage for attachments bugs 2017-11-23 17:04:35 +00:00
Sean McGivern dd11f0e053 Merge branch 'dm-cleanup-fetch-and-mirror-methods' into 'master'
Clean up repository fetch and mirror methods

See merge request gitlab-org/gitlab-ce!15424
2017-11-23 17:01:47 +00:00
Douwe Maan 7a1e93d35b Rename fetch_refs to refmap 2017-11-23 16:59:58 +01:00
Douwe Maan 0e6beaf50c Clean up repository fetch and mirror methods 2017-11-23 16:59:50 +01:00
Douwe Maan 453b178093 Fix pulling and pushing using a personal access token with the sudo scope 2017-11-23 16:32:08 +01:00
Douwe Maan dbf97574dc Merge branch '39887-move-identical-check-to-merged-branches' into 'master'
Move identical merged branch check to merged_branch_names

Closes #39887

See merge request gitlab-org/gitlab-ce!15464
2017-11-23 15:16:37 +00:00
Douwe Maan ad70fb7bdc Merge branch 'use-merge-requests-diff-id-column' into 'master'
Use foreign key to get latest MR diff

Closes #37631

See merge request gitlab-org/gitlab-ce!15126
2017-11-23 15:01:30 +00:00
Markus Koller 257fd57134 Allow password authentication to be disabled entirely 2017-11-23 13:16:14 +00:00
Sean McGivern 991bf24ec8 Use latest_merge_request_diff association
Compared to the merge_request_diff association:

1. It's simpler to query. The query uses a foreign key to the
   merge_request_diffs table, so no ordering is necessary.
2. It's faster for preloading. The merge_request_diff association has to load
   every diff for the MRs in the set, then discard all but the most recent for
   each. This association means that Rails can just query for N diffs from N
   MRs.
3. It's more complicated to update. This is a bidirectional foreign key, so we
   need to update two tables when adding a diff record. This also means we need
   to handle this as a special case when importing a GitLab project.

There is some juggling with this association in the merge request model:

* `MergeRequest#latest_merge_request_diff` is _always_ the latest diff.
* `MergeRequest#merge_request_diff` reuses
  `MergeRequest#latest_merge_request_diff` unless:
    * Arguments are passed. These are typically to force-reload the association.
    * It doesn't exist. That means we might be trying to implicitly create a
      diff. This only seems to happen in specs.
    * The association is already loaded. This is important for the reasons
      explained in the comment, which I'll reiterate here: if we a) load a
      non-latest diff, then b) get its `merge_request`, then c) get that MR's
      `merge_request_diff`, we should get the diff we loaded in c), even though
      that's not the latest diff.

Basically, `MergeRequest#merge_request_diff` is the latest diff in most cases,
but not quite all.
2017-11-23 12:14:56 +00:00
Jacob Vosmaer (GitLab) 4cfcc97544 Fix encoding bugs in Gitlab::Git::User 2017-11-23 10:48:57 +00:00
Lin Jen-Shin 5951320075 Make sure repository is restored 2017-11-23 18:26:41 +08:00
Lin Jen-Shin 7df1cb528e Move identical merged branch check to merged_branch_names 2017-11-23 18:26:41 +08:00
Douwe Maan 6c33981654 Merge branch 'sh-optimize-read-only-check' into 'master'
Optimize read-only middleware so that it does not consume as much CPU

Closes #40185 and gitlab-com/infrastructure#3240

See merge request gitlab-org/gitlab-ce!15504
2017-11-21 16:10:47 +00:00
Zeger-Jan van de Weg f9565e3039
Batchload blobs for diff generation
After installing a new gem, batch-loader, a construct can be used to
queue data to be fetched in bulk. The gem was also introduced in both
gitlab-org/gitlab-ce!14680 and gitlab-org/gitlab-ce!14846, but those mrs
are not merged yet.

For the generation of diffs, both the old blob and the new blob need to
be loaded. This for every file in the diff, too. Now we collect all
these so we do 1 fetch. Three `.allow_n_plus_1_calls` have been removed,
which I expect to be valid, but this needs to be confirmed by a full CI
run.

Possibly closes:
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37445
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37599
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37431
2017-11-21 13:53:26 +01:00
digitalMoksha cba68d338b use `Gitlab::Routing.url_helpers` instead of `Rails.application.routes.url_helpers`
since `Rails.application.routes.url_helpers` creates a new anonymous module every time it's called
2017-11-21 13:29:57 +01:00
Stan Hu 3c52e2f06e Optimize read-only middleware so that it does not consume as much CPU
In !15082, we changed the behavior of the middleware to call
`Rails.application.routes.recognize_path` whenever a new route arrived.
However, this can be a CPU-intensive task because Rails needs to allocate
memory and compile 850+ different regular expressions, which are complicated
in GitLab.

As a short-term fix, we can do a lightweight string match before
we do the heavier comparison.

Closes #40185, gitlab-com/infrastructure#3240
2017-11-20 15:27:52 -08:00
Douwe Maan c043ba67c2 Merge branch '40292-bitbucket-import-hashed-storage' into 'master'
Fix bitbucket wiki import with hashed storage enabled

Closes #40292

See merge request gitlab-org/gitlab-ce!15490
2017-11-20 18:08:36 +00:00
Nick Thomas f2977c63a8
Fix bitbucket wiki import with hashed storage enabled 2017-11-20 16:14:41 +00:00
Douwe Maan 4b78f70fc4 Merge branch 'gitaly-delete-refs' into 'master'
Incorporate Gitaly's RefService.DeleteRefs RPC

Closes gitaly#740

See merge request gitlab-org/gitlab-ce!15460
2017-11-20 15:20:40 +00:00
Douwe Maan bd026b6a28 Merge branch 'bvl-dont-move-projects-using-hashed-storage' into 'master'
Don't move project repository/attachments when using hashed storage

Closes #40289

See merge request gitlab-org/gitlab-ce!15479
2017-11-20 13:48:20 +00:00
Bob Van Landuyt fa39e8a09c Don't move project repository/attachments when using hashed storage
When a project is using hashed storage, the repositories and
attachments wouldn't be saved on disk using the `full_path`. So the
migration would not do anything.

However: best to just skip moving when hashed storage is enabled.
2017-11-20 13:46:53 +01:00
Yorick Peterse 936e9e8950
Clean up schema of the "merge_requests" table
This adds various foreign keys and indexes to the "merge_requests" table
as outlined in https://gitlab.com/gitlab-org/gitlab-ce/issues/31825.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/31825
2017-11-20 12:45:33 +01:00
Douwe Maan 202ab62874 Merge branch 'fix-conflict-highlighting' into 'master'
Fix conflict highlighting

See merge request gitlab-org/gitlab-ce!15463
2017-11-20 10:17:43 +00:00
Rémy Coutable 4f09d099e9 Merge branch '18040-rubocop-line-break-after-guard-clause' into 'master'
Adds Rubocop rule for line break after guard clause

Closes #18040

See merge request gitlab-org/gitlab-ce!15188
2017-11-20 09:22:14 +00:00
Alejandro Rodríguez 3f0c9e9708 Fix Gitlab::Git::Repository#remote_tags using unexisting variable 2017-11-20 09:08:09 +00:00
Alejandro Rodríguez 38730a2d07 Incorporate Gitaly's RefService.DeleteRefs RPC 2017-11-17 18:08:50 -03:00
Sean McGivern 64a9e53bd1 Fix conflict highlighting
Conflicts used to take a `Repository` and pass that to
`Gitlab::Highlight.highlight`, which would call `#gitattribute` on the
repository. Now they use a `Gitlab::Git::Repository`, which didn't have that
method defined - but defining it on `Gitlab::Git::Repository` does make it
available on `Repository` through `method_missing`, so we can do that and both
cases will work.
2017-11-17 17:57:48 +00:00
Douwe Maan 371180a47d Merge branch 'mk-add-user-rate-limits' into 'master'
Add request rate limits

Closes #30053

See merge request gitlab-org/gitlab-ce!14708
2017-11-17 16:11:22 +00:00
Francisco Javier López c7cf68bd6f Changing OAuth lookup to be case insensitive 2017-11-17 14:24:25 +00:00
Sean McGivern 69dd59aec9 Merge branch 'dm-go-get-blank-enabled-protocol' into 'master'
Fix go-import meta data when enabled_git_access_protocol is a blank string

Closes #40256

See merge request gitlab-org/gitlab-ce!15448
2017-11-17 12:35:05 +00:00
Francisco Lopez 4188c10c07 Renaming AuthenticationException to AuthenticationError 2017-11-17 13:33:21 +01:00
Douwe Maan f767dd4a4d Fix go-import meta data when enabled_git_access_protocol is a blank string 2017-11-17 12:17:16 +01:00
Stan Hu 5cecff893d Convert migration to populate latest merge request ID into a background migration
This is to smear updates over a few hours to avoid causing excessive
replication lag as seen in https://gitlab.com/gitlab-com/infrastructure/issues/3235.
2017-11-17 10:23:48 +00:00
Francisco Lopez 1436598e49 Moved Exceptions to Gitlab::Auth 2017-11-17 10:02:11 +01:00
Francisco Lopez aa84ef1e1a Moving exceptions to UserAuthFinders 2017-11-17 10:02:11 +01:00
Francisco Lopez f189657523 Added some more comments 2017-11-17 10:02:11 +01:00
Francisco Lopez 130a9933fe Added UserAuthFinders spec 2017-11-17 10:02:11 +01:00
Francisco Lopez 8e57cc7e41 Added RequestAuthenticator spec 2017-11-17 10:02:11 +01:00
Jacopo 181cd299f9 Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
2017-11-16 17:58:29 +01:00
Rémy Coutable c5720382e6 Merge branch 'bvl-isolate-fork-network-background-migrations' into 'master'
Isolate the fork network background migrations

See merge request gitlab-org/gitlab-ce!15393
2017-11-16 16:08:46 +00:00
Rémy Coutable 05c10c9bf7 Add total_time_spent to the `changes` hash in issuable Webhook payloads
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-11-15 15:42:19 +01:00
Bob Van Landuyt f961744bde Isolate the fork network background migrations
Before the `PopulateForkNetworksRange` spec would also call the
`CreateForkNetworkMemberships` which we would count on in the spec.

With this, I'm isolating that, and counting only records created in
this particular migration instead.
2017-11-15 10:13:57 +01:00
Yorick Peterse 3730d89fe8 Merge branch 'bvl-fork-network-memberships-for-deleted-source' into 'master'
Don't try to create fork network memberships for forks of forks

Closes #40072

See merge request gitlab-org/gitlab-ce!15366
2017-11-14 13:43:04 +00:00
Bob Van Landuyt aaf18bb8c8 Don't try to create fork network memberships for forks of forks
In case the root project of a Fork-of-fork is deleted, the ForkNetwork
and the membership for that fork network is never created. In this
case we shouldn't try to create the membership, since the parent
membership will never be created.

This means that these fork networks will be lost.
2017-11-14 11:19:19 +01:00