Commit Graph

3452 Commits

Author SHA1 Message Date
Lee Tickett a4e9259d8a #46469 - Added ref querystring parameter to project search to allow searching on branches other than master 2019-05-17 06:10:08 +00:00
Heinrich Lee Yu eb88ca7646 Rename methods that conflict in Rails 5.2
Adds suffix to enum methods and changes `in_groups` to
`of_groups`
2019-05-12 23:42:06 -05:00
Kerri Miller 29f9d92642 Confirm existence of head_pipeline if pipeline success required
Pipelines are created by an async worker, so a rapid sequence of API
calls can trigger a state where the pipeline, whose existence is part of
determining if we wait for the pipeline to successfully complete before
merging, can trigger the MR to be immediately merged instead.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55127
2019-05-07 16:06:53 +00:00
Stan Hu 58c09eb709 Use a path for the related merge requests endpoint
Hosts using a non-standard configuration may have a different
hostname/port/scheme than what may be configured on the GitLab
server. While expose_url should generate a proper URL, there are cases
where it may not work. Since we don't need the full URL, we can use the
relative path.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61280
2019-05-07 06:16:39 -07:00
Sean McGivern 00af4c6d6a Allow replying to an individual note in the API
If you can do this in the UI, you should be able to do it in the API. If
a discussion is not a single note discussion, or it is replyable, you
can reply to it.
2019-05-06 19:48:32 +01:00
Krasimir Angelov 85609c117e Implement support for CI variables of type file
Add env_var and file as supported types for CI variables. Variables of
type file expose to users existing gitlab-runner behaviour - save
variable value into a temp file and set the path to this file in an ENV
var named after the variable key.

Resolves https://gitlab.com/gitlab-org/gitlab-ce/issues/46806.
2019-05-06 13:11:42 +00:00
Nick Thomas 3f30ab5733 Merge branch 'ce-11225-es_limited_namespaces_removal' into 'master'
Backport "Fix namespace/project removal elasticsearch limit" to CE

See merge request gitlab-org/gitlab-ce!27933
2019-05-06 10:33:13 +00:00
Stan Hu f93b2e02a5 Run rubocop -a on CE files 2019-05-05 03:24:28 -07:00
Krasimir Angelov 241ba4be79 Allow guests users to access project releases
This is step one of resolving
https://gitlab.com/gitlab-org/gitlab-ce/issues/56838.

Here is what changed:
- Revert the security fix from bdee9e8412.
- Do not leak repository information (tag name, commit) to guests in API
responses.
- Do not include links to source code in API responses for users that do
not have download_code access.
- Show Releases in sidebar for guests.
- Do not display links to source code under Assets for users that do not
have download_code access.

GET ':id/releases/:tag_name' still do not allow guests to access
releases. This is to prevent guessing tag existence.
2019-05-03 13:29:20 +00:00
Mario de la Ossa 03608aa103
Backport of 328-versioned-es-schema 2019-05-02 22:22:45 -06:00
Stan Hu 0595c6d5cd Whitelist query limits for internal API
When creating a merge request for push options, there may be over 100
queries that are run to create a merge request. Even after we reduce the
number of queries by disabling the Sidekiq jobs, it appears we still
hover near this limit.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/11450
2019-05-03 04:02:15 +00:00
Mayra Cabrera 89132bbdd6 Add gitlab-managed option to clusters form
When this option is enabled, GitLab will create namespaces and service
accounts as usual. When disabled, GitLab wont create any project
specific kubernetes resources

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56557
2019-05-03 01:05:53 +00:00
GitLab Release Tools Bot 076d199d2a Merge branch 'secure-disallow-read-user-scope-to-read-project-events' into 'master'
Disallow read user scope to read project events

See merge request gitlab/gitlabhq!3067
2019-04-29 12:40:33 +00:00
Dmitriy Zaporozhets 77efa66cdf Merge branch 'get-rid-of-user-namespace-method' into 'master'
Get rid of the user_namespace API helper method

See merge request gitlab-org/gitlab-ce!27636
2019-04-25 08:44:38 +00:00
Francisco Javier López dde69bfb2a Added list_pages method to avoid loading all wiki pages content
Inside a wiki, when we show the sidebar or browse to the `pages`,
all page contents are retrieved from Gitaly and that is a waste
of resources, since no content from that pages are going to be
showed.

This MR introduces the method `ProjectWiki#list_pages`,
which uses new wiki_list_pages RPC call to retrieve
pages without content

Also in the `WikisController` we're using the method to show
pages in the sidebar and also on the `pages` page.
2019-04-25 04:19:07 +00:00
Rémy Coutable c563e29fb3
Get rid of the user_namespace API helper method
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-04-24 19:39:59 +02:00
Małgorzata Ksionek 1103c09776 Add new api class for projects events
Refactor api events class to use external helper

Move specs from old class

Add changelog and magic string

Refactor events class to be more explicit

Remove blank line
2019-04-24 17:20:11 +02:00
Lin Jen-Shin a96507bf00 Introduce ServiceResponse to wrap around response
See https://gitlab.com/gitlab-org/gitlab-ce/issues/60730
2019-04-22 17:16:32 +08:00
Douwe Maan 6376f78445 Merge branch '39858-add-group-owned-info-to-projects-api' into 'master'
Return group information on Project endpoint

Closes #39858

See merge request gitlab-org/gitlab-ce!27427
2019-04-19 09:04:25 +00:00
Mayra Cabrera 1dd4a00780 Adds namespace information to project endpoint
- Namespace now return avatar_url and web_url
- NamespaceBasic entity was modified to include avatar_url and web_url,
information is fetched differently depending if the Namespace is a user
or a group

Includes documentation changes

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/39858
2019-04-18 19:00:48 -05:00
zelin-l 52c19d4da7 Add configuration of access_level for runners on registration via API
Allow setting access_level of new runner to not_protected (default) or ref_protected
Minor update to relevant docs and tests
2019-04-18 09:57:12 -04:00
Heinrich Lee Yu e0b6838a90 Set correct timestamps when creating past issues
Sets `system_note_timestamp` from `created_at`
2019-04-16 19:57:49 +08:00
Stan Hu d3fa9c9539 Fix remove_source_branch merge request API handling
Users attempting to set merge requests to `remove_source_branch` to
`false` would encounter an Error 500 because the UpdateService and API
checked `present?`, which would always return `false`. We now just
use `has_key?` to decide whether the parameter is present.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60530
2019-04-15 11:27:33 -07:00
Kamil Trzciński 650f40865e Forbid the use of `#reload` and prefer `#reset`
The `#reload` makes to load all objects into memory,
and the main purpose of `#reload` is to drop the association cache.

The `#reset` seems to solve exactly that case.
2019-04-15 13:05:14 +02:00
Stan Hu ff4cc94413 Merge branch 'patch-31' into 'master'
Add missing provider_unauthorized method to import_github.rb

Closes #60347

See merge request gitlab-org/gitlab-ce!27218
2019-04-11 16:16:20 +00:00
Ben e925dddea7 Return a `401` error code 2019-04-11 06:43:09 +00:00
Ben 0984637faf Fix trailing white space 2019-04-10 21:37:05 +00:00
Ben 6b546551b6 Add missing provider_unauthroized method to import_github.rb 2019-04-10 12:48:53 +00:00
Sean McGivern cd9ae6bb82 Revert "Remove HipChat integration from GitLab"
This reverts commit a5378665a1.
2019-04-10 12:58:18 +01:00
Imre Farkas 9bc5ed14fe Move Contribution Analytics related spec in spec/features/groups/group_page_with_external_authorization_service_spec to EE 2019-04-09 15:38:58 +00:00
Nick Thomas a6218f1bcd Merge branch 'osw-multi-assignees-merge-requests' into 'master'
[Backport] Support multiple assignees for merge requests

See merge request gitlab-org/gitlab-ce!27089
2019-04-09 15:19:36 +00:00
Agustin Henze 20093f9de0 Add new permission model `read-pipeline-variable`
Used to get the variables via the API endpoint
`/projects/:id/pipelines/:pipeline_id/variables`

Signed-off-by: Agustin Henze <tin@redhat.com>
2019-04-09 14:53:44 +00:00
Nick Thomas d95889b8a4 Merge branch '43263-git-push-option-to-create-mr' into 'master'
Git push options to create a merge request, set target_branch and set merge when pipeline succeeds

Closes #53198 and #43263

See merge request gitlab-org/gitlab-ce!26752
2019-04-09 12:53:07 +00:00
Krasimir Angelov 724f19ba0a Add new API endpoint to expose single environment
This is resolving https://gitlab.com/gitlab-org/gitlab-ce/issues/30157.

Implement new API endpoint `/projects/:id/environments/:environment_id`
to expose single environment. Include information for environment's last
deployment if there is one.
2019-04-09 09:16:57 +00:00
Luke Duncalfe 3c40c98e26 Feature flag for merge requestion push options
https://gitlab.com/gitlab-org/gitlab-ce/issues/43263
https://gitlab.com/gitlab-org/gitlab-ce/issues/53198
2019-04-09 10:57:04 +12:00
Luke Duncalfe e73f537cb5 Refactor PushOptionsHandlerService from review
Exceptions are no longer raised, instead all errors encountered are
added to the errors property.

MergeRequests::BuildService is used to generate attributes of a new
merge request.

Code moved from Api::Internal to Api::Helpers::InternalHelpers.
2019-04-09 10:57:01 +12:00
Luke Duncalfe 1883e320ea Use Gitlab::PushOptions for `ci.skip` push option
Previously the raw push option Array was sent to Pipeline::Chain::Skip.

This commit updates this class (and the chain of classes that pass the
push option parameters from the API internal `post_receive` endpoint to
that class) to treat push options as a Hash of options parsed by
GitLab::PushOptions.

The GitLab::PushOptions class takes options like this:

    -o ci.skip -o merge_request.create -o merge_request.target=branch

and turns them into a Hash like this:

    {
      ci: {
        skip: true
      },
      merge_request: {
        create: true,
        target: 'branch'
      }
    }

This now how Pipeline::Chain::Skip is determining if the `ci.skip` push
option was used.
2019-04-09 10:03:26 +12:00
Oswaldo Ferreira ca884980ee [CE] Support multiple assignees for merge requests
Backports https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10161
(code out of ee/ folder).
2019-04-08 18:40:00 -03:00
Luke Duncalfe aa352a95df Support merge request create with push options
To create a new merge request:

  git push -u origin -o merge_request.create

To create a new merge request setting target branch:

  git push -u origin -o merge_request.create \
    -o merge_request.target=123

To update an existing merge request with a new target branch:

  git push -u origin -o merge_request.target=123

A new Gitlab::PushOptions class handles parsing and validating the push
options array. This can be the start of the standard of GitLab accepting
push options that follow namespacing rules. Rules are discussed in issue
https://gitlab.com/gitlab-org/gitlab-ce/issues/43263.

E.g. these push options:

  -o merge_request.create -o merge_request.target=123

Become parsed as:

  {
    merge_request: {
      create: true,
      target: '123',
    }
  }

And are fetched with the class via:

  push_options.get(:merge_request)
  push_options.get(:merge_request, :create)
  push_options.get(:merge_request, :target)

A new MergeRequests::PushOptionsHandlerService takes the `merge_request`
namespaced push options and handles creating and updating
merge requests.

Any errors encountered are passed to the existing `output` Hash in
Api::Internal's `post_receive` endpoint, and passed to gitlab-shell
where they're output to the user.

Issue https://gitlab.com/gitlab-org/gitlab-ce/issues/43263
2019-04-09 09:36:42 +12:00
Sean McGivern 4317a2a3a2 Fix `updated_at` doesn't apply to `state_event` updates of issues via API 2019-04-08 15:33:30 +00:00
Michael Kozono d793d4a7c3 Merge branch 'duplicate-related-mrs' into 'master'
Remove duplicates from issue related merge requests

See merge request gitlab-org/gitlab-ce!27067
2019-04-05 20:07:05 +00:00
Alexandru Croitor c56970e3f7 Remove duplicates from issue related merge requests
Remove duplicates returned by Issues#related_merge_requests API that
relies on ReferencedMergeRequestsService which returns 2 arrays one of
related MRs and one of related MRs that close the issue(i.e. a subset
of first one). We only need related MRs in this case so just pick the
first array.
2019-04-05 22:17:07 +03:00
Gosia Ksionek 64858317ad Add part of needed code
Add columns to store project creation settings

Add project creation level column in groups
 and default project creation column in application settings

Remove obsolete line from schema

Update migration with project_creation_level column existence check

Rename migrations to avoid conflicts

Update migration methods

Update migration method
2019-04-05 18:49:46 +00:00
Andreas Brandl 46b1b9c1d6 Revert "Merge branch 'if-57131-external_auth_to_ce' into 'master'"
This reverts merge request !26823
2019-04-05 13:02:56 +00:00
Imre Farkas d9d7237d2e Move Contribution Analytics related spec in spec/features/groups/group_page_with_external_authorization_service_spec to EE 2019-04-05 11:45:47 +00:00
Paul Slaughter 59ac0924da Fix IDE detecting MR from fork branch
**Why?**
Currently the IDE loads a merge request based on only the
`source_branch` name. This means it loads MR's from
forks that have the same branch name (not good).

- This required updating the BE API to accept `source_project_id`
2019-04-05 07:29:53 +00:00
Douglas Barbosa Alexandre b54228ad3d Merge branch '9217-warn-on-git-fetch-over-ssh-if-the-secondary-is-lagging-the-primary' into 'master'
Display console messages, if available

See merge request gitlab-org/gitlab-ce!26692
2019-04-05 00:19:37 +00:00
Douwe Maan c115ac4fa5 Merge branch '3314-add-on-runner-minutes-for-gitlab-com-ce' into 'master'
Backport some changes from gitlab-ee!9815

Closes #3314

See merge request gitlab-org/gitlab-ce!25908
2019-04-04 09:23:39 +00:00
Alexandru Croitor f4adb50ef2 Expose head pipeline in the related merge requests
Expose head pipeline for the MR in the api when requesting
related merge requests for an issue and show a detailed
status for the pipeline, which would include:
details_path, favicon, group, icon, label, text, tooltip.

https://gitlab.com/gitlab-org/gitlab-ce/issues/57662#note_152023412
2019-04-04 09:01:09 +00:00
Ash McKenzie 6b7a9b7498
Allow console messages be sent to gitlab-shell
Currently a no-op for CE
2019-04-04 14:20:11 +11:00