Commit Graph

99 Commits

Author SHA1 Message Date
Jacob Vosmaer 008a6a6ce6 Route path lookups through legacy_disk_path 2018-03-21 18:18:32 +01:00
Zeger-Jan van de Weg 7d02292a44
Set Gitlab::Shell#create_repository as OPT_OUT
On .com repositories are created through Gitaly for a while now. For
customers this is not the case unless these have chosen to do so through
feature flags. By moving this to opt out, everyone will be using this.

This move is part of the migration issue
https://gitlab.com/gitlab-org/gitaly/issues/593

The bigger impact this commit will have is that tests that use a
repository through `FactoryBot.create(:project, :repository)` will now
use Gitaly to do so. As tests run on the same disk, or at least machine,
this will most probably slow them down.
2018-03-14 10:59:40 +01:00
Zeger-Jan van de Weg 77f0906e4c
Change Gitlab::Shell#add_namespace to #create_namespace
Prior to this change, this method was called add_namespace, which broke
the CRUD convention and made it harder to grep for what I was looking
for. Given the change was a find and replace kind of fix, this was
changed without opening an issue and on another feature branch.

If more dynamic calls are made to add_namespace, these could've been
missed which might lead to incorrect bahaviour. However, going through
the commit log it seems thats not the case.
2018-03-14 09:56:22 +01:00
Stan Hu e9fad3e501 Make --prune a configurable parameter in fetching a git remote
By default, --prune is added to the command-line of a `git fetch` operation,
but for repositories with many references this can take a long time to run. We
shouldn't need to run --prune the first time we fetch a new repository.
2018-03-06 00:10:04 -08:00
Sean McGivern 2d3867d096 Merge branch 'zj-namespace-gitaly-opt-out' into 'master'
Move Namespace to Gitaly using OPT-OUT

See merge request gitlab-org/gitlab-ce!15910
2018-02-08 10:57:42 +00:00
Douwe Maan ed2c9797e1 Merge branch 'zj-migrate-gitlab-project-rm-mv' into 'master'
Migrate GitlabProject (re)move project endpoints

Closes gitaly#873

See merge request gitlab-org/gitlab-ce!16249
2018-01-10 10:09:57 +00:00
Zeger-Jan van de Weg 58e17bf3b0
Migrate GitlabProject (re)move project endpoints
Migration is done through a small refactoring, which makes us call
endpoins which are performing the same actions for namespaces.
Tests are added to ensure only the project is removed that should be
removed.

Closes gitlab-org/gitaly#873
2018-01-09 19:23:18 +01:00
Douwe Maan 2e4a1b3b78 Merge branch 'jej/backport-authorized-keys-to-ce' into 'master'
Backport authorized_keys

Closes gitlab-ee#3953

See merge request gitlab-org/gitlab-ce!16014
2018-01-09 11:21:23 +00:00
Sean McGivern 01319e5933 Make Gitlab::CurrentSettings available when getting settings 2018-01-08 20:34:37 +00:00
Michael Kozono 797fe0a6e6 Backport authorized_keys_enabled defaults to true'
Originally from branch 'fix-authorized-keys-enabled-default-2738' via merge request https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2240

Removed background migrations which were intended to fix state after using Gitlab
without a default having been set

Squashed commits:
Locally, if Spring was not restarted, `current_application_settings` was still cached, which prevented the migration from editing the file. This will also ensure that any app server somehow hitting old cache data will properly default this setting regardless.
Retroactively fix migration
  This allows us to identify customers who ran the broken migration. Their `authorized_keys_enabled` column does not have a default at this point.
  We will fix the column after we fix the `authorized_keys` file.
Fix authorized_keys file if needed
Add default to authorized_keys_enabled setting
  Reminder: The original migration was fixed retroactively a few commits ago, so people who did not ever run GitLab 9.3.0 already have a column that defaults to true and disallows nulls. I have tested on PostgreSQL and MySQL that it is safe to run this migration regardless.
  Affected customers who did run 9.3.0 are the ones who need this migration to fix the authorized_keys_enabled column.
  The reason for the retroactive fix plus this migration is that it allows us to run a migration in between to fix the authorized_keys file only for those who ran 9.3.0.
Tweaks to address feedback
Extract work into background migration
Move batch-add-logic to background migration
  Do the work synchronously to avoid multiple workers attempting to add batches of keys at the same time.
  Also, make the delete portion wait until after adding is done.
Do read and delete work in background migration
Fix Rubocop offenses
Add changelog entry
Inform the user of actions taken or not taken
Prevent unnecessary `select`s and `remove_key`s
Add logs for action taken
Fix optimization
Reuse `Gitlab::ShellAdapter`
Guarantee the earliest key
Fix migration spec for MySQL
2018-01-08 20:34:20 +00:00
Michael Kozono 255a0f85e3 Backport option to disable writing to `authorized_keys` file
Originally branch 'mk-toggle-writing-to-auth-keys-1631'

See merge request !2004

Squashed commits:
Add authorized_keys_enabled to Application Settings
Ensure default settings are exposed in UI
Without this change, `authorized_keys_enabled` is unchecked when it is nil, even if it should be checked by default.
Add “Speed up SSH operations” documentation
Clarify the reasons for disabling writes
Add "How to go back" section
Tweak copy
Update Application Setting screenshot
2018-01-08 20:34:19 +00:00
Alejandro Rodríguez 15ddfa2b5b Pass timeout to RepositoryService.FetchRemote Gitaly RPC calls 2018-01-05 18:27:00 -03:00
Sean McGivern 737f0ae8fd Merge branch 'ban-disk-import' into 'master'
Don't use Gitlab::Shell#import_repository on local paths

See merge request gitlab-org/gitlab-ce!16228
2018-01-05 14:18:58 +00:00
Sean McGivern d72ba6f484 Merge branch 'gitaly-annotations-20180104' into 'master'
Update some Gitaly annotations in Gitlab::Shell

See merge request gitlab-org/gitlab-ce!16226
2018-01-05 09:48:20 +00:00
Jacob Vosmaer dcebe1494e rubocop 2018-01-04 18:05:49 +01:00
Jacob Vosmaer 44d15e4143 get it working 2018-01-04 16:34:37 +01:00
Jacob Vosmaer b5fe391675 Update some Gitaly annotations in Gitlab::Shell 2018-01-04 15:44:00 +01:00
Alejandro Rodríguez 1c458d17d7 Move delete_remote_branches from Gitlab::Shell to Gitlab::Git::Repository 2018-01-03 23:07:38 -03:00
Alejandro Rodríguez 43308bd826 Move push_remote_branches from Gitlab::Shell to Gitlab::Git::Repository 2018-01-03 23:06:34 -03:00
Nick Thomas 4b785df27b
Import gitlab_projects.rb from gitlab-shell
By importing this Ruby code into gitlab-rails (and gitaly-ruby), we avoid
200ms of startup time for each gitlab_projects subprocess we are eliminating.

By not having a gitlab_projects subprocess between gitlab-rails / sidekiq and
any git subprocesses (e.g. for fork_project, fetch_remote, etc, calls), we can
also manage these git processes more cleanly, and avoid sending SIGKILL to them
2017-12-14 16:00:04 +00:00
Zeger-Jan van de Weg b35110d978
Move Namespace to Gitaly using OPT-OUT 2017-12-13 14:20:20 +01:00
Nick Thomas 327a9898a2
Fix the fork project functionality for projects with hashed storage
Note the dependency on gitlab-shell v5.10.0
2017-12-04 09:42:14 +00:00
Nick Thomas afd5911557
Set the default gitlab-shell timeout to 3 hours 2017-11-21 17:32:37 +00: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
Zeger-Jan van de Weg f879c58706
Fix namespace deletion tests 2017-10-05 15:01:26 +02:00
Zeger-Jan van de Weg 4656283c5c
Gitaly namespace service enabled for GitLab 2017-10-05 14:11:32 +02:00
Jacob Vosmaer e5fecc3a37 Create repositories via Gitaly 2017-09-29 18:27:06 +02:00
Kim "BKC" Carlbäcker b77176d11a Migrate Repository.FetchRemote to Gitaly
- `Gitlab::Shell.fetch_remote` now takes a `Gitlab::Git::Repository` instead
2017-08-30 20:51:56 +02:00
Nick Thomas 5fc871381a Speed up project creation by inlining repository creation 2017-08-15 18:33:07 +01:00
Nick Thomas da5262f4e6 Backport changes in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551 to CE 2017-08-07 19:17:11 +01:00
Jacob Vosmaer a87cca5f9c More Gitaly annotations 2017-07-13 18:05:55 +02:00
Stan Hu d8cc0d0115 Speed up operations performed by gitlab-shell 2017-07-03 18:28:29 +00:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Chris Wilson 0f1273fa44 Add configurable timeout for git fetch and clone operations
GitLab uses the import_project method in GitLab Shell,
This method uses a timeout for the operation, hardcoded to 800 seconds.
With this MR the timeout is now configurable in the gitlab_shell
settings.
2017-04-27 10:51:35 +10:00
Stan Hu 54849afc6c Handle SSH keys that have multiple spaces between each marker
Notice what happens when a user adds a key with a space in between:

```
irb(main):004:0> 'ssh-rsa  foobar'.split(/ /)
=> ["ssh-rsa", "", "foobar"]
```

This would cause gitlab-shell to receive a blank argument for the actual
key, leading to users unable to login.
2017-04-04 23:12:08 -07:00
Robert Speicher d9aca74115 Merge branch 'fix-github-importer-slowness' into 'master'
Improve performance of GitHub importer

Closes #28183

See merge request !10273
2017-04-03 21:26:41 +00:00
Douglas Barbosa Alexandre ff9eb3042f Set the right timeout for Gitlab::Shell#fetch_remote 2017-04-03 16:36:14 -03:00
Douglas Barbosa Alexandre 336ba94a7b Fetch GitHub project as a mirror to get all refs at once 2017-04-03 15:50:22 -03:00
Robin Bobbitt 059e11d87f Fix race condition in namespace directory creation 2017-04-03 09:35:12 -04:00
Sean McGivern 811e598f60 Enable and autocorrect the CustomErrorClass cop 2017-03-01 15:28:10 +00:00
Douwe Maan 1fe7501b49 Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
2017-02-23 09:33:05 -06:00
Douwe Maan 206953a430 Prefer leading style for Style/DotPosition 2017-02-23 09:32:22 -06:00
Douwe Maan 5c7f9d69e3 Fix code for cops 2017-02-23 09:31:57 -06:00
Douwe Maan 7ea641b6d0 Enable Style/ColonMethodCall 2017-02-23 09:31:57 -06:00
Douwe Maan 215228b477 Enable Performance/RedundantBlockCall 2017-02-23 09:31:57 -06:00
Rémy Coutable d8752015b3 Merge branch 'fix/import-hooks' into 'master'
Fix import webhooks performance issue

Closes #27958

See merge request !9197
2017-02-16 15:00:40 +00:00
James Lopez b3fb5b4f26 Use gitlab shell import instead of manually creating the webhooks
Also update repo restorer to use project wiki method.
2017-02-16 10:02:26 +01:00
Dmitriy Zaporozhets 6676b4f0dd
Use Namespace#full_path instead of Namespace#path
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-02-14 18:38:20 +02:00
Rémy Coutable f575fe46a7 Move Gitlab::Shell and Gitlab::ShellAdapter files to lib/
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-27 16:16:55 +01:00