Commit Graph

2965 Commits

Author SHA1 Message Date
Krasimir Angelov 477ba2b346 Add skeleton Pages internal API
Basic `/internal/pages` endpoint that will be used for Pages virtual
domains internal API. The endpoint is currently behind feature flag and
provides authetication similar to how Workhorse is authenticating with
the GitLab.
2019-09-06 16:06:25 +12:00
Brett Walker ec2b4bb65d Upgrade graphql gem to 1.9.10
- `edge_nodes` needs to get called on the object
- added `include GlobalID::Identification` in a couple places
- renamed `object` to `item` in spec due to conflict
2019-09-04 21:57:37 +00:00
Brett Walker aa7b1cfc5b Upgrade GraphQL gem to 1.8.17
- Due to https://github.com/exAspArk/batch-loader/pull/32,
we  changed BatchLoader.for into BatchLoader::GraphQL.for
- since our results are wrapped in a BatchLoader::GraphQL,
calling `sync` during authorization is required to get real object
- `graphql` now has it's own authorization system.  Our
`authorized?` method conflicted and required renaming
2019-09-04 17:42:48 +00:00
Felipe Artur 13fc0efa57 Let project reporters create issue from group boards
The current state of group issue boards does not show the "Add issues"
button on the UI for users that are reporters of group child projects.
2019-09-04 16:33:02 +00:00
Krasimir Angelov c4b804c6db Rename API::Internal class to API::Internal::Base
so that we can use API::Internal namespace.

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/61927.
2019-09-04 10:07:49 +12:00
Grzegorz Bizon 1068ec2e92 Merge branch '66741-remove-spec-rails_helper-rb' into 'master'
Remove spec/rails_helper.rb

Closes #66741

See merge request gitlab-org/gitlab-ce!32380
2019-09-03 13:48:17 +00:00
Igor 8dcddb9886 Stub DetectRepositoryLanguagesWorker for all tests
It performs an expensive operation, but isn't required in
most of tests
2019-09-03 06:19:21 +00:00
Ash McKenzie 19ff9d9899
Replace rails_helper.rb with spec_helper.rb
rails_helper.rb's only logic was to require
spec_helper.rb.
2019-08-30 12:26:18 +10:00
Robert Speicher 7698d40550
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2019-08-29 17:17:37 -05:00
Rémy Coutable 1843502ff4 Merge branch 'sh-fix-snippet-visibility-api' into 'master'
Fix snippets API not working with visibility level

Closes #66050

See merge request gitlab-org/gitlab-ce!32286
2019-08-29 13:57:26 +00:00
Kamil Trzciński 955e23d956 Merge branch 'sh-support-content-for-snippets-api' into 'master'
Standardize use of `content` parameter in snippets API

Closes #66673

See merge request gitlab-org/gitlab-ce!32296
2019-08-29 11:33:48 +00:00
Stan Hu fc52421b55 Standardize use of `content` parameter in snippets API
There was some confusion over whether `code` or `content` is the right
parameter for snippets. Internally, the database stores
`content`. However:

1. Project snippets use `code`. `code` gets remapped in `content` in
`lib/api/project_snippets.rb`.

2. Personal snippets use `content`.

To unify these APIs, allow an alias of `content` to work for project
snippets.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66673
2019-08-28 22:54:07 -07:00
Stan Hu 680f437715 Fix snippets API not working with visibility level
When a restricted visibility level of `private` is set in the instance,
creating a snippet with the `visibility` level would always fail.
This happened because:

1. `params[:visibility]` was a string (e.g. "public")
2. `CreateSnippetService` and `UpdateSnippetService` only looked
   at `params[:visibility_level]`, which was `nil`.

To fix this, we:

1. Make `CreateSnippetService` look at the newly-built
   `snippet.visibility_level`, since the right value is assigned by the
   `VisibilityLevel#visibility=` method.
2. Modify `UpdateSnippetService` to handle both `visibility_level` and
`visibility` parameters.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66050
2019-08-28 22:49:58 -07:00
Michael Kozono 50342028aa
Simplify internal post receive messages
Instead of sending varied data to Gitaly, and making Gitaly construct
various messages, build the messages first and have Gitaly print
either basic messages or alert messages, in the order they come.

Depends on https://gitlab.com/gitlab-org/gitaly/merge_requests/1410
2019-08-28 15:18:58 -07:00
Jacob Vosmaer 85d88d67cc Support Gitaly feature flags in workhorse 2019-08-28 16:51:17 +00:00
Sean McGivern a390f5ff05 Merge branch '57657-promote-label-to-group-label-via-api-endpoint' into 'master'
Promote Label to Group Label via API endpoint

Closes #57657

See merge request gitlab-org/gitlab-ce!25218
2019-08-27 08:53:09 +00:00
Mayra Cabrera bbd39021c3 Merge branch 'sh-fix-nplusone-issues' into 'master'
Fix N+1 Gitaly calls in /api/v4/projects/:id/issues

See merge request gitlab-org/gitlab-ce!32171
2019-08-26 17:51:59 +00:00
Brett Walker bdd5b5b695 Replace echo function with a resolver
The `GraphQL::Function` has been deprecated in
favor of resolvers.
2019-08-26 17:43:38 +00:00
Robert Schilling 1819dbd4d1 Incorporate review feedback 2019-08-26 15:02:12 +02:00
Robert Schilling 0ec6134ff9 Make tests pass 2019-08-26 12:49:03 +02:00
Robert Schilling efafc98bd8 Move promote to put and add more specs 2019-08-26 10:45:37 +02:00
Robert Schilling 41412f7360 Add docs and first specs 2019-08-26 10:45:37 +02:00
Brett Walker ad05e48863 Add support for using a Camo proxy server
User images and videos will get proxied through
the Camo server in order to keep malicious
sites from collecting the IP address of users.
2019-08-23 23:44:53 -05:00
Stan Hu 440635015f Fix N+1 Gitaly calls in /api/v4/projects/:id/issues
This is a follow-up from
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31938.

In GitLab 9.0,
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9661 removed the
`subscribed` flag from the API when the user requested a list of issues
or merge requests since calculating this value triggers extensive
Markdown processing.

In GitLab 12.0 via a4fbf39e, we accidentally reintroduced this
performance regression by changing `IssueBasic` to `Issue` in
`entities.rb`. This showed up as a Gitaly N+1 issue since the Markdown
processing would attempt to extract a commit if it detected a regex that
matched a commit.

We restore the prior behavior by once again removing the `subscribed`
flag for the bulk list of issues and merge requests and add a test to
ensure they aren't reintroduced.

Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/66202
2019-08-23 21:26:50 -07:00
Marius Bobin 811252536d Read pipelines from public projects though API
Allow users to read pipelines for public projects
with public builds enabled without providing an access token.
2019-08-23 20:54:32 +00:00
Patrick Derichs f1e24d4d31 Add label_id parameter to label API for PUT and DELETE
Add specs for new parameter and updated documentation as well.
2019-08-23 17:45:42 +00:00
Kamil Trzciński 99e8b77e5e Merge branch 'sh-eliminate-gitaly-nplus-one-notes' into 'master'
Eliminate Gitaly N+1 queries with notes API

See merge request gitlab-org/gitlab-ce!32089
2019-08-23 17:21:19 +00:00
Alexandru Croitor f5b855546e Update sort options for issues list
Increase sort options for issues list from updated_at and create_at,
to include more options close to what is required in actual issue list
UI.

This helps us to use REST API for issues list with sorting capabilities

https://gitlab.com/gitlab-org/gitlab-ce/issues/57402
2019-08-23 11:32:15 +03:00
Stan Hu e24b9c2502 Eliminate Gitaly N+1 queries with notes API
Similar to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31834,
we see that in https://gitlab.com/gitlab-org/gitlab-ce/issues/65957
there can be hundreds, even thousands, of Gitaly requests in the
`/api/:version/projects/:id/merge_requests/:noteable_id/notes` endpoint.

Previously, the API to retrieve notes generated hundreds of Gitaly calls
to determine whether a system note should be shown to the user. It did
this by:

1. Rendering the Markdown
2. Extracting cross-references from the Markdown
3. Issuing a Gitaly `FindCommit` RPC for every reference to validate
that the commit exists.

The last step is unnecessary because we don't need to display a commit
if the user doesn't have access to the project in the first place.
`RendersNotes#prepare_notes_for_rendering` is already used in
`MergeRequestsController`, which is why we don't see N+1 Gitaly calls
there. We use it here to optimize the note redaction process.
2019-08-22 22:28:47 -07:00
Alessio Caiazza 606a1d2d31 Expose namespace storage statistics with GraphQL
Root namespaces have storage statistics.
This commit allows namespace owners to get those stats via GraphQL
queries like the following one

{
  namespace(fullPath: "a_namespace_path") {
    rootStorageStatistics {
      storageSize
      repositorySize
      lfsObjectsSize
      buildArtifactsSize
      packagesSize
      wikiSize
    }
  }
}
2019-08-22 22:08:28 +00:00
Kushal Pandya 7b5708d1d9 Merge branch 'ee-2502-refactor-ee-app-assets-javascripts-approvals-components-approvers_select-vue-to-remove-approverusers' into 'master'
Add a new method to `Api.js`: `projectUsers`

See merge request gitlab-org/gitlab-ce!31801
2019-08-22 07:59:22 +00:00
Luke Duncalfe 926bf71e51 Improve specs for Issues and Notes controllers
This adds test that Todos are completed.

https://gitlab.com/gitlab-org/gitlab-ce/issues/63372
2019-08-21 11:39:41 +12:00
Luke Duncalfe 15b02da69f Use AwardEmojis services in GraphQL mutations
https://gitlab.com/gitlab-org/gitlab-ce/issues/63372
2019-08-21 11:39:41 +12:00
Nick Thomas f7f91e84f7 Add a skip_users filter to the project users API
This functionality is available in the /autocomplete users pseudo-API.
We're attempting to replace that with the canonical API, so it needs
support for this parameter too.
2019-08-19 14:21:56 +05:30
Stan Hu ba7c501fef Fix Gitaly N+1 calls with listing issues/MRs via API
In GitLab 9.0,
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9661 removed the
`subscribed` flag from the API when the user requested a list of issues
or merge requests since calculating this value triggers extensive
Markdown processing.

In GitLab 12.0 via a4fbf39e, we accidentally reintroduced this
performance regression by changing `IssueBasic` to `Issue` in
`entities.rb`. This showed up as a Gitaly N+1 issue since the Markdown
processing would attempt to extract a commit if it detected a regex that
matched a commit.

We restore the prior behavior by once again removing the `subscribed`
flag for the bulk list of issues and merge requests and add a test to
ensure they aren't reintroduced.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66202
2019-08-17 20:35:37 -07:00
Nick Thomas 94c7a93dca Merge branch 'fix/commits-api-empty-refname' into 'master'
fix handling of empty ref_name parameter string in commits api

Closes #64745

See merge request gitlab-org/gitlab-ce!31687
2019-08-16 14:46:22 +00:00
Stan Hu b288f128fe Fix failing N+1 spec in spec/requests/api/discussions_spec.rb
This test was failing in EE because the API helper `get()` creates a
personal access token each time it's run. We can avoid that by
pre-creating a personal access token and passing it each time.
2019-08-15 11:54:42 -07:00
Douglas Barbosa Alexandre 8c8824d442 Merge branch 'sh-fix-discussions-api-perf' into 'master'
Eliminate many Gitaly calls in discussions API

Closes #65957

See merge request gitlab-org/gitlab-ce!31834
2019-08-15 16:10:14 +00:00
Stan Hu 8044440d7a Eliminate many Gitaly calls in discussions API
Previously, the API to retrieve discussions from merge requests often
generated hundreds of Gitaly calls to determine whether a system note
should be shown to the user. It did this by:

1. Rendering the Markdown
2. Extracting cross-references from the Markdown
3. For cross-references that were commits, a Gitaly FindCommit RPC
   would be issued to validate that the commit exists.

The last step is unnecessary because we don't need to display a commit
if the user doesn't have access to the project in the first place.

`RendersNotes#prepare_notes_for_rendering` is already used in
`MergeRequestsController`, which is why we don't see N+1 Gitaly calls
there. We use it here to optimize the note redaction process.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65957
2019-08-15 08:02:30 -07:00
Jeremy Jackson 5d9d5e6031 Migrates Snowplow backend from EE to CE
This introduces several changes, but these are all just ported from the
EE project.
2019-08-14 19:21:58 +00:00
Armin Hohenegger eb35728201 remove encoding comment created by emacs ruby-mode 2019-08-13 23:36:22 +02:00
Armin Hohenegger e70cfdebc7 add a test for empty ref_name to api commits spec 2019-08-13 23:00:14 +02:00
Winnie Hellmann 915bc89396 Revert "Merge branch '4221-board-milestone-should-persist-any-none-properly-ce' into 'master'"
This reverts merge request !30613
2019-08-09 09:59:38 +00:00
James Lopez bbf639c43d Merge branch '39217-remove-kubernetes-service-integration' into 'master'
Remove KubernetesService integration

See merge request gitlab-org/gitlab-ce!31365
2019-08-09 07:10:26 +00:00
Rémy Coutable 44065b0138 Merge branch 'speed-up-labels-api' into 'master'
Remove label issue and MR counts from default API responses

See merge request gitlab-org/gitlab-ce!31543
2019-08-09 06:25:29 +00:00
Hordur Freyr Yngvason 5f82ff1469 Bring scoped environment variables to core
As decided in https://gitlab.com/gitlab-org/gitlab-ce/issues/53593
2019-08-08 18:51:52 +00:00
Sean McGivern e6dc5168b8 Remove label issue and MR counts from default API responses
These counts significantly increase the load time for these
requests. Users can now opt in to receiving the counts by setting
`with_counts=true` in requests. This is a breaking change, but hopefully
a fairly minor one.
2019-08-08 17:10:41 +01:00
Tiger e3696bf20e Final removal of KubernetesService
Creating new records has been disabled, and all
existing records been migrated to clusters as of
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28534
2019-08-08 09:47:07 +10:00
Camil Staps 73e6ba448d
Address reviewer comments 2019-08-07 20:49:17 +02:00
Camil Staps c1126d2b10
Fix test style 2019-08-07 20:49:17 +02:00