Commit Graph

3376 Commits

Author SHA1 Message Date
Douwe Maan c9515ca541 Merge branch 'jej/fix-lfs-integrity-with-forks' into 'master'
Handle forks in Gitlab::Checks::LfsIntegrity

Closes #39902

See merge request gitlab-org/gitlab-ce!15279
2017-11-14 09:48:19 +00:00
Rémy Coutable 701577f0f2 Merge branch 'gitaly-wiki-get-all-pages' into 'master'
Incorporate Gitaly's WikiService.WikiGetAllPages RPC

Closes gitaly#722

See merge request gitlab-org/gitlab-ce!15307
2017-11-14 08:02:49 +00:00
Alejandro Rodríguez 282e7f8eab Incorporate Gitaly's WikiService.WikiGetAllPages RPC 2017-11-13 16:54:50 -03:00
Alejandro Rodríguez 5a38a9d86d Add spec examples for Gitlab::Gitaly::WikiService 2017-11-13 16:54:40 -03:00
Lin Jen-Shin (godfat) 258bf3e187 Add Gitlab::Utils::StrongMemoize 2017-11-13 15:27:30 +00:00
Jacob Vosmaer (GitLab) de301d13bb Prepare Repository#fetch_source_branch for migration 2017-11-10 14:45:23 +00:00
Sean McGivern 58dd9d73ab Merge branch 'cleanup-issues-schema' into 'master'
Clean up the schema of the table "issues"

Closes #31811

See merge request gitlab-org/gitlab-ce!15225
2017-11-10 11:26:32 +00:00
Yorick Peterse d825c9cb5d
Clean up schema of the "issues" table
This adds various foreign key constraints, indexes, missing NOT NULL
constraints, and changes some column types from timestamp to
timestamptz.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/31811
2017-11-09 18:00:30 +01:00
James Edwards-Jones ebd5174472 Handle forks in Gitlab::Checks::LfsIntegrity 2017-11-09 13:44:20 +00:00
Sean McGivern 43d98cd1ff Merge branch '39958-updatemergerequestsworker-are-failing-on-metric-tagging' into 'master'
Revert "add metrics tagging to the sidekiq middleware"

Closes #39958

See merge request gitlab-org/gitlab-ce!15285
2017-11-09 12:30:57 +00:00
Douwe Maan 760b2c75ef Merge branch 'github-rake-task-rate-limiting' into 'master'
Add GitHub enterprise support to the GitHub Rake task and better handle rate limiting being disabled

See merge request gitlab-org/gitlab-ce!15284
2017-11-09 08:37:41 +00:00
Douwe Maan 89bd78352e Merge branch 'ssrf-protections-round-2' into 'security-10-1'
Replace SSRF resolver with Addrinfo.getaddrinfo to include alternative localhost versions

See merge request gitlab/gitlabhq!2219

(cherry picked from commit 4a1e73783d)

1bffa0c3 Replace SSRF resolver with Addrinfo.getaddrinfo to include alternative localhost versions
2017-11-08 20:11:08 -08:00
micael.bergeron 7fd3ce417f Revert "add metrics tagging to the sidekiq middleware"
This reverts commit d5859bb9d5.
This reverts commit 2b7e03cf69.
This reverts commit 7799a9bc44.
2017-11-08 16:21:08 -05:00
Yorick Peterse f37fe2edc8
Support importing GH projects without rate limits
GitHub Enterprise disables rate limiting for the API, resulting in HTTP
404 errors when requesting rate limiting details. This changes
Gitlab::GithubImport::Client so it can deal with rate limiting being
disabled.
2017-11-08 21:37:01 +01:00
Stan Hu 0c3877a488 Merge branch 'fix-issues-api-list-performance' into 'master'
Fail when issuable_meta_data is called on an unlimited collection

Closes #39845

See merge request gitlab-org/gitlab-ce!15249
2017-11-08 19:37:21 +00:00
Yorick Peterse 2b886a7815
Restore Enterprise support in the GH importer
This was removed by accident as the old GitHub importer handled this
deep down the codebase, making it easy to miss.
2017-11-08 18:06:03 +01:00
Stan Hu 0232450c8a Fix Error 500 when pushing LFS objects with a write deploy key 2017-11-08 16:21:39 +00:00
James Edwards-Jones 78ea074f42 Moved LfsIntegrity specs to own file 2017-11-08 12:29:46 +00:00
Douwe Maan 92249f1ac8 Merge branch 'github-importer-refactor' into 'master'
Rewrite the GitHub importer to perform work in parallel and greatly improve performance

Closes #33135, #38621, and #39361

See merge request gitlab-org/gitlab-ce!14731
2017-11-08 11:52:39 +00:00
Douwe Maan b579cc7620 Merge branch 'feature-change-signout-route' into 'master'
Change Sign Out route from a DELETE to a GET

Closes #39708

See merge request gitlab-org/gitlab-ce!15231
2017-11-08 09:28:50 +00:00
Douwe Maan de614b0e1a Merge branch 'bvl-free-paths' into 'master'
Free some reserved group routes

See merge request gitlab-org/gitlab-ce!15052
2017-11-08 08:41:56 +00:00
Stan Hu cb606c5a79 Merge branch 'pawel/fix_backend_transaction_protected_labels_method' into 'master'
Make BackgroundTransaction#labels public

See merge request gitlab-org/gitlab-ce!15257
2017-11-08 08:14:20 +00:00
Yorick Peterse 6e242e8223
Replace old GH importer with the parallel importer 2017-11-07 23:25:03 +01:00
Yorick Peterse 4dfe26cd8b
Rewrite the GitHub importer from scratch
Prior to this MR there were two GitHub related importers:

* Github::Import: the main importer used for GitHub projects
* Gitlab::GithubImport: importer that's somewhat confusingly used for
  importing Gitea projects (apparently they have a compatible API)

This MR renames the Gitea importer to Gitlab::LegacyGithubImport and
introduces a new GitHub importer in the Gitlab::GithubImport namespace.
This new GitHub importer uses Sidekiq for importing multiple resources
in parallel, though it also has the ability to import data sequentially
should this be necessary.

The new code is spread across the following directories:

* lib/gitlab/github_import: this directory contains most of the importer
  code such as the classes used for importing resources.
* app/workers/gitlab/github_import: this directory contains the Sidekiq
  workers, most of which simply use the code from the directory above.
* app/workers/concerns/gitlab/github_import: this directory provides a
  few modules that are included in every GitHub importer worker.

== Stages

The import work is divided into separate stages, with each stage
importing a specific set of data. Stages will schedule the work that
needs to be performed, followed by scheduling a job for the
"AdvanceStageWorker" worker. This worker will periodically check if all
work is completed and schedule the next stage if this is the case. If
work is not yet completed this worker will reschedule itself.

Using this approach we don't have to block threads by calling `sleep()`,
as doing so for large projects could block the thread from doing any
work for many hours.

== Retrying Work

Workers will reschedule themselves whenever necessary. For example,
hitting the GitHub API's rate limit will result in jobs rescheduling
themselves. These jobs are not processed until the rate limit has been
reset.

== User Lookups

Part of the importing process involves looking up user details in the
GitHub API so we can map them to GitLab users. The old importer used
an in-memory cache, but this obviously doesn't work when the work is
spread across different threads.

The new importer uses a Redis cache and makes sure we only perform
API/database calls if absolutely necessary.  Frequently used keys are
refreshed, and lookup misses are also cached; removing the need for
performing API/database calls if we know we don't have the data we're
looking for.

== Performance & Models

The new importer in various places uses raw INSERT statements (as
generated by `Gitlab::Database.bulk_insert`) instead of using Rails
models. This allows us to bypass any validations and callbacks,
drastically reducing the number of SQL queries and Gitaly RPC calls
necessary to import projects.

To ensure the code produces valid data the corresponding tests check if
the produced rows are valid according to the model validation rules.
2017-11-07 23:24:59 +01:00
Yorick Peterse bda30182e0
Add returning IDs to Gitlab::Database.bulk_insert
This adds the keyword argument "return_ids" to
Gitlab::Database.bulk_insert. When set to `true` (and PostgreSQL is
used) this method will return an Array of the IDs of the inserted rows,
otherwise it will return an empty Array.
2017-11-07 22:28:57 +01:00
James Lopez 1c8af321dd Improve GitLab Import rake task to work with Hashed Storage and Subgroups 2017-11-07 19:11:42 +00:00
Bob Van Landuyt 9b0899cb80 Remove EE-specific group paths 2017-11-07 19:52:10 +01:00
Bob Van Landuyt e070e216c8 Update failure message when finding new routes in `PathRegex` 2017-11-07 19:52:10 +01:00
Bob Van Landuyt 58d1d6a5c7 Free up some group reserved words 2017-11-07 19:52:09 +01:00
Bob Van Landuyt 5dde0536c3 Free up `avatar`, `group_members` and `milestones` as paths 2017-11-07 19:52:09 +01:00
Pawel Chojnacki 90edcb45cd Make BackgroundTransaction#labels public
as are all other Transaction implementations
2017-11-07 19:23:52 +01:00
Joe Marty 4dea7944c4 Updates tests to reflect sign_out route change
- Also remove sign_out DELETE route from read-only whitelist routes
2017-11-07 11:42:25 -06:00
Shinya Maeda 4fac95a64d Merge branch 'master' into 38464-k8s-apps 2017-11-08 01:46:53 +09:00
Sean McGivern 4d4ddb6004 Fail when issuable_meta_data is called on an unlimited collection
This method can be called with an array, or a relation:

1. Arrays always have a limited amount of values, so that's fine.
2. If the relation does not have a limit value applied, then we will load every
   single object in that collection, and prevent N+1 queries for the metadata
   for that. But that's wrong, because we should never call this without an
   explicit limit set. So we raise in that case, and this commit will see which
   specs fail.

The only failing specs here were the issues API specs, and the specs for
IssuableMetadata itself, and both have been addressed.
2017-11-07 16:26:55 +00:00
Alessio Caiazza 8ec618a6ed Add Helm InstallCommand 2017-11-07 17:12:41 +01:00
Douwe Maan c8eb789b09 Merge branch 'fix/import-export-arguments' into 'master'
Fix arguments error on Import/Export fetch_ref method

Closes #39541

See merge request gitlab-org/gitlab-ce!15241
2017-11-07 15:58:30 +00:00
Clement Ho 3f35ba769a Merge branch '39831-warning-icon-in-jobs-dropdown-has-incorrect-style' into 'master'
Resolve "Warning icon in jobs dropdown has incorrect style"

Closes #39831

See merge request gitlab-org/gitlab-ce!15221
2017-11-07 15:20:26 +00:00
Rémy Coutable d45fef88f7 Merge branch 'fix-mysql-grant-check' into 'master'
Fix TRIGGER checks for MySQL

Closes #38372

See merge request gitlab-org/gitlab-ce!15226
2017-11-07 14:56:53 +00:00
James Lopez 9a0acc98aa fix specs 2017-11-07 15:40:13 +01:00
James Lopez 179b8178bd Fix arguments error on Import/Export fetch_ref method
Added unit test and updated integration spec to test for this as well.
2017-11-07 14:25:35 +01:00
Alessio Caiazza 3f261a499e Add k8s namespace implementation and tests 2017-11-07 14:05:58 +01:00
Shinya Maeda b982a44abb Merge branch '38464-k8s-apps' of https://gitlab.com/gitlab-org/gitlab-ce into 38464-k8s-apps 2017-11-07 21:24:28 +09:00
Shinya Maeda bbdb0cf051 Merge branch 'master' into 38464-k8s-apps 2017-11-07 21:23:54 +09:00
Rémy Coutable 31e3ef93e5 Merge branch 'feature/custom-attributes-on-projects-and-groups' into 'master'
Support custom attributes on groups and projects

See merge request gitlab-org/gitlab-ce!14593
2017-11-07 10:59:38 +00:00
Alessio Caiazza d6134709cb
Remove Project#clusters export 2017-11-07 11:20:02 +01:00
Eric Eastwood a46d32412e Merge branch 'master' into 38464-k8s-apps
Conflicts:
	db/schema.rb
2017-11-06 17:03:31 -06:00
Yorick Peterse 60526a5291
Fix TRIGGER checks for MySQL
This ensures we can check if the user has TRIGGER permissions without
querying restricted tables. Thanks to Steve Norman
(https://gitlab.com/stevenorman) for helping out with this merge
request.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/38372
2017-11-06 23:34:07 +01:00
Grzegorz Bizon c71cf908cd Merge branch 'refactor-clusters' into 'master'
Refactor Clusters to be consisted from GcpProvider and KubernetesPlatform

See merge request gitlab-org/gitlab-ce!14879
2017-11-06 21:21:27 +00:00
Grzegorz Bizon 4da03e9977 Merge branch 'pawel/metrics-to-prometheus-33643' into 'master'
Add all InfluxDB metrics to prometheus

See merge request gitlab-org/gitlab-ce!13891
2017-11-06 21:17:24 +00:00
Sean McGivern 045795d0d9 Merge branch 'remove-ensure-ref-fetched-from-controllers' into 'master'
removed the #ensure_ref_fetched from all controllers

Closes #36061

See merge request gitlab-org/gitlab-ce!15129
2017-11-06 17:10:18 +00:00
Alessio Caiazza 2b4fccb720
Add Helm import/export 2017-11-06 18:06:02 +01:00
Douwe Maan a48d0595ab Merge branch 'jej/fs-prevent-push-when-missing-objects' into 'master'
Prevent git push when LFS objects are missing

Closes #24564

See merge request gitlab-org/gitlab-ce!13837
2017-11-06 16:10:25 +00:00
Tim Zallmann a97cd2906e Fixed Status Warning Icon 2017-11-06 15:59:07 +01:00
James Edwards-Jones df75643334 Replaced subject with subject.exec in spec/lib/gitlab/checks/change_access_spec.rb 2017-11-06 14:33:10 +00:00
James Edwards-Jones a7b7a2253c Prevent git push when LFS objects are missing 2017-11-06 14:33:10 +00:00
Douwe Maan cfd09fe883 Merge branch 'ignore-legacy-routes-in-routing-spec' into 'master'
Ignore routes matching legacy_*_redirect in route specs

See merge request gitlab-org/gitlab-ce!15208
2017-11-06 12:53:54 +00:00
Shinya Maeda 377916ed72 Merge branch 'master' into refactor-clusters 2017-11-06 20:44:38 +09:00
Douwe Maan a2cd9ad251 Merge branch 'jej/fix-lfs-changes-laziness' into 'master'
Implement lazy popen so LfsChanges doesn't have to wait for rev-list to complete

See merge request gitlab-org/gitlab-ce!15180
2017-11-06 11:34:10 +00:00
Sean McGivern cc829e8192 Ignore routes matching legacy_*_redirect in route specs
Routes with the name `legacy_*_redirect` may have wildcards deliberately, in
order to support routing old paths to new paths. As long as these routes are
tested independently, they do not need to fail the path regex spec.
2017-11-06 11:20:23 +00:00
Sean McGivern d4ceec9d47 Merge branch 'ce-gitlab-git-backport' into 'master'
CE repository mirroring changes backport

See merge request gitlab-org/gitlab-ce!15184
2017-11-06 10:39:36 +00:00
James Edwards-Jones ca049902dc Gitlab::Git::RevList and LfsChanges use lazy popen 2017-11-06 10:20:14 +00:00
James Edwards-Jones 95640413e6 Gitlab::Git::Popen can lazily hand output to a block
This allows input to start processing immediately without waiting for the process to complete.
This also allows long or infinite inputs to be partially processed,
which will termiate the process when reading stops with SIGPIPE.
2017-11-06 10:20:13 +00:00
Markus Koller 6902848a9c
Support custom attributes on projects 2017-11-06 10:51:46 +01:00
Shinya Maeda 19a90fe44e Add TimeCop freeze for DST and Regular time 2017-11-05 23:08:39 +09:00
Alejandro Rodríguez dea6d054cd Encapsulate git operations for mirroring in Gitlab::Git 2017-11-03 14:33:24 -03:00
Alejandro Rodríguez 88d2517e36 Add `Gitlab::Git::Repository#fetch` command 2017-11-03 14:33:24 -03:00
micael.bergeron 6c1c64d4bb fix the failing spec 2017-11-03 11:29:06 -04:00
micael.bergeron cd88fa8f80 removed the #ensure_ref_fetched from all controllers
also, I refactored the MergeRequest#fetch_ref method to express
the side-effect that this method has.

  MergeRequest#fetch_ref -> MergeRequest#fetch_ref!
  Repository#fetch_source_branch -> Repository#fetch_source_branch!
2017-11-03 08:13:11 -04:00
Shinya Maeda b6d0c9b231 Fix import_export failure 2017-11-03 20:26:38 +09:00
Shinya Maeda b78d8a748d Fix spec failure. MySQL does not bite true 2017-11-03 19:05:42 +09:00
Shinya Maeda 600d5f4fba Fix tests. Remove NOT NULL constraint from cluster.user. 2017-11-03 17:22:49 +09:00
Shinya Maeda 6ebe6792de Merge branch 'master' into refactor-clusters 2017-11-03 16:41:50 +09:00
Pawel Chojnacki 765ddaeb85 Only enable unicorn metrics when not in sidekiq mode.
+ remove rebased test case
2017-11-02 21:27:28 +01:00
Pawel Chojnacki c9f0070b64 Make subscriber tests pass, after refactoring metrics 2017-11-02 18:18:16 +01:00
Pawel Chojnacki 735365a367 rename BackgroundMigration to SidekiqMigration 2017-11-02 18:18:16 +01:00
Pawel Chojnacki 30a4bb6628 Fix sidekiq middleware tests 2017-11-02 18:16:58 +01:00
Pawel Chojnacki 534f6b1125 Tests for Web transaction and remove simple transacton 2017-11-02 18:11:44 +01:00
Pawel Chojnacki 19634c259d Cleanup metrics names and removing unnecessary cache read total 2017-11-02 18:11:44 +01:00
Pawel Chojnacki c361c1e857 Adjust test to changed metrics methods.
+ remove deprecated test suite
2017-11-02 18:11:44 +01:00
Pawel Chojnacki 95a23d246c Convert rails_queue_duration to metric_rails_queue_duration_seconds 2017-11-02 18:11:44 +01:00
Pawel Chojnacki f64085e693 Move labels tests from Metrics rack spec to Transaction spec 2017-11-02 18:11:44 +01:00
Pawel Chojnacki e884bfc526 Metric spec adjustment for transaction signature change 2017-11-02 18:11:44 +01:00
Pawel Chojnacki 9360f37aae Fix Rubocop warnings 2017-11-02 18:11:44 +01:00
Pawel Chojnacki b90bf88b14 Fix rspec errors, and add more tests to MethodCall and ActionView 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 6b53dd28c7 Cache spec check if prometheus metrics are triggered 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 8dbb228be9 Rails cache spec 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 39ac6acbcc Fix Active record and transaction specs 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 38fbd25bbf Ruby sampler spec 2017-11-02 18:11:43 +01:00
Pawel Chojnacki c97dc61a9e Cleanup transaction metrics 2017-11-02 18:11:43 +01:00
Pawel Chojnacki f464adaaf6 Remove transaction tags and map transaction metrics to prometheus
+ clean transaction metrics

+ Gemfile.lock file update
2017-11-02 18:10:57 +01:00
Pawel Chojnacki 03b38a4a8d Add GC sampler and small refactor of samplers 2017-11-02 18:09:21 +01:00
Rémy Coutable 6a5e8f1046 Merge branch 'gitaly-ff-merge' into 'master'
Incorporate Gitaly's OperationService.UserFFBranch RPC

Closes gitaly#693

See merge request gitlab-org/gitlab-ce!15040
2017-11-02 16:11:53 +00:00
Filipa Lacerda 3852d404f3 Merge branch 'icons-ci-icons' into 'master'
Convert Icons in CI to SVG Sprite Icons

See merge request gitlab-org/gitlab-ce!14567
2017-11-02 15:54:46 +00:00
Sean McGivern 62ab17798d Merge branch 'dm-sidekiq-sigstp' into 'master'
Send SIGSTP before SIGTERM to actually give Sidekiq jobs 30s to finish when the memory killer kicks in

See merge request gitlab-org/gitlab-ce!15102
2017-11-02 15:33:53 +00:00
Sean McGivern 56dccc2e10 Merge branch 'dm-remove-private-token' into 'master'
Remove Private Tokens

Closes #38595 and #38447

See merge request gitlab-org/gitlab-ce!14838
2017-11-02 15:25:42 +00:00
Douwe Maan ccb5bad6b8 Send SIGSTP before SIGTERM to actually give Sidekiq jobs 30s to finish when the memory killer kicks in 2017-11-02 15:33:19 +01:00
Shinya Maeda b129f06733 Fix out of sync with KubernetesService. Remove namespace pramas from controller. Use time_with_zone in schema. Remove Gcp::Clusters from safe_model_attributes.ym 2017-11-02 23:19:11 +09:00
Brett Walker 2fd5cc2bff Geo route whitelisting is too optimistic 2017-11-02 12:50:04 +00:00
Douwe Maan 3f24f9ed18 Add sudo API scope 2017-11-02 11:39:03 +01:00
Douwe Maan a1781a4941 Consistently use PersonalAccessToken instead of PersonalToken 2017-11-02 11:39:02 +01:00