Commit Graph

3639 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
Ash McKenzie 37cfaf27ab
Extract /internal/allowed API Actor logic out
Created new API::Support::GitAccessActor class to
encapsulate some of the more edge logic, making
the /internal/allowed route much cleaner.
2019-09-05 13:11:29 +10: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
Winnie Hellmann 61515737a5 Add epic_iid to issue API entity
(cherry picked from commit 0bf7fecdee5a200eeb4f27b4888a57ceee63bde9)
2019-09-04 14:44:37 +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
Michael Kozono 5256f01183 Merge branch '66464-typo-in-release_endpoint_requiremets-constant' into 'master'
Resolve "Typo in RELEASE_ENDPOINT_REQUIREMETS constant"

Closes #66464

See merge request gitlab-org/gitlab-ce!32468
2019-09-03 18:37:09 +00:00
Etienne Baqué a43ab8d6a4 Added relationships between Release and Milestone
Modified schema via migrations.
Added one-to-one relationship between the two models.
Added changelog file
2019-09-03 09:38:59 +00:00
Sean Carroll fc9f3894e8 Correct typo in constant 2019-09-02 09:03:07 +02:00
Robert Speicher 7698d40550
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2019-08-29 17:17:37 -05:00
GitLab Release Tools Bot 090956259c Merge branch 'security-enable-image-proxy' into 'master'
Use image proxy to mitigate stealing ip addresses

Closes #2812

See merge request gitlab/gitlabhq!2926
2019-08-29 21:34:29 +00:00
GitLab Release Tools Bot 5a008d1368 Merge branch 'security-epic-notes-api-reveals-historical-info-ce-master' into 'master'
Filter out old system notes for epics in notes api endpoint response

See merge request gitlab/gitlabhq!3224
2019-08-29 21:34:24 +00:00
GitLab Release Tools Bot a5b2a37860 Merge branch 'security-59549-add-capcha-for-failed-logins' into 'master'
Require a captcha after unique failed logins from the same IP

See merge request gitlab/gitlabhq!3270
2019-08-29 21:34:12 +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
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
Victor Zagorodny e4fbd94cf5 Update CE files for GSD projects filter
A new param with_security_reports was added to
GET /groups/:id/projects API and the code to
support this logic in GroupProjectsFinder and
Project model. Also, a DB index was added to
ci_job_artifacts table to speed up the search
of security reports artifacts for projects
2019-08-28 14:26:42 +00:00
Patrick Derichs c9b4dc677a Filter out old system notes for epics 2019-08-28 15:04:23 +02:00
Winnie Hellmann 75353242e2 Replace prepend_entity with prepend_if_ee
(cherry picked from commit 897a9d308db46b620b738b98f2b0e5630ac7d2dd)
2019-08-27 15:11:15 +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
Robert Schilling e2a7dd3f0a Update docs targeting 12.3 2019-08-26 12:48:55 +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
Robert Schilling 2e83665ed3 API: Promote project labels to group labels 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
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 37b17fa61a Add service classes for mutating AwardEmoji
Adding, destroying and toggling emoji previously lacked services and
instead were performed through methods called on Awardable models.

This led to inconsistencies where relevant todos would be marked as done
only when emoji were awarded through our controllers, but not through
the API. Todos could also be marked as done when an emoji was being
removed.

Behaviour changes

- Awarding emoji through the API will now mark a relevant Todo as done
- Toggling an emoji off (destroying it) through our controllers will no
  longer mark a relevant Todo as done

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63372
2019-08-21 11:39:41 +12:00
Stan Hu e632ae8084 Standardize remote_ip and path keys for auth.log and api_json.log
Current `auth.log` uses `fullpath` and `ip`, while `api_json.log` uses
`remote_ip` and `path` for the same fields. Let's standardize these
namings to make it easier for people working with the data.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66167
2019-08-20 18:12:28 +00: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
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
Stan Hu 0495615502 Merge branch 'fix-broken-ee-master-prepend-todos-api' into 'master'
Adds EE prepend, which for some reason was missing

See merge request gitlab-org/gitlab-ce!31851
2019-08-15 14:41:17 +00:00
Alex Kalderimis 922f21e23d Adds EE prepend, which for some reason was missing 2019-08-15 14:16:29 +01:00
Luke Duncalfe d314052711 Remove prepend_if_ee from CE codebase
This was added in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31789
2019-08-15 21:06:01 +12:00
Luke Duncalfe 88746f5311 CE-specific changes to allow design Todos
CE-specific changes for:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15129

Co-Authored-By:    Alex Kalderimis <akalderimis@gitlab.com>
Co-Authored-By:    Luke Duncalfe <lduncalfe@eml.cc>
2019-08-15 15:08:34 +12: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 20ac5e6d4b fix handling of empty ref_name parameter string in commits api
when params[:ref_name] is set to "" by passing an empty query parameter
to the api it is evaluated as false by the || operator.
The use of active support core extensions presence method fixes the original
implemantation.

https://guides.rubyonrails.org/active_support_core_extensions.html#presence
2019-08-10 19:11:20 +02:00
Rémy Coutable 39f9f0bdbb Merge branch 'lib-differences' into 'master'
Resolve EE differences in the lib/ directory

See merge request gitlab-org/gitlab-ce!31582
2019-08-09 14:34:45 +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