Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-11-12 00:10:48 +00:00
parent c77ce73fa8
commit 5e13b3a9e5
8 changed files with 76 additions and 45 deletions

View File

@ -160,7 +160,7 @@ module IssuableActions
if issuable.is_a?(MergeRequest)
render_cached(discussions, with: discussion_serializer, cache_context: -> (_) { discussion_cache_context }, context: self)
elsif issuable.is_a?(Issue) && Feature.enabled?(:issue_discussions_http_cache, default_enabled: :yaml)
elsif issuable.is_a?(Issue)
render json: discussion_serializer.represent(discussions, context: self) if stale?(etag: [discussion_cache_context, discussions])
else
render json: discussion_serializer.represent(discussions, context: self)

View File

@ -1,8 +1,8 @@
---
name: issue_discussions_http_cache
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72589
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/343309
name: between_commits_via_list_commits
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74273
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/345458
milestone: '14.5'
type: development
group: group::project management
group: group::gitaly
default_enabled: false

View File

@ -0,0 +1,14 @@
- name: "defaultMergeCommitMessageWithDescription GraphQL API field will be removed in GitLab 15.0" # The name of the feature to be deprecated
announcement_milestone: "14.5" # The milestone when this feature was first announced as deprecated.
announcement_date: "2021-11-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
The GraphQL API field `defaultMergeCommitMessageWithDescription` has been deprecated and will be removed in GitLab 15.0. For projects with a commit message template set, it will ignore the template.
# The following items are not published on the docs page, but may be used in the future.
stage: # (optional - may be required in the future) String value of the stage that the feature was created in. e.g., Growth
tiers: # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate]
issue_url: # (optional) This is a link to the deprecation issue in GitLab
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed

View File

@ -8,6 +8,8 @@ class UpdateVulnerabilityOccurrencesLocation < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
return unless Gitlab.ee?
relation = Gitlab::BackgroundMigration::UpdateVulnerabilityOccurrencesLocation::Occurrence.where(location: nil)
queue_background_migration_jobs_by_range_at_intervals(relation,
MIGRATION_NAME,

View File

@ -157,6 +157,12 @@ Prior to 14.5, if you did not define the `AuthenticationType`, GitLab Runner cho
Announced: 2021-11-22
### defaultMergeCommitMessageWithDescription GraphQL API field will be removed in GitLab 15.0
The GraphQL API field `defaultMergeCommitMessageWithDescription` has been deprecated and will be removed in GitLab 15.0. For projects with a commit message template set, it will ignore the template.
Announced: 2021-11-22
## 15.2
### NFS for Git repository storage deprecated

View File

@ -205,6 +205,8 @@ module Gitlab
end
def between(from, to)
return list_commits(["^" + from, to], reverse: true) if Feature.enabled?(:between_commits_via_list_commits)
request = Gitaly::CommitsBetweenRequest.new(
repository: @gitaly_repo,
from: from,

View File

@ -112,15 +112,38 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
let(:from) { 'master' }
let(:to) { Gitlab::Git::EMPTY_TREE_ID }
it 'sends an RPC request' do
request = Gitaly::CommitsBetweenRequest.new(
repository: repository_message, from: from, to: to
)
context 'with between_commits_via_list_commits enabled' do
before do
stub_feature_flags(between_commits_via_list_commits: true)
end
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:commits_between)
.with(request, kind_of(Hash)).and_return([])
it 'sends an RPC request' do
request = Gitaly::ListCommitsRequest.new(
repository: repository_message, revisions: ["^" + from, to], reverse: true
)
described_class.new(repository).between(from, to)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:list_commits)
.with(request, kind_of(Hash)).and_return([])
described_class.new(repository).between(from, to)
end
end
context 'with between_commits_via_list_commits disabled' do
before do
stub_feature_flags(between_commits_via_list_commits: false)
end
it 'sends an RPC request' do
request = Gitaly::CommitsBetweenRequest.new(
repository: repository_message, from: from, to: to
)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:commits_between)
.with(request, kind_of(Hash)).and_return([])
described_class.new(repository).between(from, to)
end
end
end

View File

@ -14,31 +14,21 @@ RSpec.describe 'issue discussions' do
project.add_maintainer(user)
end
def get_discussions
get discussions_namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: issue.iid), headers: {
'If-None-Match' => @etag
}
context 'HTTP caching' do
def get_discussions
get discussions_namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: issue.iid), headers: {
'If-None-Match' => @etag
}
@etag = response.etag
end
@etag = response.etag
end
before do
sign_in(user)
get_discussions
end
shared_examples 'cache miss' do
it 'returns 200 and serializes JSON' do
expect(DiscussionSerializer).to receive(:new).and_call_original
before do
sign_in(user)
get_discussions
expect(response).to have_gitlab_http_status(:ok)
end
end
shared_examples 'cache hit' do
it 'returns 304 without serializing JSON' do
expect(DiscussionSerializer).not_to receive(:new)
@ -46,23 +36,17 @@ RSpec.describe 'issue discussions' do
expect(response).to have_gitlab_http_status(:not_modified)
end
end
context 'when issue_discussions_http_cache is disabled' do
before do
stub_feature_flags(issue_discussions_http_cache: false)
shared_examples 'cache miss' do
it 'returns 200 and serializes JSON' do
expect(DiscussionSerializer).to receive(:new).and_call_original
get_discussions
expect(response).to have_gitlab_http_status(:ok)
end
end
it_behaves_like 'cache miss'
end
context 'when issue_discussions_http_cache is enabled' do
before do
stub_feature_flags(issue_discussions_http_cache: true)
end
it_behaves_like 'cache hit'
context 'when user role changes' do
before do
project.add_guest(user)