Commit Graph

260 Commits

Author SHA1 Message Date
Lin Jen-Shin 9f5ac179d1 Rename ci_config_file to ci_config_path 2017-07-05 20:11:01 +08:00
Lin Jen-Shin 62fdbbeeb0 Merge remote-tracking branch 'upstream/master' into 32815--Add-Custom-CI-Config-Path
* upstream/master: (123 commits)
  Backport changes to Projects::IssuesController and the search bar
  bugfix: use `require_dependency` to bring in DeclarativePolicy
  Resolve "Select branch dropdown is too close to branch name"
  Clean up issuable lists
  Defer project destroys within a namespace in Groups::DestroyService#async_execute
  Fixed new navgiation bar logo height in Safari
  Resolve "Issue dropdown persists when adding issue number to issue description"
  Move verification to block level instead of paragraph
  Revert "Merge branch 'dm-drop-default-scope-on-sortable-finders' into 'master'"
  Added code for defining SHA attributes
  Minor edits
  Job details won't scroll horizontally to show long lines
  Run mysql tests on stable preperation branches like 9-3-stable-patch-2
  Bring back branches badge to main project page
  optimize translation content based on comments
  supplement traditional chinese in taiwan translation
  Inserts exact matches of username, email and name to the top of the user search list
  Remove Namespace model default scope override and write additional test to Project search
  optimize translation content based on comments
  Limit OpenGraph image size to 64x64
  ...
2017-06-30 13:46:51 +08:00
Oswaldo Ferreira 7cb6466b74 Add parent_id back to the tests 2017-06-28 20:01:43 -03:00
Oswaldo Ferreira bd4c2847f4 Rename members_count to members_count_with_descendants and expose only to group admins 2017-06-28 17:27:01 -03:00
Oswaldo Ferreira 7db276897f Adjust projects spec on namespace fields 2017-06-28 15:50:29 -03:00
Lin Jen-Shin 35674fcd47 Merge remote-tracking branch 'upstream/master' into 15041-Add-Custom-CI-Config-Path
* upstream/master: (12506 commits)
  Update CHANGELOG.md for 9.3.2
  Update architecture.md
  Fix changelog entry file extension
  Fix head pipeline stored in merge request for external pipelines
  updated gitlab-ci.yml to compile locale
  Ignore JSON files generated from PO files
  Update mmap2 gem tha disables mmap_obj.gsub! as current implementation uses method that is no longer part of Ruby API
  Disable rainbow during SimpleExecutor specs to have consistence
  Slightly refactor pipeline schedules form in preparation for additions
  Resolve "Submitting reply to existing diff discussion using Cmd/Ctrl+Enter submits twice and refreshes page"
  Make the SimpleExecutor rescue exceptions in the executing Checks
  Resolve "Unable to access edit comment from dropdown menu in certain screen sizes"
  Update changelog item
  revert removal of requestAnimationFrame and move to a separate MR/discussion
  rename getEmojiCategoryMap and remove unnecessary parameter
  Action Buttons on Prio Labels working again by setting pointer events to none on…
  Remove 'contains' option from Commit.find_all
  Remove Gitlab::Git::Repository#find_all
  Use latest chrome and chrome driver in GitLab QA
  Polish sidebar toggle
  ...
2017-06-28 15:53:12 +08:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Robert Speicher a6ec5121f0 Correct RSpec/SingleLineHook cop offenses 2017-06-14 13:18:56 -05:00
vanadium23 4ccd799832 Accept image for avatar in project API 2017-06-09 22:49:57 +03:00
Mark Fletcher ad3e180ed3 Introduce an Events API
* Meld the following disparate endpoints:
 * `/projects/:id/events`
 * `/events`
 * `/users/:id/events`
+ Add result filtering to the above endpoints:
 * action
 * target_type
 * before and after dates
2017-06-06 20:16:41 +08:00
Rémy Coutable 33fad62d8e
Fix Projects API spec
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-06 11:53:06 +02:00
Douwe Maan 70b927a55c Merge branch 'projects-api-import-status' into 'master'
Expose import_status in Projects API

Closes #19646

See merge request !11851
2017-06-02 22:16:54 +00:00
Robin Bobbitt c2516115e3 Expose import_status in Projects API 2017-06-02 15:35:51 -04:00
Athar Hameed 578adc9bc6 Fix missing optional path parameter in "Create project for user" API 2017-06-02 20:58:48 +08:00
vanadium23 0684073d1e Add tag_list param to project api 2017-05-31 09:02:33 +03:00
Yorick Peterse ac382b5682
Use CTEs for nested groups and authorizations
This commit introduces the usage of Common Table Expressions (CTEs) to
efficiently retrieve nested group hierarchies, without having to rely on
the "routes" table (which is an _incredibly_ inefficient way of getting
the data). This requires a patch to ActiveRecord (found in the added
initializer) to work properly as ActiveRecord doesn't support WITH
statements properly out of the box.

Unfortunately MySQL provides no efficient way of getting nested groups.
For example, the old routes setup could easily take 5-10 seconds
depending on the amount of "routes" in a database. Providing vastly
different logic for both MySQL and PostgreSQL will negatively impact the
development process. Because of this the various nested groups related
methods return empty relations when used in combination with MySQL.

For project authorizations the logic is split up into two classes:

* Gitlab::ProjectAuthorizations::WithNestedGroups
* Gitlab::ProjectAuthorizations::WithoutNestedGroups

Both classes get the fresh project authorizations (= as they should be
in the "project_authorizations" table), including nested groups if
PostgreSQL is used. The logic of these two classes is quite different
apart from their public interface. This complicates development a bit,
but unfortunately there is no way around this.

This commit also introduces Gitlab::GroupHierarchy. This class can be
used to get the ancestors and descendants of a base relation, or both by
using a UNION. This in turn is used by methods such as:

* Namespace#ancestors
* Namespace#descendants
* User#all_expanded_groups

Again this class relies on CTEs and thus only works on PostgreSQL. The
Namespace methods will return an empty relation when MySQL is used,
while User#all_expanded_groups will return only the groups a user is a
direct member of.

Performance wise the impact is quite large. For example, on GitLab.com
Namespace#descendants used to take around 580 ms to retrieve data for a
particular user. Using CTEs we are able to reduce this down to roughly 1
millisecond, returning the exact same data.

== On The Fly Refreshing

Refreshing of authorizations on the fly (= when
users.authorized_projects_populated was not set) is removed with this
commit. This simplifies the code, and ensures any queries used for
authorizations are not mutated because they are executed in a Rails
scope (e.g. Project.visible_to_user).

This commit includes a migration to schedule refreshing authorizations
for all users, ensuring all of them have their authorizations in place.
Said migration schedules users in batches of 5000, with 5 minutes
between every batch to smear the load around a bit.

== Spec Changes

This commit also introduces some changes to various specs. For example,
some specs for ProjectTeam assumed that creating a personal project
would _not_ lead to the owner having access, which is incorrect. Because
we also no longer refresh authorizations on the fly for new users some
code had to be added to the "empty_project" factory. This chunk of code
ensures that the owner's permissions are refreshed after creating the
project, something that is normally done in Projects::CreateService.
2017-05-17 16:51:08 +02:00
Rémy Coutable d40e1f547e Enable the Style/TrailingCommaInLiteral cop
Use the EnforcedStyleForMultiline: no_comma option.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-05-10 18:25:45 +02:00
Mark Fletcher 21f5515a5f Expose project statistics on single requests via the API
+ The statistics parameter was already accepted
* This commit ensure that it is respected for GET /projects/:id endpoint
+ Add documentation of the parameter and update the example response for stats
2017-05-03 18:45:19 +08:00
Rémy Coutable 3855751d02
Merge branch 'jacopo-beschi/gitlab-ce-29712-unnecessary-wait-for-ajax'
See merge request !10567

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-24 18:06:47 +02:00
Jacopo ff76adb547 Unnecessary "include WaitForAjax" and "include ApiHelpers"
Removed all the unnecessary include of `WaitForAjax` and `ApiHelpers` in the specs.
Removed unnecessary usage of `api:true`
2017-04-21 22:32:02 +02:00
winniehell 73dff65d8f Add missing newlines 2017-04-20 21:30:34 +02:00
winniehell d5fc0f0830 Add missing newlines 2017-04-20 21:27:34 +02:00
winniehell db9dd06627 Add failing test for #31012 2017-04-19 22:30:47 +02:00
Oswaldo Ferreira fd32960e7c Separate CE params on Grape API 2017-04-10 16:13:48 -03:00
Rémy Coutable 4e3516788f Don't use FFaker in factories, use sequences instead
FFaker can generate data that randomly break our test suite. This
simplifies our factories and use sequences which are more predictive.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-03 18:54:48 +02:00
Robert Speicher def164e761 Fix RSpec/DescribeSymbol cop violations 2017-03-24 19:04:03 -04:00
Rémy Coutable 5f7592d538 Implement `json_response` as a `let` variable
This is not a good idea to memoize `json_response` using an instance
variable because `rspec-retry` doesn't clear instance variables on
retries, only `let` variables.

This will avoid issues where retries would fail on a different line that
the original failure, blurrying what's the real failure.

Also, automatically add api: true to specs under
/spec/requests/(ci/)?api/, and include JsonHelpers in controller, request
and API specs.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-03-13 17:33:17 +01:00
Toon Claes c92808ed32 Fix for creating a project through API when import_url is nil
The API was returning 500 when `nil` is passed for the `import_url`.

In fact, it was `Gitlab::UrlSanitizer.valid?` which was throwing a
`NoMethodError` when `nil` value was passed.
2017-03-10 10:03:03 +01:00
Toon Claes 9e942b5972 Fix all tests
This commit was about 6 commits before squashing, with the main goal to
make all tests green. Now, after pushing this commit we'll see what the
CI has to say about that.
2017-03-06 14:34:07 +01:00
Toon Claes 6357635686 Rename query parameter to `membership`
The query parameter `membership` should be more self-explaining.
2017-03-03 13:42:39 +01:00
Oswaldo Ferreira 06e96907ee Add filter param for authorized projects for current_user for V4 2017-03-03 12:02:41 +01:00
Toon Claes b2c2dfe545 Expose Project's & ProjectSnippet's VisibilityLevel as String
Instead of exposing the VisibilityLevel as Integer, expose it as
String `visibility` for Project and ProjectSnippet.

Filter queries also accept the `visibility` as String instead of
`visibility_level` as Integer.

Also remove the `public` boolean.
2017-03-02 09:33:24 +01:00
James Lopez a0101ebf84 Update occurrences of MWBS to MWPS
Rename column in the database
 Rename fields related to import/export feature
 Rename API endpoints
 Rename documentation links
 Rename the rest of occurrences in the code
 Replace the images that contain the words "build succeeds" and docs referencing to them
 Make sure pipeline is green and nothing is missing.

updated doc images

renamed only_allow_merge_if_build_succeeds in projects and fixed references

more updates

fix some spec failures

fix rubocop offences

fix v3 api spec

fix MR  specs

fixed issues with partials

fix MR spec

fix alignment

add missing v3 to v4 doc

wip - refactor v3 endpoints

fix specs

fix a few typos

fix project specs

copy entities fully to V3

fix  entity error

more fixes

fix failing specs

fixed missing entities in V3 API

remove comment

updated code based on feedback

typo

fix spec
2017-03-01 12:02:02 +01:00
Sean McGivern 0226fb0e1f Merge branch '6073_project_api' into 'master'
API project create: Make name or path required

Closes #6073

See merge request !9416
2017-02-28 16:29:00 +00:00
Robert Schilling 86c58687b2 Return 204 for delete endpoints 2017-02-28 08:32:38 +01:00
Jarka Kadlecova 08ee177d6f API project create: Make name or path required 2017-02-27 07:55:45 +01:00
Oswaldo 2b001d9e7a Return 202 with JSON body on async removals on V4 API 2017-02-23 19:55:13 -03: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 7d4b52b27d Enable Style/WordArray 2017-02-23 09:32:41 -06:00
Douwe Maan 206953a430 Prefer leading style for Style/DotPosition 2017-02-23 09:32:22 -06:00
Mark Fletcher d3425933dd Add housekeeping endpoint for Projects API 2017-02-22 17:40:20 +05:30
Robert Schilling 039c6d60fa API: Moved `DELETE /projects/:id/star` to `POST /projects/:id/unstar` 2017-02-20 15:14:48 +01:00
Robert Schilling c70dfbc686 Add a custom pagination matcher 2017-02-16 15:38:40 +01:00
Dmitriy Zaporozhets efc82ebf3f Merge branch 'master' into 'dz-nested-groups-improvements-3'
# Conflicts:
#   doc/api/projects.md
2017-02-14 19:09:52 +00: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
Toon Claes 4e9e29d295 API: Consolidate /projects endpoint
It consolidates these endpoints:
 - /projects
 - /projects/owned
 - /projects/visible
 - /projects/starred
 - /projects/all

Into the /projects endpoint using query parameters.
2017-02-14 16:41:57 +01:00
Oswaldo Ferreira c2102e6e3b Move /projects/fork/:id to /projects/:id/fork 2017-02-13 16:58:11 -02:00
Toon Claes 7a33aaf0b8 Use VisibilityLevel constants in spec 2017-02-07 14:29:31 +01:00
Toon Claes c6ad83ec29 API: remove `public` param for projects
The create and edit actions for projects had these parameters:

- `public` (optional) - if true same as setting `visibility_level = 20`
- `visibility_level` (optional)

Remove the `public` parameter to avoid contradiction.
2017-02-07 14:29:31 +01:00
Rémy Coutable dcf9af6c12 Merge branch '22007-unify-projects-search' into 'master'
Unify projects search by removing /projects/:search endpoint

Closes #22007

See merge request !8877
2017-02-06 11:28:48 +00:00