From 4df4a22481c3ed10e22cdb795dd6d811c4e89fde Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 3 May 2022 09:07:47 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo.yml | 6 ---- .../javascripts/issues/list/constants.js | 22 --------------- .../list/queries/get_issues.query.graphql | 6 ---- .../queries/get_issues_counts.query.graphql | 14 ---------- .../concerns/issue_resolver_arguments.rb | 6 ---- app/graphql/types/merge_request_type.rb | 1 + app/services/ci/register_job_service.rb | 16 +++++------ .../ci_pending_builds_table_resiliency.yml | 8 ------ .../attr_encrypted_no_db_connection.rb | 19 ++----------- doc/api/graphql/index.md | 2 +- doc/api/graphql/reference/index.md | 8 ------ doc/ci/caching/index.md | 6 ++-- lib/gitlab/ci/config/extendable/entry.rb | 2 +- spec/frontend/issues/list/mock_data.js | 8 ------ .../graphql/resolvers/issues_resolver_spec.rb | 28 ------------------- 15 files changed, 14 insertions(+), 138 deletions(-) delete mode 100644 config/feature_flags/development/ci_pending_builds_table_resiliency.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b3207c1923f..f3fe41bc40f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -23,12 +23,6 @@ Lint/UselessMethodDefinition: Naming/RescuedExceptionsVariableName: Enabled: false -# Offense count: 1 -# Cop supports --auto-correct. -Performance/AncestorsInclude: - Exclude: - - 'lib/gitlab/ci/config/extendable/entry.rb' - # Offense count: 29 # Configuration parameters: MinSize. Performance/CollectionLiteralInLoop: diff --git a/app/assets/javascripts/issues/list/constants.js b/app/assets/javascripts/issues/list/constants.js index 4541191730a..d4e2cdcfb1d 100644 --- a/app/assets/javascripts/issues/list/constants.js +++ b/app/assets/javascripts/issues/list/constants.js @@ -132,8 +132,6 @@ export const TOKEN_TYPE_CONFIDENTIAL = 'confidential'; export const TOKEN_TYPE_ITERATION = 'iteration'; export const TOKEN_TYPE_EPIC = 'epic_id'; export const TOKEN_TYPE_WEIGHT = 'weight'; -export const TOKEN_TYPE_CONTACT = 'crm_contact'; -export const TOKEN_TYPE_ORGANIZATION = 'crm_organization'; export const filters = { [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', - }, - }, - }, }; diff --git a/app/assets/javascripts/issues/list/queries/get_issues.query.graphql b/app/assets/javascripts/issues/list/queries/get_issues.query.graphql index dcc0db786b7..ec24ea7c56a 100644 --- a/app/assets/javascripts/issues/list/queries/get_issues.query.graphql +++ b/app/assets/javascripts/issues/list/queries/get_issues.query.graphql @@ -20,8 +20,6 @@ query getIssues( $releaseTag: [String!] $releaseTagWildcardId: ReleaseTagWildcardId $types: [IssueType!] - $crmContactId: String - $crmOrganizationId: String $not: NegatedIssueFilterInput $beforeCursor: String $afterCursor: String @@ -45,8 +43,6 @@ query getIssues( milestoneWildcardId: $milestoneWildcardId myReactionEmoji: $myReactionEmoji types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not before: $beforeCursor after: $afterCursor @@ -80,8 +76,6 @@ query getIssues( releaseTag: $releaseTag releaseTagWildcardId: $releaseTagWildcardId types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not before: $beforeCursor after: $afterCursor diff --git a/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql b/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql index c1aee772167..58e7ce32e7c 100644 --- a/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql +++ b/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql @@ -14,8 +14,6 @@ query getIssuesCount( $releaseTag: [String!] $releaseTagWildcardId: ReleaseTagWildcardId $types: [IssueType!] - $crmContactId: String - $crmOrganizationId: String $not: NegatedIssueFilterInput ) { group(fullPath: $fullPath) @skip(if: $isProject) { @@ -34,8 +32,6 @@ query getIssuesCount( milestoneWildcardId: $milestoneWildcardId myReactionEmoji: $myReactionEmoji types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not ) { count @@ -54,8 +50,6 @@ query getIssuesCount( milestoneWildcardId: $milestoneWildcardId myReactionEmoji: $myReactionEmoji types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not ) { count @@ -74,8 +68,6 @@ query getIssuesCount( milestoneWildcardId: $milestoneWildcardId myReactionEmoji: $myReactionEmoji types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not ) { count @@ -98,8 +90,6 @@ query getIssuesCount( releaseTag: $releaseTag releaseTagWildcardId: $releaseTagWildcardId types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not ) { count @@ -119,8 +109,6 @@ query getIssuesCount( releaseTag: $releaseTag releaseTagWildcardId: $releaseTagWildcardId types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not ) { count @@ -140,8 +128,6 @@ query getIssuesCount( releaseTag: $releaseTag releaseTagWildcardId: $releaseTagWildcardId types: $types - crmContactId: $crmContactId - crmOrganizationId: $crmOrganizationId not: $not ) { count diff --git a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb index de44dbb26d7..432d6f48607 100644 --- a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb +++ b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb @@ -68,12 +68,6 @@ module IssueResolverArguments description: 'Negated arguments.', prepare: ->(negated_args, ctx) { negated_args.to_h }, 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 def resolve_with_lookahead(**args) diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index 86b8fe50264..cc3df474bef 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -94,6 +94,7 @@ module Types method: :public_merge_status, null: true, description: 'Merge status of the merge request.' 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.' field :rebase_commit_sha, GraphQL::Types::String, null: true, description: 'Rebase commit SHA of the merge request.' diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 6c9044b5089..8969b95b81f 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -157,15 +157,13 @@ module Ci unless build.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 - # `ci_pending_builds` table, we need to respond with 409 to retry - # this operation. - # - if ::Ci::UpdateBuildQueueService.new.remove!(build) - return Result.new(nil, nil, false) - end + ## + # 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 + # this operation. + # + if ::Ci::UpdateBuildQueueService.new.remove!(build) + return Result.new(nil, nil, false) end return diff --git a/config/feature_flags/development/ci_pending_builds_table_resiliency.yml b/config/feature_flags/development/ci_pending_builds_table_resiliency.yml deleted file mode 100644 index 2e53bf2c9a1..00000000000 --- a/config/feature_flags/development/ci_pending_builds_table_resiliency.yml +++ /dev/null @@ -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 diff --git a/config/initializers/attr_encrypted_no_db_connection.rb b/config/initializers/attr_encrypted_no_db_connection.rb index e46ee9f8036..d9e943bd249 100644 --- a/config/initializers/attr_encrypted_no_db_connection.rb +++ b/config/initializers/attr_encrypted_no_db_connection.rb @@ -1,5 +1,7 @@ # 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 Adapters module ActiveRecord @@ -11,23 +13,6 @@ module AttrEncrypted false 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 # The attr_encrypted gem is not actively maintained diff --git a/doc/api/graphql/index.md b/doc/api/graphql/index.md index 457b083c217..2ad29e8cb45 100644 --- a/doc/api/graphql/index.md +++ b/doc/api/graphql/index.md @@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w # 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 request the exact data you need, and therefore limit the number of requests you need. diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 3263b4a0920..dae58ff1f93 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -11556,8 +11556,6 @@ four standard [pagination arguments](#connection-pagination-arguments): | `confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | `createdAfter` | [`Time`](#time) | Issues created after this date. | | `createdBefore` | [`Time`](#time) | Issues created before this date. | -| `crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. | -| `crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. | | `epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. | | `iid` | [`String`](#string) | IID of the issue. For example, "1". | | `iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | @@ -14793,8 +14791,6 @@ Returns [`Issue`](#issue). | `confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | `createdAfter` | [`Time`](#time) | Issues created after this date. | | `createdBefore` | [`Time`](#time) | Issues created before this date. | -| `crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. | -| `crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. | | `epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. | | `iid` | [`String`](#string) | IID of the issue. For example, "1". | | `iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | @@ -14835,8 +14831,6 @@ Returns [`IssueStatusCountsType`](#issuestatuscountstype). | `confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | `createdAfter` | [`Time`](#time) | Issues created after this date. | | `createdBefore` | [`Time`](#time) | Issues created before this date. | -| `crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. | -| `crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. | | `iid` | [`String`](#string) | IID of the issue. For example, "1". | | `iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | | `labelName` | [`[String]`](#string) | Labels applied to this issue. | @@ -14874,8 +14868,6 @@ four standard [pagination arguments](#connection-pagination-arguments): | `confidential` | [`Boolean`](#boolean) | Filter for confidential issues. If "false", excludes confidential issues. If "true", returns only confidential issues. | | `createdAfter` | [`Time`](#time) | Issues created after this date. | | `createdBefore` | [`Time`](#time) | Issues created before this date. | -| `crmContactId` | [`String`](#string) | ID of a contact assigned to the issues. | -| `crmOrganizationId` | [`String`](#string) | ID of an organization assigned to the issues. | | `epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. | | `iid` | [`String`](#string) | IID of the issue. For example, "1". | | `iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. | diff --git a/doc/ci/caching/index.md b/doc/ci/caching/index.md index 25271864895..2b41694bebb 100644 --- a/doc/ci/caching/index.md +++ b/doc/ci/caching/index.md @@ -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 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). -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` and `feature`, then the following table represents the resulting cache keys: diff --git a/lib/gitlab/ci/config/extendable/entry.rb b/lib/gitlab/ci/config/extendable/entry.rb index 0001a259281..169d329fe02 100644 --- a/lib/gitlab/ci/config/extendable/entry.rb +++ b/lib/gitlab/ci/config/extendable/entry.rb @@ -99,7 +99,7 @@ module Gitlab end def circular_dependency? - ancestors.include?(key) + ancestors.include?(key) # rubocop:disable Performance/AncestorsInclude end def unknown_extensions diff --git a/spec/frontend/issues/list/mock_data.js b/spec/frontend/issues/list/mock_data.js index 46f342cc673..b1a135ceb18 100644 --- a/spec/frontend/issues/list/mock_data.js +++ b/spec/frontend/issues/list/mock_data.js @@ -146,8 +146,6 @@ export const locationSearch = [ 'not[epic_id]=34', 'weight=1', 'not[weight]=3', - 'crm_contact_id=123', - 'crm_organization_id=456', ].join('&'); export const locationSearchWithSpecialValues = [ @@ -196,8 +194,6 @@ export const filteredTokens = [ { type: 'epic_id', value: { data: '34', operator: OPERATOR_IS_NOT } }, { type: 'weight', value: { data: '1', operator: OPERATOR_IS } }, { 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: 'issues' } }, ]; @@ -226,8 +222,6 @@ export const apiParams = { iterationId: ['4', '12'], epicId: '12', weight: '1', - crmContactId: '123', - crmOrganizationId: '456', not: { authorUsername: 'marge', assigneeUsernames: ['patty', 'selma'], @@ -276,8 +270,6 @@ export const urlParams = { 'not[epic_id]': '34', weight: '1', 'not[weight]': '3', - crm_contact_id: '123', - crm_organization_id: '456', }; export const urlParamsWithSpecialValues = { diff --git a/spec/graphql/resolvers/issues_resolver_spec.rb b/spec/graphql/resolvers/issues_resolver_spec.rb index 3569244e514..81aeee0a3d2 100644 --- a/spec/graphql/resolvers/issues_resolver_spec.rb +++ b/spec/graphql/resolvers/issues_resolver_spec.rb @@ -389,34 +389,6 @@ RSpec.describe Resolvers::IssuesResolver do 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 context 'when sorting by created' do it 'sorts issues ascending' do