Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-06-29 21:09:07 +00:00
parent aa99514d5c
commit 777f6da99a
148 changed files with 929 additions and 425 deletions

View file

@ -119,6 +119,7 @@
.db-patterns: &db-patterns
- "{,ee/}{db}/**/*"
- "{,ee}/spec/{db,migrations}/**/*"
.backstage-patterns: &backstage-patterns
- "Dangerfile"

View file

@ -308,6 +308,18 @@ Gitlab/Union:
- 'spec/**/*'
- 'ee/spec/**/*'
API/GrapeAPIInstance:
Enabled: true
Include:
- 'lib/**/api/**/*.rb'
- 'ee/**/api/**/*.rb'
API/GrapeArrayMissingCoerce:
Enabled: true
Include:
- 'lib/**/api/**/*.rb'
- 'ee/**/api/**/*.rb'
Cop/SidekiqOptionsQueue:
Enabled: true
Exclude:

View file

@ -19,7 +19,7 @@ gem 'default_value_for', '~> 3.3.0'
gem 'pg', '~> 1.1'
gem 'rugged', '~> 0.28'
gem 'grape-path-helpers', '~> 1.2'
gem 'grape-path-helpers', '~> 1.3'
gem 'faraday', '~> 0.12'
gem 'marginalia', '~> 1.8.0'
@ -81,7 +81,7 @@ gem 'gitlab_omniauth-ldap', '~> 2.1.1', require: 'omniauth-ldap'
gem 'net-ldap'
# API
gem 'grape', '~> 1.1.0'
gem 'grape', '~> 1.3.3'
gem 'grape-entity', '~> 0.7.1'
gem 'rack-cors', '~> 1.0.6', require: 'rack/cors'

View file

@ -103,10 +103,6 @@ GEM
aws-sdk-core (= 2.11.374)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
babosa (1.0.2)
base32 (0.3.2)
batch-loader (1.4.0)
@ -164,8 +160,6 @@ GEM
nap
open4 (~> 1.3)
coderay (1.1.2)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
colored2 (3.1.2)
commonmarker (0.20.1)
ruby-enum (~> 0.5)
@ -221,8 +215,6 @@ GEM
ruby-statistics (>= 2.1)
thor (>= 0.19, < 2)
unicode_plot (>= 0.0.4, < 1.0.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
device_detector (1.0.0)
devise (4.7.1)
bcrypt (~> 3.0)
@ -249,6 +241,28 @@ GEM
doorkeeper-openid_connect (1.6.3)
doorkeeper (>= 5.0, < 5.2)
json-jwt (~> 1.6)
dry-configurable (0.11.5)
concurrent-ruby (~> 1.0)
dry-core (~> 0.4, >= 0.4.7)
dry-equalizer (~> 0.2)
dry-container (0.7.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.4.9)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
dry-logic (1.0.6)
concurrent-ruby (~> 1.0)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-types (1.4.0)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.4, >= 0.4.4)
dry-equalizer (~> 0.3)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
ed25519 (1.2.4)
elasticsearch (6.8.0)
elasticsearch-api (= 6.8.0)
@ -439,19 +453,19 @@ GEM
signet (~> 0.14)
gpgme (2.0.20)
mini_portile2 (~> 2.3)
grape (1.1.0)
grape (1.3.3)
activesupport
builder
dry-types (>= 1.1)
mustermann-grape (~> 1.0.0)
rack (>= 1.3.0)
rack-accept
virtus (>= 1.0.0)
grape-entity (0.7.1)
activesupport (>= 4.0)
multi_json (>= 1.3.2)
grape-path-helpers (1.2.0)
grape-path-helpers (1.3.0)
activesupport
grape (~> 1.0)
grape (~> 1.3)
rake (~> 12)
grape_logging (1.8.3)
grape
@ -642,9 +656,10 @@ GEM
multi_xml (0.6.0)
multipart-post (2.1.1)
murmurhash3 (0.1.6)
mustermann (1.0.3)
mustermann-grape (1.0.0)
mustermann (~> 1.0.0)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
mustermann-grape (1.0.1)
mustermann (>= 1.0.0)
nakayoshi_fork (0.0.4)
nap (1.1.0)
nenv (0.3.0)
@ -959,6 +974,7 @@ GEM
ruby-saml (1.7.2)
nokogiri (>= 1.5.10)
ruby-statistics (2.1.2)
ruby2_keywords (0.0.2)
ruby_dep (1.5.0)
ruby_parser (3.13.1)
sexp_processor (~> 4.9)
@ -1122,11 +1138,6 @@ GEM
activerecord (>= 3.0)
activesupport (>= 3.0)
version_sorter (2.2.4)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
vmstat (2.3.0)
warden (1.2.8)
rack (>= 2.0.6)
@ -1257,9 +1268,9 @@ DEPENDENCIES
google-api-client (~> 0.33)
google-protobuf (~> 3.8.0)
gpgme (~> 2.0.19)
grape (~> 1.1.0)
grape (~> 1.3.3)
grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.2)
grape-path-helpers (~> 1.3)
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.10.5)

View file

@ -411,7 +411,6 @@ img.emoji {
.append-right-15 { margin-right: 15px; }
.append-right-default { margin-right: $gl-padding; }
.append-right-20 { margin-right: 20px; }
.append-right-48 { margin-right: 48px; }
.append-bottom-5 { margin-bottom: 5px; }
.append-bottom-10 { margin-bottom: 10px; }
.append-bottom-15 { margin-bottom: 15px; }

View file

@ -57,22 +57,11 @@ class Projects::RefsController < Projects::ApplicationController
render json: logs
end
# Deprecated due to https://gitlab.com/gitlab-org/gitlab/-/issues/36863
# Will be removed soon https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29895
format.js do
@logs, _ = tree_summary.summarize
@more_log_url = more_url(tree_summary.next_offset) if tree_summary.more?
end
end
end
private
def more_url(offset)
logs_file_project_ref_path(@project, @ref, @path, offset: offset)
end
def validate_ref_id
return not_found! if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex
end

View file

@ -21,12 +21,17 @@ module Mutations
argument :jira_project_name, GraphQL::STRING_TYPE,
required: false,
description: 'Project name of the importer Jira project'
argument :users_mapping,
[Types::JiraUsersMappingInputType],
required: false,
description: 'The mapping of Jira to GitLab users'
def resolve(project_path:, jira_project_key:)
def resolve(project_path:, jira_project_key:, users_mapping:)
project = authorized_find!(full_path: project_path)
mapping = users_mapping.to_ary.map { |map| map.to_hash }
service_response = ::JiraImport::StartImportService
.new(context[:current_user], project, jira_project_key)
.new(context[:current_user], project, jira_project_key, mapping)
.execute
jira_import = service_response.success? ? service_response.payload[:import_data] : nil

View file

@ -0,0 +1,18 @@
# frozen_string_literal: true
module Types
# rubocop: disable Graphql/AuthorizeTypes
class JiraUsersMappingInputType < BaseInputObject
graphql_name 'JiraUsersMappingInputType'
argument :jira_account_id,
GraphQL::STRING_TYPE,
required: true,
description: 'Jira account id of the user'
argument :gitlab_id,
GraphQL::INT_TYPE,
required: false,
description: 'Id of the GitLab user'
end
# rubocop: enable Graphql/AuthorizeTypes
end

View file

@ -2,23 +2,39 @@
module JiraImport
class StartImportService
attr_reader :user, :project, :jira_project_key
attr_reader :user, :project, :jira_project_key, :users_mapping
def initialize(user, project, jira_project_key)
def initialize(user, project, jira_project_key, users_mapping)
@user = user
@project = project
@jira_project_key = jira_project_key
@users_mapping = users_mapping
end
def execute
validation_response = validate
return validation_response if validation_response&.error?
store_users_mapping
create_and_schedule_import
end
private
def store_users_mapping
return if users_mapping.blank?
mapping = users_mapping.map do |map|
next if !map[:jira_account_id] || !map[:gitlab_id]
[map[:jira_account_id], map[:gitlab_id]]
end.compact.to_h
return if mapping.blank?
Gitlab::JiraImport.cache_users_mapping(project.id, mapping)
end
def create_and_schedule_import
jira_import = build_jira_import
project.import_type = 'jira'

View file

@ -1,23 +0,0 @@
- @logs.each do |content_data|
- file_name = content_data[:file_name]
- commit = content_data[:commit]
- next unless commit
:plain
var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}");
row.find("td.tree-time-ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}');
row.find("td.tree-commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}');
= render_if_exists 'projects/refs/logs_tree_lock_label', lock_label: content_data[:lock_label]
- if @more_log_url
:plain
if($('#tree-slider').length) {
// Load more commit logs for each file in tree
// if we still on the same page
var url = "#{escape_javascript(@more_log_url)}";
gl.utils.ajaxGet(url);
}
:plain
gl.utils.localTimeAgo($('.js-timeago', 'table.table_#{@hex_path} tbody'));

View file

@ -1,3 +0,0 @@
- full_title = markdown_field(commit, :full_title)
%span.str-truncated
= link_to_html full_title, project_commit_path(@project, commit.id), title: full_title, class: 'tree-commit-link'

View file

@ -0,0 +1,5 @@
---
title: Add Jira users mapping to start Jira import mutation
merge_request: 34609
author:
type: added

View file

@ -0,0 +1,5 @@
---
title: Upgrade Grape v1.1.0 to v1.3.3
merge_request: 33450
author:
type: other

View file

@ -26,7 +26,7 @@ GitLab, thanks to [Lograge](https://github.com/roidrage/lograge/). Note that
requests from the API are logged to a separate file in `api_json.log`.
Each line contains a JSON line that can be ingested by services like Elasticsearch and Splunk.
Line breaks have been added to this example for legibility:
Line breaks were added to examples for legibility:
```json
{
@ -79,7 +79,7 @@ seconds:
User clone and fetch activity using HTTP transport appears in this log as `action: git_upload_pack`.
In addition, the log contains the originating IP address,
(`remote_ip`),the user's ID (`user_id`), and username (`username`).
(`remote_ip`), the user's ID (`user_id`), and username (`username`).
Some endpoints such as `/search` may make requests to Elasticsearch if using
[Advanced Global Search](../user/search/advanced_global_search.md). These will
@ -227,7 +227,7 @@ It helps you see requests made directly to the API. For example:
}
```
This entry shows an access to an internal endpoint to check whether an
This entry shows an internal endpoint accessed to check whether an
associated SSH key can download the project in question via a `git fetch` or
`git clone`. In this example, we see:
@ -320,7 +320,7 @@ packages or in `/home/git/gitlab/log/kubernetes.log` for
installations from source.
It logs information related to the Kubernetes Integration including errors
during installing cluster applications on your GitLab managed Kubernetes
during installing cluster applications on your managed Kubernetes
clusters.
Each line contains a JSON line that can be ingested by services like Elasticsearch and Splunk.
@ -362,7 +362,7 @@ After 12.2, this file was renamed from `githost.log` to
`git_json.log` and stored in JSON format.
GitLab has to interact with Git repositories, but in some rare cases
something can go wrong, and in this case you will know what exactly
something can go wrong, and in this case you may need know what exactly
happened. This log file contains all failed requests from GitLab to Git
repositories. In the majority of cases this file will be useful for developers
only. For example:
@ -473,8 +473,8 @@ This file lives in `/var/log/gitlab/gitlab-rails/sidekiq_client.log` for
Omnibus GitLab packages or in `/home/git/gitlab/log/sidekiq_client.log` for
installations from source.
This file contains logging information about jobs before they are start
being processed by Sidekiq, for example before being enqueued.
This file contains logging information about jobs before Sidekiq starts
processing them, such as before being enqueued.
This log file follows the same structure as
[`sidekiq.log`](#sidekiqlog), so it will be structured as JSON if
@ -571,32 +571,45 @@ User clone/fetch activity using SSH transport appears in this log as `executing
## Gitaly Logs
This file lives in `/var/log/gitlab/gitaly/current` and is produced by [runit](http://smarden.org/runit/). `runit` is packaged with Omnibus and a brief explanation of its purpose is available [in the omnibus documentation](https://docs.gitlab.com/omnibus/architecture/#runit). [Log files are rotated](http://smarden.org/runit/svlogd.8.html), renamed in Unix timestamp format and `gzip`-compressed (e.g. `@1584057562.s`).
This file lives in `/var/log/gitlab/gitaly/current` and is produced by [runit](http://smarden.org/runit/). `runit` is packaged with Omnibus GitLab and a brief explanation of its purpose is available [in the Omnibus GitLab documentation](https://docs.gitlab.com/omnibus/architecture/#runit). [Log files are rotated](http://smarden.org/runit/svlogd.8.html), renamed in Unix timestamp format, and `gzip`-compressed (like `@1584057562.s`).
### `grpc.log`
This file lives in `/var/log/gitlab/gitlab-rails/grpc.log` for Omnibus GitLab packages. Native [gRPC](https://grpc.io/) logging used by Gitaly.
## `puma_stderr.log` & `puma_stdout.log`
## Puma Logs
This file lives in `/var/log/gitlab/puma/puma_stderr.log` and `/var/log/gitlab/puma/puma_stdout.log` for
Omnibus GitLab packages or in `/home/git/gitlab/log/puma_stderr.log` and `/home/git/gitlab/log/puma_stdout.log`
for installations from source.
### `puma_stdout.log`
## `unicorn_stderr.log` & `unicorn_stdout.log`
This file lives in `/var/log/gitlab/puma/puma_stdout.log` for
Omnibus GitLab packages, and `/home/git/gitlab/log/puma_stdout.log` for
installations from source.
### `puma_stderr.log`
This file lives in `/var/log/gitlab/puma/puma_stderr.log` for
Omnibus GitLab packages, or in `/home/git/gitlab/log/puma_stderr.log` for
installations from source.
## Unicorn Logs
NOTE: **Note:**
Starting with GitLab 13.0, Puma is the default web server used in GitLab
all-in-one package based installations as well as GitLab Helm chart deployments.
This file lives in `/var/log/gitlab/unicorn/unicorn_stderr.log` and `/var/log/gitlab/unicorn/unicorn_stdout.log` for
Omnibus GitLab packages or in `/home/git/gitlab/log/unicorn_stderr.log` and `/home/git/gitlab/log/unicorn_stdout.log`
### `unicorn_stdout.log`
This file lives in `/var/log/gitlab/unicorn/unicorn_stdout.log` for
Omnibus GitLab packages or in `/home/git/gitlab/log/unicorn_stdout.log` for
for installations from source.
Unicorn is a high-performance forking Web server which is used for
serving the GitLab application. You can look at this log if, for
example, your application does not respond. This log contains all
information about the state of Unicorn processes at any given time.
### `unicorn_stderr.log`
This file lives in `/var/log/gitlab/unicorn/unicorn_stderr.log` for
Omnibus GitLab packages or in `/home/git/gitlab/log/unicorn_stderr.log` for
for installations from source.
These logs contain all information about the state of Unicorn processes at any given time.
```plaintext
I, [2015-02-13T06:14:46.680381 #9047] INFO -- : Refreshing Gem list
@ -657,7 +670,7 @@ This log records:
- [Protected paths](../user/admin_area/settings/protected_paths.md) abusive requests.
NOTE: **Note:**
From [%12.3](https://gitlab.com/gitlab-org/gitlab/-/issues/29239), user ID and username are also
In GitLab versions [12.3](https://gitlab.com/gitlab-org/gitlab/-/issues/29239) and greater, user ID and username are also
recorded on this log, if available.
## `graphql_json.log`
@ -686,7 +699,7 @@ installations from source.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/19186) in GitLab 12.6.
This file lives in `/var/log/gitlab/mailroom/mail_room_json.log` for
This file lives in `/var/log/gitlab/mailroom/current` for
Omnibus GitLab packages or in `/home/git/gitlab/log/mail_room_json.log` for
installations from source.
@ -793,8 +806,8 @@ This file lives in `/var/log/gitlab/gitlab-rails/service_measurement.log` for
Omnibus GitLab packages or in `/home/git/gitlab/log/service_measurement.log` for
installations from source.
It contain only a single structured log with measurements for each service execution.
It will contain measurement such as: number of SQL calls, `execution_time`, `gc_stats`, `memory_usage`, etc...
It contains only a single structured log with measurements for each service execution.
It will contain measurements such as the number of SQL calls, `execution_time`, `gc_stats`, and `memory usage`.
For example:
@ -870,22 +883,46 @@ For example:
}
```
## Mattermost Logs
For Omnibus GitLab installations, Mattermost logs reside in `/var/log/gitlab/mattermost/mattermost.log`.
## Workhorse Logs
For Omnibus installations, Workhorse logs reside in `/var/log/gitlab/gitlab-workhorse/current`.
For Omnibus GitLab installations, Workhorse logs reside in `/var/log/gitlab/gitlab-workhorse/`.
## PostgreSQL Logs
For Omnibus installations, PostgreSQL logs reside in `/var/log/gitlab/postgresql/current`.
For Omnibus GitLab installations, PostgreSQL logs reside in `/var/log/gitlab/postgresql/`.
## Prometheus Logs
For Omnibus installations, Prometheus logs reside in `/var/log/gitlab/prometheus/current`.
For Omnibus GitLab installations, Prometheus logs reside in `/var/log/gitlab/prometheus/`.
## Redis Logs
For Omnibus installations, Redis logs reside in `/var/log/gitlab/redis/current`.
For Omnibus GitLab installations, Redis logs reside in `/var/log/gitlab/redis/`.
## Mattermost Logs
## Alertmanager Logs
For Omnibus installations, Mattermost logs reside in `/var/log/gitlab/mattermost/mattermost.log`.
For Omnibus GitLab installations, Alertmanager logs reside in `/var/log/gitlab/alertmanager/`.
## Crond Logs
For Omnibus GitLab installations, crond logs reside in `/var/log/gitlab/crond/`.
## Grafana Logs
For Omnibus GitLab installations, Grafana logs reside in `/var/log/gitlab/grafana/`.
## LogRotate Logs
For Omnibus GitLab installations, logrotate logs reside in `/var/log/gitlab/logrotate/`.
## GitLab Monitor Logs
For Omnibus GitLab installations, GitLab Monitor logs reside in `/var/log/gitlab/gitlab-monitor/`.
## GitLab Exporter
For Omnibus GitLab installations, GitLab Exporter logs reside in `/var/log/gitlab/gitlab-exporter/`.

View file

@ -6368,6 +6368,11 @@ input JiraImportStartInput {
The project to import the Jira project into
"""
projectPath: ID!
"""
The mapping of Jira to GitLab users
"""
usersMapping: [JiraUsersMappingInputType!]
}
"""
@ -6546,6 +6551,18 @@ type JiraUser {
jiraEmail: String
}
input JiraUsersMappingInputType {
"""
Id of the GitLab user
"""
gitlabId: Int
"""
Jira account id of the user
"""
jiraAccountId: String!
}
type Label {
"""
Background color of the label

View file

@ -17605,6 +17605,24 @@
},
"defaultValue": null
},
{
"name": "usersMapping",
"description": "The mapping of Jira to GitLab users",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "JiraUsersMappingInputType",
"ofType": null
}
}
},
"defaultValue": null
},
{
"name": "clientMutationId",
"description": "A unique identifier for the client performing the mutation.",
@ -18167,6 +18185,41 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "JiraUsersMappingInputType",
"description": null,
"fields": null,
"inputFields": [
{
"name": "jiraAccountId",
"description": "Jira account id of the user",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "gitlabId",
"description": "Id of the GitLab user",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Label",

View file

@ -98,6 +98,46 @@ For instance:
Model.create(foo: params[:foo])
```
## Array types
With Grape v1.3+, Array types must be defined with a `coerce_with`
block, or parameters will fail to validate when passed a string from an
API request. See the [Grape upgrading
documentation](https://github.com/ruby-grape/grape/blob/master/UPGRADING.md#ensure-that-array-types-have-explicit-coercions)
for more details.
### Automatic coercion of nil inputs
Prior to Grape v1.3.3, Array parameters with `nil` values would
automatically be coerced to an empty Array. However, due to [this pull
request in v1.3.3](https://github.com/ruby-grape/grape/pull/2040), this
is no longer the case. For example, suppose you define a PUT `/test`
request that has an optional parameter:
```ruby
optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The user ids for this rule'
```
Normally, a request to PUT `/test?user_ids` would cause Grape to pass
`params` of `{ user_ids: nil }`.
This may introduce errors with endpoints that expect a blank array and
do not handle `nil` inputs properly. To preserve the previous behavior,
there is a helper method `coerce_nil_params_to_array!` that is used
in the `before` block of all API calls:
```ruby
before do
coerce_nil_params_to_array!
end
```
With this change, a request to PUT `/test?user_ids` will cause Grape to
pass `params` to be `{ user_ids: [] }`.
There is [an open issue in the Grape tracker](https://github.com/ruby-grape/grape/issues/2068)
to make this easier.
## Using HTTP status helpers
For non-200 HTTP responses, use the provided helpers in `lib/api/helpers.rb` to ensure correct behavior (`not_found!`, `no_content!` etc.). These will `throw` inside Grape and abort the execution of your endpoint.

View file

@ -512,12 +512,12 @@ do that, so we'll follow regular object-oriented practices that we define the
interface first here.
For example, suppose we have a few more optional parameters for EE. We can move the
parameters out of the `Grape::API` class to a helper module, so we can inject it
parameters out of the `Grape::API::Instance` class to a helper module, so we can inject it
before it would be used in the class.
```ruby
module API
class Projects < Grape::API
class Projects < Grape::API::Instance
helpers Helpers::ProjectsHelpers
end
end
@ -578,7 +578,7 @@ class definition to make it easy and clear:
```ruby
module API
class JobArtifacts < Grape::API
class JobArtifacts < Grape::API::Instance
# EE::API::JobArtifacts would override the following helpers
helpers do
def authorize_download_artifacts!
@ -622,7 +622,7 @@ route. Something like this:
```ruby
module API
class MergeRequests < Grape::API
class MergeRequests < Grape::API::Instance
helpers do
# EE::API::MergeRequests would override the following helpers
def update_merge_request_ee(merge_request)
@ -691,7 +691,7 @@ least argument. We would approach this as follows:
```ruby
# api/merge_requests/parameters.rb
module API
class MergeRequests < Grape::API
class MergeRequests < Grape::API::Instance
module Parameters
def self.update_params_at_least_one_of
%i[
@ -707,7 +707,7 @@ API::MergeRequests::Parameters.prepend_if_ee('EE::API::MergeRequests::Parameters
# api/merge_requests.rb
module API
class MergeRequests < Grape::API
class MergeRequests < Grape::API::Instance
params do
at_least_one_of(*Parameters.update_params_at_least_one_of)
end

View file

@ -13,9 +13,16 @@ Groups and projects can have the following visibility levels:
- internal (`10`) - an entity is visible to logged in users
- private (`0`) - an entity is visible only to the approved members of the entity
By default, subgroups can **not** have higher visibility levels.
For example, if you create a new private group, it can not include a public subgroup.
The visibility level of a group can be changed only if all subgroups and
sub-projects have the same or lower visibility level. (e.g., a group can be set
to internal only if all subgroups and projects are internal or private).
sub-projects have the same or lower visibility level. For example, a group can be set
to internal only if all subgroups and projects are internal or private.
CAUTION: **Warning:**
If you migrate an existing group to a lower visibility level, that action does not migrate subgroups
in the same way. This is a [known issue](https://gitlab.com/gitlab-org/gitlab/-/issues/22406).
Visibility levels can be found in the `Gitlab::VisibilityLevel` module.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View file

@ -45,7 +45,7 @@ At the pipeline level, the Security section displays the vulnerabilities present
Visit the page for any pipeline which has run any of the [supported reports](#supported-reports). Click the **Security** tab to view the Security findings.
![Pipeline Security Dashboard](img/pipeline_security_dashboard_v12_6.png)
![Pipeline Security Dashboard](img/pipeline_security_dashboard_v13_2.png)
NOTE: **Note:**
A pipeline consists of multiple jobs, including SAST and DAST scanning. If any job fails to finish for any reason, the security dashboard will not show SAST scanner output. For example, if the SAST job finishes but the DAST job fails, the security dashboard will not show SAST results. The analyzer will output an [exit code](../../../development/integrations/secure.md#exit-code) on failure.

View file

@ -19,6 +19,9 @@ By using subgroups you can do the following:
- **Make it easier to manage people and control visibility.** Give people
different [permissions](../../permissions.md#group-members-permissions) depending on their group [membership](#membership).
For more information on allowed permissions in groups and projects, see
[visibility levels](../../../development/permissions.md#general-permissions).
## Overview
A group can have many subgroups inside it, and at the same time a group can have

View file

@ -105,7 +105,7 @@ back to both GitLab and GitHub when completed.
1. The result of the job will be visible directly from the pipeline view:
![Security Dashboard](../../application_security/security_dashboard/img/pipeline_security_dashboard_v12_6.png)
![Security Dashboard](../../application_security/security_dashboard/img/pipeline_security_dashboard_v13_2.png)
NOTE: **Note:**
If you don't commit very often to your project, you may want to use

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class AccessRequests < Grape::API
class AccessRequests < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -3,7 +3,7 @@
module API
module Admin
module Ci
class Variables < Grape::API
class Variables < Grape::API::Instance
include PaginationParams
before { authenticated_as_admin! }

View file

@ -2,7 +2,7 @@
module API
module Admin
class Sidekiq < Grape::API
class Sidekiq < Grape::API::Instance
before { authenticated_as_admin! }
namespace 'admin' do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class API < Grape::API
class API < Grape::API::Instance
include APIGuard
LOG_FILENAME = Rails.root.join("log", "api_json.log")
@ -46,6 +46,8 @@ module API
end
before do
coerce_nil_params_to_array!
Gitlab::ApplicationContext.push(
user: -> { @current_user },
project: -> { @project },

View file

@ -153,7 +153,16 @@ module API
{ scope: e.scopes })
end
response.finish
finished_response = nil
response.finish do |rack_response|
# Grape expects a Rack::Response
# (https://github.com/ruby-grape/grape/commit/c117bff7d22971675f4b34367d3a98bc31c8fc02),
# and we need to retrieve it here:
# https://github.com/nov/rack-oauth2/blob/40c9a99fd80486ccb8de0e4869ae384547c0d703/lib/rack/oauth2/server/abstract/error.rb#L28
finished_response = rack_response
end
finished_response
end
end
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Appearance < Grape::API
class Appearance < Grape::API::Instance
before { authenticated_as_admin! }
helpers do

View file

@ -2,7 +2,7 @@
module API
# External applications API
class Applications < Grape::API
class Applications < Grape::API::Instance
before { authenticated_as_admin! }
resource :applications do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Avatar < Grape::API
class Avatar < Grape::API::Instance
resource :avatar do
desc 'Return avatar url for a user' do
success Entities::Avatar

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class AwardEmoji < Grape::API
class AwardEmoji < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Badges < Grape::API
class Badges < Grape::API::Instance
include PaginationParams
before { authenticate_non_get! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Boards < Grape::API
class Boards < Grape::API::Instance
include BoardsResponses
include PaginationParams

View file

@ -3,7 +3,7 @@
require 'mime/types'
module API
class Branches < Grape::API
class Branches < Grape::API::Instance
include PaginationParams
BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(branch: API::NO_SLASH_URL_PART_REGEX)

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class BroadcastMessages < Grape::API
class BroadcastMessages < Grape::API::Instance
include PaginationParams
resource :broadcast_messages do

View file

@ -2,7 +2,7 @@
module API
module Ci
class Runner < Grape::API
class Runner < Grape::API::Instance
helpers ::API::Helpers::Runner
resource :runners do
@ -19,7 +19,7 @@ module API
optional :access_level, type: String, values: ::Ci::Runner.access_levels.keys,
desc: 'The access_level of the runner'
optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs'
optional :tag_list, type: Array[String], desc: %q(List of Runner's tags)
optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: %q(List of Runner's tags)
optional :maximum_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job'
end
post '/' do

View file

@ -2,7 +2,7 @@
module API
module Ci
class Runners < Grape::API
class Runners < Grape::API::Instance
include PaginationParams
before { authenticate! }
@ -18,7 +18,7 @@ module API
desc: 'The type of the runners to show'
optional :status, type: String, values: ::Ci::Runner::AVAILABLE_STATUSES,
desc: 'The status of the runners to show'
optional :tag_list, type: Array[String], desc: 'The tags of the runners to show'
optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show'
use :pagination
end
get do
@ -41,7 +41,7 @@ module API
desc: 'The type of the runners to show'
optional :status, type: String, values: ::Ci::Runner::AVAILABLE_STATUSES,
desc: 'The status of the runners to show'
optional :tag_list, type: Array[String], desc: 'The tags of the runners to show'
optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show'
use :pagination
end
get 'all' do
@ -76,7 +76,7 @@ module API
requires :id, type: Integer, desc: 'The ID of the runner'
optional :description, type: String, desc: 'The description of the runner'
optional :active, type: Boolean, desc: 'The state of a runner'
optional :tag_list, type: Array[String], desc: 'The list of tags for a runner'
optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The list of tags for a runner'
optional :run_untagged, type: Boolean, desc: 'Flag indicating the runner can execute untagged jobs'
optional :locked, type: Boolean, desc: 'Flag indicating the runner is locked'
optional :access_level, type: String, values: ::Ci::Runner.access_levels.keys,
@ -146,7 +146,7 @@ module API
desc: 'The type of the runners to show'
optional :status, type: String, values: ::Ci::Runner::AVAILABLE_STATUSES,
desc: 'The status of the runners to show'
optional :tag_list, type: Array[String], desc: 'The tags of the runners to show'
optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show'
use :pagination
end
get ':id/runners' do
@ -209,7 +209,7 @@ module API
desc: 'The type of the runners to show'
optional :status, type: String, values: ::Ci::Runner::AVAILABLE_STATUSES,
desc: 'The status of the runners to show'
optional :tag_list, type: Array[String], desc: 'The tags of the runners to show'
optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show'
use :pagination
end
get ':id/runners' do

View file

@ -3,7 +3,7 @@
require 'mime/types'
module API
class CommitStatuses < Grape::API
class CommitStatuses < Grape::API::Instance
params do
requires :id, type: String, desc: 'The ID of a project'
end

View file

@ -3,7 +3,7 @@
require 'mime/types'
module API
class Commits < Grape::API
class Commits < Grape::API::Instance
include PaginationParams
before do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ContainerRegistryEvent < Grape::API
class ContainerRegistryEvent < Grape::API::Instance
DOCKER_DISTRIBUTION_EVENTS_V1_JSON = 'application/vnd.docker.distribution.events.v1+json'
before { authenticate_registry_notification! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class DeployKeys < Grape::API
class DeployKeys < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class DeployTokens < Grape::API
class DeployTokens < Grape::API::Instance
include PaginationParams
helpers do
@ -56,7 +56,7 @@ module API
params do
requires :name, type: String, desc: "New deploy token's name"
requires :scopes, type: Array[String], values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s),
requires :scopes, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s),
desc: 'Indicates the deploy token scopes. Must be at least one of "read_repository", "read_registry", "write_registry", "read_package_registry", or "write_package_registry".'
optional :expires_at, type: DateTime, desc: 'Expiration date for the deploy token. Does not expire if no value is provided.'
optional :username, type: String, desc: 'Username for deploy token. Default is `gitlab+deploy-token-{n}`'
@ -119,7 +119,7 @@ module API
params do
requires :name, type: String, desc: 'The name of the deploy token'
requires :scopes, type: Array[String], values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s),
requires :scopes, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s),
desc: 'Indicates the deploy token scopes. Must be at least one of "read_repository", "read_registry", "write_registry", "read_package_registry", or "write_package_registry".'
optional :expires_at, type: DateTime, desc: 'Expiration date for the deploy token. Does not expire if no value is provided.'
optional :username, type: String, desc: 'Username for deploy token. Default is `gitlab+deploy-token-{n}`'

View file

@ -2,7 +2,7 @@
module API
# Deployments RESTful API endpoints
class Deployments < Grape::API
class Deployments < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Discussions < Grape::API
class Discussions < Grape::API::Instance
include PaginationParams
helpers ::API::Helpers::NotesHelpers
helpers ::RendersNotes

View file

@ -2,7 +2,7 @@
module API
# Environments RESTfull API endpoints
class Environments < Grape::API
class Environments < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ErrorTracking < Grape::API
class ErrorTracking < Grape::API::Instance
before { authenticate! }
params do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Events < Grape::API
class Events < Grape::API::Instance
include PaginationParams
include APIGuard
helpers ::API::Helpers::EventsHelpers

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Features < Grape::API
class Features < Grape::API::Instance
before { authenticated_as_admin! }
helpers do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Files < Grape::API
class Files < Grape::API::Instance
include APIGuard
FILE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(file_path: API::NO_SLASH_URL_PART_REGEX)

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class FreezePeriods < Grape::API
class FreezePeriods < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class GroupBoards < Grape::API
class GroupBoards < Grape::API::Instance
include BoardsResponses
include PaginationParams

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class GroupClusters < Grape::API
class GroupClusters < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class GroupContainerRepositories < Grape::API
class GroupContainerRepositories < Grape::API::Instance
include PaginationParams
before { authorize_read_group_container_images! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class GroupExport < Grape::API
class GroupExport < Grape::API::Instance
helpers Helpers::RateLimiter
before do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class GroupImport < Grape::API
class GroupImport < Grape::API::Instance
helpers Helpers::FileUploadHelpers
helpers do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class GroupLabels < Grape::API
class GroupLabels < Grape::API::Instance
include PaginationParams
helpers ::API::Helpers::LabelHelpers

View file

@ -1,13 +1,11 @@
# frozen_string_literal: true
module API
class GroupMilestones < Grape::API
class GroupMilestones < Grape::API::Instance
include MilestoneResponses
include PaginationParams
before do
authenticate!
end
before { authenticate! }
params do
requires :id, type: String, desc: 'The ID of a group'

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class GroupVariables < Grape::API
class GroupVariables < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Groups < Grape::API
class Groups < Grape::API::Instance
include PaginationParams
include Helpers::CustomAttributes
@ -16,7 +16,7 @@ module API
params :group_list_params do
use :statistics_params
optional :skip_groups, type: Array[Integer], desc: 'Array of group ids to exclude from list'
optional :skip_groups, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of group ids to exclude from list'
optional :all_available, type: Boolean, desc: 'Show all group that you have access to'
optional :search, type: String, desc: 'Search for a specific group'
optional :owned, type: Boolean, default: false, desc: 'Limit by owned by authenticated user'

View file

@ -12,6 +12,26 @@ module API
end
end
end
# Grape v1.3.3 no longer automatically coerces an Array
# type to an empty array if the value is nil.
def coerce_nil_params_to_array!
keys_to_coerce = params_with_array_types
params.each do |key, val|
params[key] = Array(val) if val.nil? && keys_to_coerce.include?(key)
end
end
def params_with_array_types
options[:route_options][:params].map do |key, val|
param_type = val[:type]
# Search for parameters with Array types (e.g. "[String]", "[Integer]", etc.)
if param_type =~ %r(\[\w*\])
key
end
end.compact.to_set
end
end
end
end

View file

@ -24,7 +24,7 @@ module API
optional :milestone, type: String, desc: 'Return merge requests for a specific milestone'
optional :labels,
type: Array[String],
coerce_with: Validations::Types::LabelsList.coerce,
coerce_with: Validations::Types::CommaSeparatedToArray.coerce,
desc: 'Comma-separated list of label names'
optional :with_labels_details, type: Boolean, desc: 'Return titles of labels and other details', default: false
optional :with_merge_status_recheck, type: Boolean, desc: 'Request that stale merge statuses be rechecked asynchronously', default: false

View file

@ -48,7 +48,7 @@ module API
optional :only_allow_merge_if_pipeline_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed'
optional :allow_merge_on_skipped_pipeline, type: Boolean, desc: 'Allow to merge if pipeline is skipped'
optional :only_allow_merge_if_all_discussions_are_resolved, type: Boolean, desc: 'Only allow to merge if all discussions are resolved'
optional :tag_list, type: Array[String], desc: 'The list of tags for a project'
optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The list of tags for a project'
# TODO: remove rubocop disable - https://gitlab.com/gitlab-org/gitlab/issues/14960
optional :avatar, type: File, desc: 'Avatar image for project' # rubocop:disable Scalability/FileUploads
optional :printing_merge_request_link_enabled, type: Boolean, desc: 'Show link to create/view merge request when pushing from the command line'

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ImportGithub < Grape::API
class ImportGithub < Grape::API::Instance
rescue_from Octokit::Unauthorized, with: :provider_unauthorized
helpers do

View file

@ -3,7 +3,7 @@
module API
# Internal access API
module Internal
class Base < Grape::API
class Base < Grape::API::Instance
before { authenticate_by_gitlab_shell_token! }
before do

View file

@ -3,7 +3,7 @@
module API
# Pages Internal API
module Internal
class Pages < Grape::API
class Pages < Grape::API::Instance
before do
authenticate_gitlab_pages_request!
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Issues < Grape::API
class Issues < Grape::API::Instance
include PaginationParams
helpers Helpers::IssuesHelpers
helpers Helpers::RateLimiter
@ -10,9 +10,9 @@ module API
helpers do
params :negatable_issue_filter_params do
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :milestone, type: String, desc: 'Milestone title'
optional :iids, type: Array[Integer], desc: 'The IID array of issues'
optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of issues'
optional :search, type: String, desc: 'Search issues for text present in the title, description, or any combination of these'
optional :in, type: String, desc: '`title`, `description`, or a string joining them with comma'
@ -62,12 +62,12 @@ module API
params :issue_params do
optional :description, type: String, desc: 'The description of an issue'
optional :assignee_ids, type: Array[Integer], desc: 'The array of user IDs to assign issue'
optional :assignee_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The array of user IDs to assign issue'
optional :assignee_id, type: Integer, desc: '[Deprecated] The ID of a user to assign issue'
optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign issue'
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :add_labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :remove_labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :add_labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :remove_labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :due_date, type: String, desc: 'Date string in the format YEAR-MONTH-DAY'
optional :confidential, type: Boolean, desc: 'Boolean parameter if the issue should be confidential'
optional :discussion_locked, type: Boolean, desc: " Boolean parameter indicating if the issue's discussion is locked"

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class JobArtifacts < Grape::API
class JobArtifacts < Grape::API::Instance
before { authenticate_non_get! }
# EE::API::JobArtifacts would override the following helpers

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Jobs < Grape::API
class Jobs < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -2,7 +2,7 @@
module API
# Keys API
class Keys < Grape::API
class Keys < Grape::API::Instance
before { authenticate! }
resource :keys do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Labels < Grape::API
class Labels < Grape::API::Instance
include PaginationParams
helpers ::API::Helpers::LabelHelpers

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Lint < Grape::API
class Lint < Grape::API::Instance
namespace :ci do
desc 'Validation of .gitlab-ci.yml content'
params do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Markdown < Grape::API
class Markdown < Grape::API::Instance
params do
requires :text, type: String, desc: "The markdown text to render"
optional :gfm, type: Boolean, desc: "Render text using GitLab Flavored Markdown"

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Members < Grape::API
class Members < Grape::API::Instance
include PaginationParams
before { authenticate! }
@ -18,7 +18,7 @@ module API
end
params do
optional :query, type: String, desc: 'A query string to search for members'
optional :user_ids, type: Array[Integer], desc: 'Array of user ids to look up for membership'
optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of user ids to look up for membership'
optional :show_seat_info, type: Boolean, desc: 'Show seat information for members'
use :optional_filter_params_ee
use :pagination
@ -37,7 +37,7 @@ module API
end
params do
optional :query, type: String, desc: 'A query string to search for members'
optional :user_ids, type: Array[Integer], desc: 'Array of user ids to look up for membership'
optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of user ids to look up for membership'
optional :show_seat_info, type: Boolean, desc: 'Show seat information for members'
use :pagination
end

View file

@ -2,7 +2,7 @@
module API
# MergeRequestDiff API
class MergeRequestDiffs < Grape::API
class MergeRequestDiffs < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class MergeRequests < Grape::API
class MergeRequests < Grape::API::Instance
include PaginationParams
CONTEXT_COMMITS_POST_LIMIT = 20
@ -179,11 +179,11 @@ module API
params :optional_params do
optional :description, type: String, desc: 'The description of the merge request'
optional :assignee_id, type: Integer, desc: 'The ID of a user to assign the merge request'
optional :assignee_ids, type: Array[Integer], desc: 'The array of user IDs to assign issue'
optional :assignee_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The array of user IDs to assign issue'
optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign the merge request'
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :add_labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :remove_labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :add_labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :remove_labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :remove_source_branch, type: Boolean, desc: 'Remove source branch when merging'
optional :allow_collaboration, type: Boolean, desc: 'Allow commits from members who can merge to the target branch'
optional :allow_maintainer_to_push, type: Boolean, as: :allow_collaboration, desc: '[deprecated] See allow_collaboration'
@ -198,7 +198,7 @@ module API
end
params do
use :merge_requests_params
optional :iids, type: Array[Integer], desc: 'The IID array of merge requests'
optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of merge requests'
end
get ":id/merge_requests" do
authorize! :read_merge_request, user_project
@ -315,7 +315,7 @@ module API
end
params do
requires :commits, type: Array, allow_blank: false, desc: 'List of context commits sha'
requires :commits, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, allow_blank: false, desc: 'List of context commits sha'
end
desc 'create context commits of merge request' do
success Entities::Commit
@ -345,7 +345,7 @@ module API
end
params do
requires :commits, type: Array, allow_blank: false, desc: 'List of context commits sha'
requires :commits, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, allow_blank: false, desc: 'List of context commits sha'
end
desc 'remove context commits of merge request'
delete ':id/merge_requests/:merge_request_iid/context_commits' do

View file

@ -3,7 +3,7 @@
module API
module Metrics
module Dashboard
class Annotations < Grape::API
class Annotations < Grape::API::Instance
desc 'Create a new monitoring dashboard annotation' do
success Entities::Metrics::Dashboard::Annotation
end

View file

@ -2,7 +2,7 @@
module API
module Metrics
class UserStarredDashboards < Grape::API
class UserStarredDashboards < Grape::API::Instance
resource :projects do
desc 'Marks selected metrics dashboard as starred' do
success Entities::Metrics::UserStarredDashboard

View file

@ -15,7 +15,7 @@ module API
params :list_params do
optional :state, type: String, values: %w[active closed all], default: 'all',
desc: 'Return "active", "closed", or "all" milestones'
optional :iids, type: Array[Integer], desc: 'The IIDs of the milestones'
optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IIDs of the milestones'
optional :title, type: String, desc: 'The title of the milestones'
optional :search, type: String, desc: 'The search criteria for the title or description of the milestone'
use :pagination

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Namespaces < Grape::API
class Namespaces < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Notes < Grape::API
class Notes < Grape::API::Instance
include PaginationParams
helpers ::API::Helpers::NotesHelpers

View file

@ -2,7 +2,7 @@
module API
# notification_settings API
class NotificationSettings < Grape::API
class NotificationSettings < Grape::API::Instance
before { authenticate! }
helpers ::API::Helpers::MembersHelpers

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Pages < Grape::API
class Pages < Grape::API::Instance
before do
require_pages_config_enabled!
authenticated_with_can_read_all_resources!

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class PagesDomains < Grape::API
class PagesDomains < Grape::API::Instance
include PaginationParams
PAGES_DOMAINS_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(domain: API::NO_SLASH_URL_PART_REGEX)

View file

@ -4,7 +4,7 @@ module API
# Concern for declare pagination params.
#
# @example
# class CustomApiResource < Grape::API
# class CustomApiResource < Grape::API::Instance
# include PaginationParams
#
# params do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class PipelineSchedules < Grape::API
class PipelineSchedules < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class Pipelines < Grape::API
class Pipelines < Grape::API::Instance
include PaginationParams
before { authenticate_non_get! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectClusters < Grape::API
class ProjectClusters < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectContainerRepositories < Grape::API
class ProjectContainerRepositories < Grape::API::Instance
include PaginationParams
REPOSITORY_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectEvents < Grape::API
class ProjectEvents < Grape::API::Instance
include PaginationParams
include APIGuard
helpers ::API::Helpers::EventsHelpers

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectExport < Grape::API
class ProjectExport < Grape::API::Instance
helpers Helpers::RateLimiter
before do

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectHooks < Grape::API
class ProjectHooks < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectImport < Grape::API
class ProjectImport < Grape::API::Instance
include PaginationParams
MAXIMUM_FILE_SIZE = 50.megabytes

View file

@ -1,13 +1,11 @@
# frozen_string_literal: true
module API
class ProjectMilestones < Grape::API
class ProjectMilestones < Grape::API::Instance
include PaginationParams
include MilestoneResponses
before do
authenticate!
end
before { authenticate! }
params do
requires :id, type: String, desc: 'The ID of a project'

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectRepositoryStorageMoves < Grape::API
class ProjectRepositoryStorageMoves < Grape::API::Instance
include PaginationParams
before { authenticated_as_admin! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectSnapshots < Grape::API
class ProjectSnapshots < Grape::API::Instance
helpers ::API::Helpers::ProjectSnapshotsHelpers
before { authorize_read_git_snapshot! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectSnippets < Grape::API
class ProjectSnippets < Grape::API::Instance
include PaginationParams
before { authenticate! }

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectStatistics < Grape::API
class ProjectStatistics < Grape::API::Instance
before do
authenticate!
authorize! :daily_statistics, user_project

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
module API
class ProjectTemplates < Grape::API
class ProjectTemplates < Grape::API::Instance
include PaginationParams
TEMPLATE_TYPES = %w[dockerfiles gitignores gitlab_ci_ymls licenses].freeze

Some files were not shown because too many files have changed in this diff Show more