Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-05-03 09:07:47 +00:00
parent 982c486da4
commit 4df4a22481
15 changed files with 14 additions and 138 deletions

View file

@ -23,12 +23,6 @@ Lint/UselessMethodDefinition:
Naming/RescuedExceptionsVariableName: Naming/RescuedExceptionsVariableName:
Enabled: false Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Performance/AncestorsInclude:
Exclude:
- 'lib/gitlab/ci/config/extendable/entry.rb'
# Offense count: 29 # Offense count: 29
# Configuration parameters: MinSize. # Configuration parameters: MinSize.
Performance/CollectionLiteralInLoop: Performance/CollectionLiteralInLoop:

View file

@ -132,8 +132,6 @@ export const TOKEN_TYPE_CONFIDENTIAL = 'confidential';
export const TOKEN_TYPE_ITERATION = 'iteration'; export const TOKEN_TYPE_ITERATION = 'iteration';
export const TOKEN_TYPE_EPIC = 'epic_id'; export const TOKEN_TYPE_EPIC = 'epic_id';
export const TOKEN_TYPE_WEIGHT = 'weight'; export const TOKEN_TYPE_WEIGHT = 'weight';
export const TOKEN_TYPE_CONTACT = 'crm_contact';
export const TOKEN_TYPE_ORGANIZATION = 'crm_organization';
export const filters = { export const filters = {
[TOKEN_TYPE_AUTHOR]: { [TOKEN_TYPE_AUTHOR]: {
@ -296,24 +294,4 @@ export const filters = {
}, },
}, },
}, },
[TOKEN_TYPE_CONTACT]: {
[API_PARAM]: {
[NORMAL_FILTER]: 'crmContactId',
},
[URL_PARAM]: {
[OPERATOR_IS]: {
[NORMAL_FILTER]: 'crm_contact_id',
},
},
},
[TOKEN_TYPE_ORGANIZATION]: {
[API_PARAM]: {
[NORMAL_FILTER]: 'crmOrganizationId',
},
[URL_PARAM]: {
[OPERATOR_IS]: {
[NORMAL_FILTER]: 'crm_organization_id',
},
},
},
}; };

View file

@ -20,8 +20,6 @@ query getIssues(
$releaseTag: [String!] $releaseTag: [String!]
$releaseTagWildcardId: ReleaseTagWildcardId $releaseTagWildcardId: ReleaseTagWildcardId
$types: [IssueType!] $types: [IssueType!]
$crmContactId: String
$crmOrganizationId: String
$not: NegatedIssueFilterInput $not: NegatedIssueFilterInput
$beforeCursor: String $beforeCursor: String
$afterCursor: String $afterCursor: String
@ -45,8 +43,6 @@ query getIssues(
milestoneWildcardId: $milestoneWildcardId milestoneWildcardId: $milestoneWildcardId
myReactionEmoji: $myReactionEmoji myReactionEmoji: $myReactionEmoji
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
before: $beforeCursor before: $beforeCursor
after: $afterCursor after: $afterCursor
@ -80,8 +76,6 @@ query getIssues(
releaseTag: $releaseTag releaseTag: $releaseTag
releaseTagWildcardId: $releaseTagWildcardId releaseTagWildcardId: $releaseTagWildcardId
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
before: $beforeCursor before: $beforeCursor
after: $afterCursor after: $afterCursor

View file

@ -14,8 +14,6 @@ query getIssuesCount(
$releaseTag: [String!] $releaseTag: [String!]
$releaseTagWildcardId: ReleaseTagWildcardId $releaseTagWildcardId: ReleaseTagWildcardId
$types: [IssueType!] $types: [IssueType!]
$crmContactId: String
$crmOrganizationId: String
$not: NegatedIssueFilterInput $not: NegatedIssueFilterInput
) { ) {
group(fullPath: $fullPath) @skip(if: $isProject) { group(fullPath: $fullPath) @skip(if: $isProject) {
@ -34,8 +32,6 @@ query getIssuesCount(
milestoneWildcardId: $milestoneWildcardId milestoneWildcardId: $milestoneWildcardId
myReactionEmoji: $myReactionEmoji myReactionEmoji: $myReactionEmoji
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
) { ) {
count count
@ -54,8 +50,6 @@ query getIssuesCount(
milestoneWildcardId: $milestoneWildcardId milestoneWildcardId: $milestoneWildcardId
myReactionEmoji: $myReactionEmoji myReactionEmoji: $myReactionEmoji
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
) { ) {
count count
@ -74,8 +68,6 @@ query getIssuesCount(
milestoneWildcardId: $milestoneWildcardId milestoneWildcardId: $milestoneWildcardId
myReactionEmoji: $myReactionEmoji myReactionEmoji: $myReactionEmoji
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
) { ) {
count count
@ -98,8 +90,6 @@ query getIssuesCount(
releaseTag: $releaseTag releaseTag: $releaseTag
releaseTagWildcardId: $releaseTagWildcardId releaseTagWildcardId: $releaseTagWildcardId
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
) { ) {
count count
@ -119,8 +109,6 @@ query getIssuesCount(
releaseTag: $releaseTag releaseTag: $releaseTag
releaseTagWildcardId: $releaseTagWildcardId releaseTagWildcardId: $releaseTagWildcardId
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
) { ) {
count count
@ -140,8 +128,6 @@ query getIssuesCount(
releaseTag: $releaseTag releaseTag: $releaseTag
releaseTagWildcardId: $releaseTagWildcardId releaseTagWildcardId: $releaseTagWildcardId
types: $types types: $types
crmContactId: $crmContactId
crmOrganizationId: $crmOrganizationId
not: $not not: $not
) { ) {
count count

View file

@ -68,12 +68,6 @@ module IssueResolverArguments
description: 'Negated arguments.', description: 'Negated arguments.',
prepare: ->(negated_args, ctx) { negated_args.to_h }, prepare: ->(negated_args, ctx) { negated_args.to_h },
required: false required: false
argument :crm_contact_id, GraphQL::Types::String,
required: false,
description: 'ID of a contact assigned to the issues.'
argument :crm_organization_id, GraphQL::Types::String,
required: false,
description: 'ID of an organization assigned to the issues.'
end end
def resolve_with_lookahead(**args) def resolve_with_lookahead(**args)

View file

@ -94,6 +94,7 @@ module Types
method: :public_merge_status, null: true, method: :public_merge_status, null: true,
description: 'Merge status of the merge request.' description: 'Merge status of the merge request.'
field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true, field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true,
calls_gitaly: true,
description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.' description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.'
field :rebase_commit_sha, GraphQL::Types::String, null: true, field :rebase_commit_sha, GraphQL::Types::String, null: true,
description: 'Rebase commit SHA of the merge request.' description: 'Rebase commit SHA of the merge request.'

View file

@ -157,15 +157,13 @@ module Ci
unless build.pending? unless build.pending?
@metrics.increment_queue_operation(:build_not_pending) @metrics.increment_queue_operation(:build_not_pending)
if Feature.enabled?(:ci_pending_builds_table_resiliency, default_enabled: :yaml) ##
## # If this build can not be picked because we had stale data in
# If this build can not be picked because we had stale data in # `ci_pending_builds` table, we need to respond with 409 to retry
# `ci_pending_builds` table, we need to respond with 409 to retry # this operation.
# this operation. #
# if ::Ci::UpdateBuildQueueService.new.remove!(build)
if ::Ci::UpdateBuildQueueService.new.remove!(build) return Result.new(nil, nil, false)
return Result.new(nil, nil, false)
end
end end
return return

View file

@ -1,8 +0,0 @@
---
name: ci_pending_builds_table_resiliency
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84359
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/357988
milestone: '14.10'
type: development
group: group::pipeline execution
default_enabled: true

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
raise 'This patch is only tested with attr_encrypted v3.1.0' unless AttrEncrypted::Version.string == '3.1.0'
module AttrEncrypted module AttrEncrypted
module Adapters module Adapters
module ActiveRecord module ActiveRecord
@ -11,23 +13,6 @@ module AttrEncrypted
false false
end end
# Prevent attr_encrypted from checking out a database connection
# indefinitely. The result of this method is only used when the former
# is true, but it is called unconditionally, so there is still value to
# ensuring the connection is released
def attribute_instance_methods_as_symbols
# Use with_connection so the connection doesn't stay pinned to the thread.
connected = ::ActiveRecord::Base.connection_pool.with_connection(&:active?) rescue false # rubocop:disable Database/MultipleDatabases
if connected
# Call version from AttrEncrypted::Adapters::ActiveRecord
super
else
# Call version from AttrEncrypted, i.e., `super` with regards to AttrEncrypted::Adapters::ActiveRecord
AttrEncrypted.instance_method(:attribute_instance_methods_as_symbols).bind(self).call
end
end
protected protected
# The attr_encrypted gem is not actively maintained # The attr_encrypted gem is not actively maintained

View file

@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# GraphQL API **(FREE)** # GraphQL API **(FREE)**
> [Generally available](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/30444) in GitLab 12.1. [Feature flag `graphql`](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/30444) removed. > Enabled and [made generally available](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/30444) in GitLab 12.1. [Feature flag `graphql`](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/30444) removed.
[GraphQL](https://graphql.org/) is a query language for APIs. You can use it to [GraphQL](https://graphql.org/) is a query language for APIs. You can use it to
request the exact data you need, and therefore limit the number of requests you need. request the exact data you need, and therefore limit the number of requests you need.

View file

@ -11556,8 +11556,6 @@ four standard [pagination arguments](#connection-pagination-arguments):
| <a id="groupissuesconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | <a id="groupissuesconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. |
| <a id="groupissuescreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. | | <a id="groupissuescreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. |
| <a id="groupissuescreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. | | <a id="groupissuescreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. |
| <a id="groupissuescrmcontactid"></a>`crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. |
| <a id="groupissuescrmorganizationid"></a>`crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. |
| <a id="groupissuesepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. | | <a id="groupissuesepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. |
| <a id="groupissuesiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". | | <a id="groupissuesiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". |
| <a id="groupissuesiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | | <a id="groupissuesiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. |
@ -14793,8 +14791,6 @@ Returns [`Issue`](#issue).
| <a id="projectissueconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | <a id="projectissueconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. |
| <a id="projectissuecreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. | | <a id="projectissuecreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. |
| <a id="projectissuecreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. | | <a id="projectissuecreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. |
| <a id="projectissuecrmcontactid"></a>`crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. |
| <a id="projectissuecrmorganizationid"></a>`crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. |
| <a id="projectissueepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. | | <a id="projectissueepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. |
| <a id="projectissueiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". | | <a id="projectissueiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". |
| <a id="projectissueiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | | <a id="projectissueiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. |
@ -14835,8 +14831,6 @@ Returns [`IssueStatusCountsType`](#issuestatuscountstype).
| <a id="projectissuestatuscountsconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | <a id="projectissuestatuscountsconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. |
| <a id="projectissuestatuscountscreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. | | <a id="projectissuestatuscountscreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. |
| <a id="projectissuestatuscountscreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. | | <a id="projectissuestatuscountscreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. |
| <a id="projectissuestatuscountscrmcontactid"></a>`crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. |
| <a id="projectissuestatuscountscrmorganizationid"></a>`crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. |
| <a id="projectissuestatuscountsiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". | | <a id="projectissuestatuscountsiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". |
| <a id="projectissuestatuscountsiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | | <a id="projectissuestatuscountsiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. |
| <a id="projectissuestatuscountslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to this issue. | | <a id="projectissuestatuscountslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to this issue. |
@ -14874,8 +14868,6 @@ four standard [pagination arguments](#connection-pagination-arguments):
| <a id="projectissuesconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | <a id="projectissuesconfidential"></a>`confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. |
| <a id="projectissuescreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. | | <a id="projectissuescreatedafter"></a>`createdAfter` | [`Time`](#time) | Issues created after this date. |
| <a id="projectissuescreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. | | <a id="projectissuescreatedbefore"></a>`createdBefore` | [`Time`](#time) | Issues created before this date. |
| <a id="projectissuescrmcontactid"></a>`crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. |
| <a id="projectissuescrmorganizationid"></a>`crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. |
| <a id="projectissuesepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. | | <a id="projectissuesepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. |
| <a id="projectissuesiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". | | <a id="projectissuesiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". |
| <a id="projectissuesiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | | <a id="projectissuesiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. |

View file

@ -447,13 +447,11 @@ is stored on the machine where GitLab Runner is installed. The location also dep
If you use cache and artifacts to store the same path in your jobs, the cache might If you use cache and artifacts to store the same path in your jobs, the cache might
be overwritten because caches are restored before artifacts. be overwritten because caches are restored before artifacts.
### Segregation of caches between protected and non-protected branches #### Cache key names
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/330047) in GitLab 14.10. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/330047) in GitLab 15.0.
A suffix is added to the cache key, with the exception of the [fallback cache key](#use-a-fallback-cache-key). A suffix is added to the cache key, with the exception of the [fallback cache key](#use-a-fallback-cache-key).
This is done in order to prevent cache poisoning that might occur through manipulation of the cache in a non-protected
branch. Any subsequent protected-branch jobs would then potentially use a poisoned cache from the preceding job.
As an example, assuming that `cache.key` is set to `$CI_COMMIT_REF_SLUG`, and that we have two branches `main` As an example, assuming that `cache.key` is set to `$CI_COMMIT_REF_SLUG`, and that we have two branches `main`
and `feature`, then the following table represents the resulting cache keys: and `feature`, then the following table represents the resulting cache keys:

View file

@ -99,7 +99,7 @@ module Gitlab
end end
def circular_dependency? def circular_dependency?
ancestors.include?(key) ancestors.include?(key) # rubocop:disable Performance/AncestorsInclude
end end
def unknown_extensions def unknown_extensions

View file

@ -146,8 +146,6 @@ export const locationSearch = [
'not[epic_id]=34', 'not[epic_id]=34',
'weight=1', 'weight=1',
'not[weight]=3', 'not[weight]=3',
'crm_contact_id=123',
'crm_organization_id=456',
].join('&'); ].join('&');
export const locationSearchWithSpecialValues = [ export const locationSearchWithSpecialValues = [
@ -196,8 +194,6 @@ export const filteredTokens = [
{ type: 'epic_id', value: { data: '34', operator: OPERATOR_IS_NOT } }, { type: 'epic_id', value: { data: '34', operator: OPERATOR_IS_NOT } },
{ type: 'weight', value: { data: '1', operator: OPERATOR_IS } }, { type: 'weight', value: { data: '1', operator: OPERATOR_IS } },
{ type: 'weight', value: { data: '3', operator: OPERATOR_IS_NOT } }, { type: 'weight', value: { data: '3', operator: OPERATOR_IS_NOT } },
{ type: 'crm_contact', value: { data: '123', operator: OPERATOR_IS } },
{ type: 'crm_organization', value: { data: '456', operator: OPERATOR_IS } },
{ type: 'filtered-search-term', value: { data: 'find' } }, { type: 'filtered-search-term', value: { data: 'find' } },
{ type: 'filtered-search-term', value: { data: 'issues' } }, { type: 'filtered-search-term', value: { data: 'issues' } },
]; ];
@ -226,8 +222,6 @@ export const apiParams = {
iterationId: ['4', '12'], iterationId: ['4', '12'],
epicId: '12', epicId: '12',
weight: '1', weight: '1',
crmContactId: '123',
crmOrganizationId: '456',
not: { not: {
authorUsername: 'marge', authorUsername: 'marge',
assigneeUsernames: ['patty', 'selma'], assigneeUsernames: ['patty', 'selma'],
@ -276,8 +270,6 @@ export const urlParams = {
'not[epic_id]': '34', 'not[epic_id]': '34',
weight: '1', weight: '1',
'not[weight]': '3', 'not[weight]': '3',
crm_contact_id: '123',
crm_organization_id: '456',
}; };
export const urlParamsWithSpecialValues = { export const urlParamsWithSpecialValues = {

View file

@ -389,34 +389,6 @@ RSpec.describe Resolvers::IssuesResolver do
end end
end end
describe 'filtering by crm' do
let_it_be(:organization) { create(:organization, group: group) }
let_it_be(:contact1) { create(:contact, group: group, organization: organization) }
let_it_be(:contact2) { create(:contact, group: group, organization: organization) }
let_it_be(:contact3) { create(:contact, group: group) }
let_it_be(:crm_issue1) { create(:issue, project: project) }
let_it_be(:crm_issue2) { create(:issue, project: project) }
let_it_be(:crm_issue3) { create(:issue, project: project) }
before_all do
create(:issue_customer_relations_contact, issue: crm_issue1, contact: contact1)
create(:issue_customer_relations_contact, issue: crm_issue2, contact: contact2)
create(:issue_customer_relations_contact, issue: crm_issue3, contact: contact3)
end
context 'contact' do
it 'returns only the issues for the contact' do
expect(resolve_issues({ crm_contact_id: contact1.id })).to contain_exactly(crm_issue1)
end
end
context 'organization' do
it 'returns only the issues for the contact' do
expect(resolve_issues({ crm_organization_id: organization.id })).to contain_exactly(crm_issue1, crm_issue2)
end
end
end
describe 'sorting' do describe 'sorting' do
context 'when sorting by created' do context 'when sorting by created' do
it 'sorts issues ascending' do it 'sorts issues ascending' do