Commit f098e6d3 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 697d1c4e
......@@ -65,6 +65,7 @@ module Types
raise ArgumentError, 'Please provide a `milestone` within `deprecated`' unless milestone
raise ArgumentError, 'Please provide a `reason` within `deprecated`' unless reason
raise ArgumentError, '`milestone` must be a `String`' unless milestone.is_a?(String)
deprecated_in = "Deprecated in #{milestone}"
kwargs[:deprecation_reason] = "#{reason}. #{deprecated_in}"
......
......@@ -44,7 +44,7 @@ module Types
field :latest_pipeline,
type: Types::Ci::PipelineType,
null: true,
deprecated: { reason: 'Use `pipelines`', milestone: 12.5 },
deprecated: { reason: 'Use `pipelines`', milestone: '12.5' },
description: 'Latest pipeline of the commit',
resolver: Resolvers::CommitPipelinesResolver.last
end
......
......@@ -18,7 +18,7 @@ module Types
description: 'Timestamp of the issue\'s last activity'
field :token, GraphQL::STRING_TYPE, null: false,
deprecated: { reason: 'Plain text token has been masked for security reasons', milestone: 12.7 },
deprecated: { reason: 'Plain text token has been masked for security reasons', milestone: '12.7' },
description: 'API token for the Grafana integration'
def token
......
......@@ -75,7 +75,7 @@ module Types
field :rebase_in_progress, GraphQL::BOOLEAN_TYPE, method: :rebase_in_progress?, null: false, calls_gitaly: true,
description: 'Indicates if there is a rebase currently in progress for the merge request'
field :merge_commit_message, GraphQL::STRING_TYPE, method: :default_merge_commit_message, null: true,
deprecated: { reason: 'Use `defaultMergeCommitMessage`', milestone: 11.8 },
deprecated: { reason: 'Use `defaultMergeCommitMessage`', milestone: '11.8' },
description: 'Default merge commit message of the merge request'
field :default_merge_commit_message, GraphQL::STRING_TYPE, null: true,
description: 'Default merge commit message of the merge request'
......
......@@ -54,7 +54,7 @@ module Types
field :container_registry_enabled, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if the project stores Docker container images in a container registry'
field :shared_runners_enabled, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if shared runners are enabled on the project'
description: 'Indicates if Shared Runners are enabled for the project'
field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if the project has Large File Storage (LFS) enabled'
field :merge_requests_ff_only_enabled, GraphQL::BOOLEAN_TYPE, null: true,
......@@ -68,14 +68,14 @@ module Types
%i[issues merge_requests wiki snippets].each do |feature|
field "#{feature}_enabled", GraphQL::BOOLEAN_TYPE, null: true,
description: "(deprecated) Does this project have #{feature} enabled?. Use `#{feature}_access_level` instead",
description: "Indicates if #{feature.to_s.titleize.pluralize} are enabled for the current user",
resolve: -> (project, args, ctx) do
project.feature_available?(feature, ctx[:current_user])
end
end
field :jobs_enabled, GraphQL::BOOLEAN_TYPE, null: true,
description: '(deprecated) Enable jobs for this project. Use `builds_access_level` instead',
description: 'Indicates if CI/CD pipeline jobs are enabled for the current user',
resolve: -> (project, args, ctx) do
project.feature_available?(:builds, ctx[:current_user])
end
......
---
title: Cleanup the descriptions of some fields of GraphQL ProjectType
merge_request: 28735
author:
type: changed
---
title: Normalize signature mime types when filtering attachments in emails
merge_request: 28865
author: Diego Louzán
type: fixed
......@@ -52,6 +52,36 @@ management between systems:
- [NetApp instructions](https://library.netapp.com/ecmdocs/ECMP1401220/html/GUID-24367A9F-E17B-4725-ADC1-02D86F56F78E.html)
- For non-NetApp devices, disable NFSv4 `idmapping` by performing opposite of [enable NFSv4 idmapper](https://wiki.archlinux.org/index.php/NFS#Enabling_NFSv4_idmapping)
### Disable NFS server delegation
We recommend that all NFS users disable the NFS server delegation feature. This
is to avoid a [Linux kernel bug](https://bugzilla.redhat.com/show_bug.cgi?id=1552203)
which causes NFS clients to slow precipitously due to
[excessive network traffic from numerous `TEST_STATEID` NFS messages](https://gitlab.com/gitlab-org/gitlab-foss/issues/52017).
To disable NFS server delegation, do the following:
1. On the NFS server, run:
```shell
echo 0 > /proc/sys/fs/leases-enable
sysctl -w fs.leases-enable=0
```
1. Restart the NFS server process. For example, on CentOS run `service nfs restart`.
#### Important notes
The kernel bug may be fixed in
[more recent kernels with this commit](https://github.om/torvalds/linux/commit/95da1b3a5aded124dd1bda1e3cdb876184813140).
Red Hat Enterprise 7 [shipped a kernel update](https://access.redhat.com/errata/RHSA-2019:2029)
on August 6, 2019 that may also have resolved this problem.
You may not need to disable NFS server delegation if you know you are using a version of
the Linux kernel that has been fixed. That said, GitLab still encourages instance
administrators to keep NFS server delegation disabled.
### Improving NFS performance with GitLab
#### Improving NFS performance with Unicorn
......@@ -78,33 +108,7 @@ If the Rugged feature flag is explicitly set to either true or false, GitLab wil
### Known issues
On some customer systems, we have seen NFS clients slow precipitously due to
[excessive network traffic from numerous `TEST_STATEID` NFS
messages](https://gitlab.com/gitlab-org/gitlab-foss/issues/52017). This is
likely due to a [Linux kernel
bug](https://bugzilla.redhat.com/show_bug.cgi?id=1552203) that may be fixed in
[more recent kernels with this
commit](https://github.com/torvalds/linux/commit/95da1b3a5aded124dd1bda1e3cdb876184813140).
NOTE: **Note** Red Hat Enterprise 7 [shipped a kernel
update](https://access.redhat.com/errata/RHSA-2019:2029) on August 6,
2019 that may have resolved this problem. The following instructions may
not be needed if the latest kernel is updated properly.
GitLab recommends all NFS users disable the NFS server
delegation feature. To disable NFS server delegations
on an Linux NFS server, do the following:
1. On the NFS server, run:
```shell
echo 0 > /proc/sys/fs/leases-enable
sysctl -w fs.leases-enable=0
```
1. Restart the NFS server process. For example, on CentOS run `service nfs restart`.
## Avoid using AWS's Elastic File System (EFS)
#### Avoid using AWS's Elastic File System (EFS)
GitLab strongly recommends against using AWS Elastic File System (EFS).
Our support team will not be able to assist on performance issues related to
......@@ -120,12 +124,12 @@ stored on a local volume.
For more details on another person's experience with EFS, see this [Commit Brooklyn 2019 video](https://youtu.be/K6OS8WodRBQ?t=313).
## Avoid using CephFS and GlusterFS
#### Avoid using CephFS and GlusterFS
GitLab strongly recommends against using CephFS and GlusterFS.
These distributed file systems are not well-suited for GitLab's input/output access patterns because Git uses many small files and access times and file locking times to propagate will make Git activity very slow.
## Avoid using PostgreSQL with NFS
#### Avoid using PostgreSQL with NFS
GitLab strongly recommends against running your PostgreSQL database
across NFS. The GitLab support team will not be able to assist on performance issues related to
......
......@@ -6093,7 +6093,7 @@ type Project {
): IssueConnection
"""
(deprecated) Does this project have issues enabled?. Use `issues_access_level` instead
Indicates if Issues are enabled for the current user
"""
issuesEnabled: Boolean
......@@ -6128,7 +6128,7 @@ type Project {
): JiraImportConnection
"""
(deprecated) Enable jobs for this project. Use `builds_access_level` instead
Indicates if CI/CD pipeline jobs are enabled for the current user
"""
jobsEnabled: Boolean
......@@ -6193,7 +6193,7 @@ type Project {
): MergeRequestConnection
"""
(deprecated) Does this project have merge_requests enabled?. Use `merge_requests_access_level` instead
Indicates if Merge Requests are enabled for the current user
"""
mergeRequestsEnabled: Boolean
......@@ -6406,7 +6406,7 @@ type Project {
serviceDeskEnabled: Boolean
"""
Indicates if shared runners are enabled on the project
Indicates if Shared Runners are enabled for the project
"""
sharedRunnersEnabled: Boolean
......@@ -6446,7 +6446,7 @@ type Project {
): SnippetConnection
"""
(deprecated) Does this project have snippets enabled?. Use `snippets_access_level` instead
Indicates if Snippets are enabled for the current user
"""
snippetsEnabled: Boolean
......@@ -6542,7 +6542,7 @@ type Project {
webUrl: String
"""
(deprecated) Does this project have wiki enabled?. Use `wiki_access_level` instead
Indicates if Wikis are enabled for the current user
"""
wikiEnabled: Boolean
}
......
......@@ -18344,7 +18344,7 @@
},
{
"name": "issuesEnabled",
"description": "(deprecated) Does this project have issues enabled?. Use `issues_access_level` instead",
"description": "Indicates if Issues are enabled for the current user",
"args": [
],
......@@ -18425,7 +18425,7 @@
},
{
"name": "jobsEnabled",
"description": "(deprecated) Enable jobs for this project. Use `builds_access_level` instead",
"description": "Indicates if CI/CD pipeline jobs are enabled for the current user",
"args": [
],
......@@ -18589,7 +18589,7 @@
},
{
"name": "mergeRequestsEnabled",
"description": "(deprecated) Does this project have merge_requests enabled?. Use `merge_requests_access_level` instead",
"description": "Indicates if Merge Requests are enabled for the current user",
"args": [
],
......@@ -19125,7 +19125,7 @@
},
{
"name": "sharedRunnersEnabled",
"description": "Indicates if shared runners are enabled on the project",
"description": "Indicates if Shared Runners are enabled for the project",
"args": [
],
......@@ -19220,7 +19220,7 @@
},
{
"name": "snippetsEnabled",
"description": "(deprecated) Does this project have snippets enabled?. Use `snippets_access_level` instead",
"description": "Indicates if Snippets are enabled for the current user",
"args": [
],
......@@ -19493,7 +19493,7 @@
},
{
"name": "wikiEnabled",
"description": "(deprecated) Does this project have wiki enabled?. Use `wiki_access_level` instead",
"description": "Indicates if Wikis are enabled for the current user",
"args": [
],
......
......@@ -901,13 +901,13 @@ Information about pagination in a connection.
| `id` | ID! | ID of the project |
| `importStatus` | String | Status of import background job of the project |
| `issue` | Issue | A single issue of the project |
| `issuesEnabled` | Boolean | (deprecated) Does this project have issues enabled?. Use `issues_access_level` instead |
| `issuesEnabled` | Boolean | Indicates if Issues are enabled for the current user |
| `jiraImportStatus` | String | Status of Jira import background job of the project |
| `jobsEnabled` | Boolean | (deprecated) Enable jobs for this project. Use `builds_access_level` instead |
| `jobsEnabled` | Boolean | Indicates if CI/CD pipeline jobs are enabled for the current user |
| `lastActivityAt` | Time | Timestamp of the project last activity |
| `lfsEnabled` | Boolean | Indicates if the project has Large File Storage (LFS) enabled |
| `mergeRequest` | MergeRequest | A single merge request of the project |
| `mergeRequestsEnabled` | Boolean | (deprecated) Does this project have merge_requests enabled?. Use `merge_requests_access_level` instead |
| `mergeRequestsEnabled` | Boolean | Indicates if Merge Requests are enabled for the current user |
| `mergeRequestsFfOnlyEnabled` | Boolean | Indicates if no merge commits should be created and all merges should instead be fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded. |
| `name` | String! | Name of the project (without namespace) |
| `nameWithNamespace` | String! | Full name of the project with its namespace |
......@@ -927,8 +927,8 @@ Information about pagination in a connection.
| `sentryErrors` | SentryErrorCollection | Paginated collection of Sentry errors on the project |
| `serviceDeskAddress` | String | E-mail address of the service desk. |
| `serviceDeskEnabled` | Boolean | Indicates if the project has service desk enabled. |
| `sharedRunnersEnabled` | Boolean | Indicates if shared runners are enabled on the project |
| `snippetsEnabled` | Boolean | (deprecated) Does this project have snippets enabled?. Use `snippets_access_level` instead |
| `sharedRunnersEnabled` | Boolean | Indicates if Shared Runners are enabled for the project |
| `snippetsEnabled` | Boolean | Indicates if Snippets are enabled for the current user |
| `sshUrlToRepo` | String | URL to connect to the project via SSH |
| `starCount` | Int! | Number of times the project has been starred |
| `statistics` | ProjectStatistics | Statistics of the project |
......@@ -938,7 +938,7 @@ Information about pagination in a connection.
| `visibility` | String | Visibility of the project |
| `vulnerabilitySeveritiesCount` | VulnerabilitySeveritiesCount | Counts for each severity of vulnerability of the project. Available only when feature flag `first_class_vulnerabilities` is enabled |
| `webUrl` | String | Web URL of the project |
| `wikiEnabled` | Boolean | (deprecated) Does this project have wiki enabled?. Use `wiki_access_level` instead |
| `wikiEnabled` | Boolean | Indicates if Wikis are enabled for the current user |
## ProjectPermissions
......
......@@ -45,8 +45,8 @@ For example, `app/graphql/types/issue_type.rb`:
```ruby
graphql_name 'Issue'
field :iid, GraphQL::ID_TYPE, null: false
field :title, GraphQL::STRING_TYPE, null: false
field :iid, GraphQL::ID_TYPE, null: true
field :title, GraphQL::STRING_TYPE, null: true
# we also have a method here that we've defined, that extends `field`
markdown_field :title_html, null: true
......@@ -258,30 +258,78 @@ end
## Feature flags
Features controlled by feature flags often provide GraphQL functionality. When a feature
is enabled or disabled by a feature flag, the related GraphQL functionality should also
be enabled or disabled.
Developers can add [feature flags](../development/feature_flags/index.md) to GraphQL
fields in the following ways:
Fields can be put behind a feature flag so they can conditionally return the value for
the field depending on if the feature has been enabled or not.
- Add the `feature_flag` property to a field. This will allow the field to be _hidden_
from the GraphQL schema when the flag is disabled.
- Toggle the return value when resolving the field.
GraphQL feature flags use the common
[GitLab feature flag](../development/feature_flags.md) system, and can be added to a
field using the `feature_flag` property.
You can refer to these guidelines to decide which approach to use:
For example:
- If your field is experimental, and its name or type is subject to
change, use the `feature_flag` property.
- If your field is stable and its definition will not change, even after the flag is
removed, toggle the return value of the field instead. Note that
[all fields should be nullable](#nullable-fields) anyway.
### `feature_flag` property
The `feature_flag` property allows you to toggle the field's
[visibility](https://graphql-ruby.org/authorization/visibility.html)
within the GraphQL schema. This will remove the field from the schema
when the flag is disabled.
A description is [appended](https://gitlab.com/gitlab-org/gitlab/-/blob/497b556/app/graphql/types/base_field.rb#L44-53)
to the field indicating that it is behind a feature flag.
CAUTION: **Caution:**
If a client queries for the field when the feature flag is disabled, the query will
fail. Consider this when toggling the visibility of the feature on or off on
production.
The `feature_flag` property does not allow the use of
[feature gates based on actors](../development/feature_flags/development.md).
This means that the feature flag cannot be toggled only for particular
projects, groups, or users, but instead can only be toggled globally for
everyone.
Example:
```ruby
field :test_field, type: GraphQL::STRING_TYPE,
null: false,
null: true,
description: 'Some test field',
feature_flag: :some_feature_flag
feature_flag: :my_feature_flag
```
In the above example, the `test_field` field will only be returned if
the `some_feature_flag` feature flag is enabled.
### Toggle the value of a field
This method of using feature flags for fields is to toggle the
return value of the field. This can be done in the resolver, in the
type, or even in a model method, depending on your preference and
situation.
If the feature flag is not enabled, an error will be returned saying the field does not exist.
When applying a feature flag to toggle the value of a field, the
`description` of the field must:
- State that the value of the field can be toggled by a feature flag.
- Name the feature flag.
- State what the field will return when the feature flag is disabled (or
enabled, if more appropriate).
Example:
```ruby
field :foo, GraphQL::STRING_TYPE,
null: true,
description: 'Some test field. Will always return `null`' \
'if `my_feature_flag` feature flag is disabled'
def foo
object.foo unless Feature.enabled?(:my_feature_flag, object)
end
```
## Deprecating fields
......@@ -301,7 +349,7 @@ Example:
```ruby
field :token, GraphQL::STRING_TYPE, null: true,
deprecated: { reason: 'Login via token has been removed', milestone: 10.0 },
deprecated: { reason: 'Login via token has been removed', milestone: '10.0' },
description: 'Token for login'
```
......@@ -321,7 +369,7 @@ Example:
```ruby
field :designs, ::Types::DesignManagement::DesignCollectionType, null: true,
deprecated: { reason: 'Use `designCollection`', milestone: 10.0 },
deprecated: { reason: 'Use `designCollection`', milestone: '10.0' },
description: 'The designs associated with this issue',
```
......@@ -741,7 +789,7 @@ and handles time inputs.
Example:
```ruby
field :created_at, Types::TimeType, null: false, description: 'Timestamp of when the issue was created'
field :created_at, Types::TimeType, null: true, description: 'Timestamp of when the issue was created'
```
## Testing
......
......@@ -30,7 +30,7 @@ Among numerous use cases for exporting issues for CSV, we can name a few:
After selecting a project, from the issues page you can narrow down which issues to export using the search bar, along with the All/Open/Closed tabs. All issues returned will be exported, including those not shown on the first page.
![CSV export button](img/csv_export_button.png)
![CSV export button](img/csv_export_button_v12_9.png)
You will be asked to confirm the number of issues and email address for the export, after which the email will begin being prepared.
......
......@@ -39,15 +39,22 @@ module Gitlab
# from the uploaded attachments
def filter_signature_attachments(message)
attachments = message.attachments
content_type = normalize_mime(message.content_type)
protocol = normalize_mime(message.content_type_parameters[:protocol])
if message.content_type&.starts_with?('multipart/signed')
signature_protocol = message.content_type_parameters[:protocol]
attachments.delete_if { |attachment| attachment.content_type.starts_with?(signature_protocol) } if signature_protocol.present?
if content_type == 'multipart/signed' && protocol
attachments.delete_if { |attachment| protocol == normalize_mime(attachment.content_type) }
end
attachments
end
# normalizes mime-type ignoring case and removing extra data
# also removes potential "x-" prefix from subtype, since some MUAs mix them
# e.g. "application/x-pkcs7-signature" with "application/pkcs7-signature"
def normalize_mime(content_type)
MIME::Type.simplified(content_type, remove_x_prefix: true)
end
end
end
end
......@@ -203,7 +203,7 @@ describe Types::BaseField do
end
it 'raises an error if a required property is missing', :aggregate_failures do
expect { test_field(deprecated: { milestone: 1.0 }) }.to raise_error(
expect { test_field(deprecated: { milestone: '1.10' }) }.to raise_error(
ArgumentError,
'Please provide a `reason` within `deprecated`'
)
......@@ -212,37 +212,44 @@ describe Types::BaseField do
'Please provide a `milestone` within `deprecated`'
)
end
it 'raises an error if milestone is not a String', :aggregate_failures do
expect { test_field(deprecated: { milestone: 1.10, reason: 'Deprecation reason' }) }.to raise_error(
ArgumentError,
'`milestone` must be a `String`'
)
end
end
it 'adds a formatted `deprecated_reason` to the field' do
field = test_field(deprecated: { milestone: 1.0, reason: 'Deprecation reason' })
field = test_field(deprecated: { milestone: '1.10', reason: 'Deprecation reason' })
expect(field.deprecation_reason).to eq('Deprecation reason. Deprecated in 1.0')
expect(field.deprecation_reason).to eq('Deprecation reason. Deprecated in 1.10')
end
it 'appends to the description if given' do
field = test_field(
deprecated: { milestone: 1.0, reason: 'Deprecation reason' },
deprecated: { milestone: '1.10', reason: 'Deprecation reason' },
description: 'Field description'
)
expect(field.description).to eq('Field description. Deprecated in 1.0: Deprecation reason')
expect(field.description).to eq('Field description. Deprecated in 1.10: Deprecation reason')
end
it 'does not append to the description if it is absent' do
field = test_field(deprecated: { milestone: 1.0, reason: 'Deprecation reason' })
field = test_field(deprecated: { milestone: '1.10', reason: 'Deprecation reason' })
expect(field.description).to be_nil
end
it 'interacts well with the `feature_flag` property' do
field = test_field(
deprecated: { milestone: 1.0, reason: 'Deprecation reason' },
deprecated: { milestone: '1.10', reason: 'Deprecation reason' },
description: 'Field description',
feature_flag: 'foo_flag'
)
expect(field.description).to eq('Field description. Available only when feature flag `foo_flag` is enabled. Deprecated in 1.0: Deprecation reason')
expect(field.description).to eq('Field description. Available only when feature flag `foo_flag` is enabled. Deprecated in 1.10: Deprecation reason')
end
end
end
......@@ -31,5 +31,20 @@ describe Gitlab::Email::AttachmentUploader do
expect(image_link[:url]).to include('gitlab_logo.png')
end
end
context 'with a signed message with mixed protocol prefix' do
let(:message_raw) { fixture_file("emails/valid_reply_signed_smime_mixed_protocol_prefix.eml") }
it 'uploads all attachments except the signature' do
links = described_class.new(message).execute(upload_parent: project, uploader_class: FileUploader)
expect(links).not_to include(a_hash_including(alt: 'smime.p7s'))
image_link = links.first
expect(image_link).not_to be_nil
expect(image_link[:alt]).to eq('gitlab_logo')
expect(image_link[:url]).to include('gitlab_logo.png')
end
end
end
end
......@@ -76,7 +76,7 @@ describe Gitlab::Graphql::Docs::Renderer do
Class.new(Types::BaseObject) do
graphql_name 'DeprecatedTest'
field :foo, GraphQL::STRING_TYPE, null: false, deprecated: { reason: 'This is deprecated', milestone: 1.0 }, description: 'A description'
field :foo, GraphQL::STRING_TYPE, null: false, deprecated: { reason: 'This is deprecated', milestone: '1.10' }, description: 'A description'
end
end
......@@ -86,7 +86,7 @@ describe Gitlab::Graphql::Docs::Renderer do
| Name | Type | Description |
| --- | ---- | ---------- |
| `foo` **{warning-solid}** | String! | **Deprecated:** This is deprecated. Deprecated in 1.0 |
| `foo` **{warning-solid}** | String! | **Deprecated:** This is deprecated. Deprecated in 1.10 |
DOC
is_expected.to include(expectation)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment