Commit Graph

101 Commits

Author SHA1 Message Date
Zeger-Jan van de Weg 896c0bdbfb
Allow public forks to be deduplicated
When a project is forked, the new repository used to be a deep copy of everything
stored on disk by leveraging `git clone`. This works well, and makes isolation
between repository easy. However, the clone is at the start 100% the same as the
origin repository. And in the case of the objects in the object directory, this
is almost always going to be a lot of duplication.

Object Pools are a way to create a third repository that essentially only exists
for its 'objects' subdirectory. This third repository's object directory will be
set as alternate location for objects. This means that in the case an object is
missing in the local repository, git will look in another location. This other
location is the object pool repository.

When Git performs garbage collection, it's smart enough to check the
alternate location. When objects are duplicated, it will allow git to
throw one copy away. This copy is on the local repository, where to pool
remains as is.

These pools have an origin location, which for now will always be a
repository that itself is not a fork. When the root of a fork network is
forked by a user, the fork still clones the full repository. Async, the
pool repository will be created.

Either one of these processes can be done earlier than the other. To
handle this race condition, the Join ObjectPool operation is
idempotent. Given its idempotent, we can schedule it twice, with the
same effect.

To accommodate the holding of state two migrations have been added.
1. Added a state column to the pool_repositories column. This column is
managed by the state machine, allowing for hooks on transitions.
2. pool_repositories now has a source_project_id. This column in
convenient to have for multiple reasons: it has a unique index allowing
the database to handle race conditions when creating a new record. Also,
it's nice to know who the host is. As that's a short link to the fork
networks root.

Object pools are only available for public project, which use hashed
storage and when forking from the root of the fork network. (That is,
the project being forked from itself isn't a fork)

In this commit message I use both ObjectPool and Pool repositories,
which are alike, but different from each other. ObjectPool refers to
whatever is on the disk stored and managed by Gitaly. PoolRepository is
the record in the database.
2018-12-07 19:18:37 +01:00
Cindy Pallares fe5f75930e
Merge branch 'security-fix-pat-web-access' into 'master'
[master] Resolve "Personal access token with only `read_user` scope can be used to authenticate any web request"

See merge request gitlab/gitlabhq!2583
2018-11-28 19:13:59 -05:00
James Lopez a2aa505805
Refactor code to remove object storage flag from Import/Export
Updated docs, refactor import/export code
Fix AvatarUploader path issue
Fix project export upload webhook error
2018-09-06 16:52:42 +02:00
Winnie Hellmann 743add978a Move badge settings to general settings 2018-09-03 13:16:23 +00:00
Mark Chao a63bce1a4b Resolve "Rename the `Master` role to `Maintainer`" Backend 2018-07-11 14:36:08 +00:00
Lin Jen-Shin 4ee08b77bc Updates from `rubocop -a` 2018-07-09 21:13:08 +08:00
James Lopez a2bf164154
Update Import/Export to use object storage (based on aa feature flag) 2018-07-06 15:46:18 +02:00
Oswaldo Ferreira d038fac4b6 Present state indication on GFM preview 2018-07-05 23:24:11 -03:00
Aram Visser 0d22b2141f Set flash error message only for current request when updating project 2018-06-25 10:19:13 +07:00
Hiroyuki Sato 59154779d8 The json keys of ref switcher should not be translated 2018-06-20 13:02:08 +09:00
Jacob Vosmaer (GitLab) 5cf5680f9c Deny repository disk access in development and test 2018-06-14 11:18:25 +00:00
Robert Speicher 6d165c740c Make all uses of `fixture_file_upload` use relative paths 2018-06-07 09:54:41 -05:00
Nick Thomas 6b0c6e69e1
Use hashed storage in the specs 2018-02-07 13:40:46 +00:00
blackst0ne 27c95364b5 Replace '.team << [user, role]' with 'add_role(user)' in specs 2017-12-22 19:18:28 +11:00
Sean McGivern a39d6d896f Merge branch '32878-merge-request-from-email' into 'master'
Create merge request from email

Closes #32878

See merge request gitlab-org/gitlab-ce!13817
2017-12-05 12:28:49 +00:00
Jan Provaznik 8cce70730c Create merge request from email
* new merge request can be created by sending an email to the specific
email address (similar to creating issues by email)
* for the first iteration, source branch must be specified in the mail
subject, other merge request parameters can not be set yet
* user should enable "Receive notifications about your own activity" in
user settings to receive a notification about created merge request

Part of #32878
2017-12-05 08:41:58 +01:00
Bob Van Landuyt 3d4ba90c50 Count occurrences of a specific query in the query recorder. 2017-12-04 17:43:48 +01:00
Bob Van Landuyt 20f78421c8 Cache the forks in a namespace in the RequestStore
On the `show` of a project that is part of a fork network. We check if
the user already created a fork of this project in their personal
namespace.

We do this in several places, so caching the result of this query in
the request store prevents us from repeating it.
2017-12-04 17:43:48 +01:00
Vitaliy @blackst0ne Klachkov e2b28d2526 Change tags order in refs dropdown 2017-11-07 15:32:51 +11:00
Jacopo 2f40dac352 Refactor `have_http_status` into `have_gitlab_http_status` in the specs 2017-10-20 10:13:18 +02:00
Annabel Dunstone Gray a42d7980af
Add readme only option as project view 2017-10-16 15:33:20 -07:00
Jacopo 0ce6785851 Replaces `tag: true` into `:tag` in the specs
Replaces all the explicit include metadata syntax in the specs (tag:
true) into the implicit one (:tag).
Added a cop to prevent future errors and handle autocorrection.
2017-10-07 13:57:54 +02:00
Bob Van Landuyt e8ca579d88 Add a project forks spec helper
The helper creates a fork of a project with all provided attributes,
but skipping the creation of the repository on disk.
2017-10-07 11:46:23 +02:00
Zeger-Jan van de Weg 4656283c5c
Gitaly namespace service enabled for GitLab 2017-10-05 14:11:32 +02:00
Valery Sizov 3940ac8520 Pulling merge_method spec for project_controller_spec from EE[ci skip] 2017-09-20 12:10:47 +03:00
Rubén Dávila b9b0b37b36 Add check for access to Namespace 2017-08-30 12:24:49 -05:00
Robin Bobbitt 649d042dbc Add option to disable project export on instance 2017-08-11 12:22:37 -04:00
Bob Van Landuyt 3598e60bf2 Add a Circuitbreaker for storage paths 2017-08-04 15:38:48 +02:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Robert Speicher 9513bd18c4 Ensure all project factories use `:repository` trait or `:empty_project` 2017-08-01 14:51:52 -04:00
Grzegorz Bizon b4349fd331 Remove one assertion from projects controller specs 2017-07-14 14:07:32 +02:00
Grzegorz Bizon 881bc45abb Fix rubocop offense in projects controller specs 2017-07-14 11:23:46 +02:00
Grzegorz Bizon 613208c360 Recover from renaming project that has container images 2017-07-13 15:34:36 +02:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Robert Speicher a6ec5121f0 Correct RSpec/SingleLineHook cop offenses 2017-06-14 13:18:56 -05:00
Jose Ivan Vargas acd573f1e6 minor adjustments to the specs 2017-05-22 15:14:13 -05:00
Jose Ivan Vargas fbde5e3313 Renamed some messages and refactored the project_edit class to a function 2017-05-22 12:55:01 -05:00
Jose Ivan Vargas 42604d4c33 Prevent project transfer if a new group is not selected 2017-05-22 12:55:01 -05:00
Michael Kozono f9785dcec3 Fix ensure_canonical_path for top level routes
Don’t replace a substring of the path if it is part of the top level route.

E.g. When redirecting from `/groups/ups` to `/groups/foo`, be careful not to do `/grofoo/ups`.

Projects are unaffected by this issue, but I am grouping the `#ensure_canonical_path` tests similar to the group and user tests.
2017-05-18 16:24:10 -07:00
Michael Kozono ab98f8b5b1 Fix redirect message for groups and users 2017-05-11 15:28:13 -07:00
Michael Kozono f05469f99b Resolve discussions 2017-05-05 12:12:50 -07:00
Michael Kozono e4bcc90d95 Add “project moved” flash message on redirect 2017-05-05 12:12:50 -07:00
Michael Kozono 7d02bcd2e0 Redirect from redirect routes to canonical routes 2017-05-05 12:11:57 -07:00
Jarka Kadlecova 87327c5845 Support preview_markdown action for personal_snippets 2017-04-26 12:51:06 +02:00
Lin Jen-Shin 08d3a40c31 Expect @issuable_meta_data to be set, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9956#note_25445832
2017-03-16 14:46:12 +08:00
Lin Jen-Shin 668a5b9fe1 Fix projects without repo and wiki
When repo and wiki are disabled for a project,
we're showing issues so we'll need to set @issuable_meta_data
otherwise it would be giving nil errors. See:

https://sentry.gitlap.com/gitlab/staginggitlabcom/issues/23106/
2017-03-15 14:42:02 +08:00
Annabel Dunstone Gray 1565d7f6e6 Remove readme-only project view preference 2017-03-06 14:49:59 -06:00
Douwe Maan ad640bc5f9 Use Namespace#full_path instead of #path where appropriate 2017-02-23 17:55:01 -06:00
blackst0ne 63dac85385 Fixed redirection from http://someproject.git to http://someproject 2017-02-04 00:00:26 +11:00
Robert Speicher 4642ca6686 Use `empty_project` where possible in controller specs 2017-01-25 17:14:38 -05:00