Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-03-17 03:09:27 +00:00
parent d43aaf286f
commit 9345f69894
14 changed files with 73 additions and 32 deletions

View file

@ -456,7 +456,7 @@ group :ed25519 do
end
# Gitaly GRPC protocol definitions
gem 'gitaly', '~> 1.86.0'
gem 'gitaly', '~> 12.9.0.pre.rc4'
gem 'grpc', '~> 1.24.0'

View file

@ -366,7 +366,7 @@ GEM
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
git (1.5.0)
gitaly (1.86.0)
gitaly (12.9.0.pre.rc4)
grpc (~> 1.0)
github-markup (1.7.0)
gitlab-chronic (0.10.5)
@ -1228,7 +1228,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
gitaly (~> 1.86.0)
gitaly (~> 12.9.0.pre.rc4)
github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5)
gitlab-derailed_benchmarks

View file

@ -66,7 +66,13 @@ class Project < ApplicationRecord
default_value_for :archived, false
default_value_for :resolve_outdated_diff_discussions, false
default_value_for :container_registry_enabled, gitlab_config_features.container_registry
default_value_for(:repository_storage) { Gitlab::CurrentSettings.pick_repository_storage }
default_value_for(:repository_storage) do
# We need to ensure application settings are fresh when we pick
# a repository storage to use.
Gitlab::CurrentSettings.expire_current_application_settings
Gitlab::CurrentSettings.pick_repository_storage
end
default_value_for(:shared_runners_enabled) { Gitlab::CurrentSettings.shared_runners_enabled }
default_value_for :issues_enabled, gitlab_config_features.issues
default_value_for :merge_requests_enabled, gitlab_config_features.merge_requests

View file

@ -1061,8 +1061,7 @@ class Repository
end
def squash(user, merge_request, message)
raw.squash(user, merge_request.id, branch: merge_request.target_branch,
start_sha: merge_request.diff_start_sha,
raw.squash(user, merge_request.id, start_sha: merge_request.diff_start_sha,
end_sha: merge_request.diff_head_sha,
author: merge_request.author,
message: message)

View file

@ -0,0 +1,5 @@
---
title: Upgrade Gitaly gem and fix UserSquash RPC usage
merge_request: 27372
author:
type: other

View file

@ -0,0 +1,5 @@
---
title: Ensure freshness of settings with project creation
merge_request: 27156
author:
type: fixed

View file

@ -15,7 +15,7 @@ taken to protect the users.
NOTE: **Note:**
[Shared runners on GitLab.com](../quick_start/README.md#shared-runners) do not
provide an interactive web terminal. Follow [this
issue](https://gitlab.com/gitlab-org/gitlab-foss/issues/52611) for progress on
issue](https://gitlab.com/gitlab-org/gitlab/-/issues/24674) for progress on
adding support. For groups and projects hosted on GitLab.com, interactive web
terminals are available when using your own group or project runner.

View file

@ -628,8 +628,17 @@ do not use this option until further notice.
### Links to internal documentation
- To link to internal documentation, use relative links, not absolute URLs.
Use `../` to navigate to high-level directories. Links should not refer to root.
NOTE: **Note:**
_Internal_ refers to documentation in the same project. When linking to documentation in
separate projects (for example, linking to Omnibus docs from GitLab docs), you must use absolute
URLs.
To link to internal documentation:
- Use relative links to Markdown files in the same repository.
- Do not use absolute URLs or URLs from `docs.gitlab.com`.
- Use `../` to navigate to higher-level directories.
- Do not link relative to root. For example, `/ee/user/gitlab_com/index.md`.
Don't:
@ -652,8 +661,7 @@ do not use this option until further notice.
- `../../issues/tags.md`
- `../../issues/tags.md#stages`
- Using the Markdown extension is necessary for the [`/help`](index.md#gitlab-help)
section of GitLab.
- Use the Markdown extension for the [`/help`](index.md#gitlab-help) section of GitLab.
### Links requiring permissions

View file

@ -79,11 +79,11 @@ Marked stuck import jobs as failed. JIDs: xyz
| Problem | Possible solutions |
| -------- | -------- |
| [Slow JSON](https://gitlab.com/gitlab-org/gitlab-foss/issues/54084) loading/dumping models from the database | [split the worker](https://gitlab.com/gitlab-org/gitlab-foss/issues/54085) |
| [Slow JSON](https://gitlab.com/gitlab-org/gitlab/-/issues/25251) loading/dumping models from the database | [split the worker](https://gitlab.com/gitlab-org/gitlab/-/issues/25252) |
| | Batch export
| | Optimize SQL
| | Move away from `ActiveRecord` callbacks (difficult)
| High memory usage (see also some [analysis](https://gitlab.com/gitlab-org/gitlab-foss/issues/35389) | DB Commit sweet spot that uses less memory |
| High memory usage (see also some [analysis](https://gitlab.com/gitlab-org/gitlab/-/issues/18857) | DB Commit sweet spot that uses less memory |
| | [Netflix Fast JSON API](https://github.com/Netflix/fast_jsonapi) may help |
| | Batch reading/writing to disk and any SQL

View file

@ -842,10 +842,9 @@ module Gitlab
end
end
def squash(user, squash_id, branch:, start_sha:, end_sha:, author:, message:)
def squash(user, squash_id, start_sha:, end_sha:, author:, message:)
wrapped_gitaly_errors do
gitaly_operation_client.user_squash(user, squash_id, branch,
start_sha, end_sha, author, message)
gitaly_operation_client.user_squash(user, squash_id, start_sha, end_sha, author, message)
end
end

View file

@ -248,12 +248,11 @@ module Gitlab
request_enum.close
end
def user_squash(user, squash_id, branch, start_sha, end_sha, author, message)
def user_squash(user, squash_id, start_sha, end_sha, author, message)
request = Gitaly::UserSquashRequest.new(
repository: @gitaly_repo,
user: Gitlab::Git::User.from_gitlab(user).to_gitaly,
squash_id: squash_id.to_s,
branch: encode_binary(branch),
start_sha: start_sha,
end_sha: end_sha,
author: Gitlab::Git::User.from_gitlab(author).to_gitaly,

View file

@ -50,7 +50,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end
end
context 'with application settings and admin users' do
context 'with application settings and admin users', :request_store do
let(:project) { result[:project] }
let(:group) { result[:group] }
let(:application_setting) { Gitlab::CurrentSettings.current_application_settings }
@ -58,8 +58,9 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
let!(:user) { create(:user, :admin) }
before do
allow(ApplicationSetting).to receive(:current_without_cache) { application_setting }
application_setting.allow_local_requests_from_web_hooks_and_services = true
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
application_setting.update(allow_local_requests_from_web_hooks_and_services: true)
end
shared_examples 'has prometheus service' do |listen_address|
@ -130,12 +131,17 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
it 'saves the project id' do
expect(result[:status]).to eq(:success)
expect(application_setting.self_monitoring_project_id).to eq(project.id)
expect(application_setting.reload.self_monitoring_project_id).to eq(project.id)
end
it 'expires application_setting cache' do
expect(Gitlab::CurrentSettings).to receive(:expire_current_application_settings)
it 'creates a Prometheus service' do
expect(result[:status]).to eq(:success)
services = result[:project].reload.services
expect(services.count).to eq(1)
# Ensures PrometheusService#self_monitoring_project? is true
expect(services.first.allow_local_api_url?).to be_truthy
end
it 'creates an environment for the project' do
@ -158,8 +164,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end
it 'returns error when saving project ID fails' do
allow(application_setting).to receive(:update).and_call_original
allow(application_setting).to receive(:update)
allow(subject.application_settings).to receive(:update).and_call_original
allow(subject.application_settings).to receive(:update)
.with(self_monitoring_project_id: anything)
.and_return(false)
@ -175,8 +181,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
let(:existing_project) { create(:project, namespace: existing_group) }
before do
application_setting.instance_administrators_group_id = existing_group.id
application_setting.self_monitoring_project_id = existing_project.id
application_setting.update(instance_administrators_group_id: existing_group.id,
self_monitoring_project_id: existing_project.id)
end
it 'returns success' do
@ -189,7 +195,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
context 'when local requests from hooks and services are not allowed' do
before do
application_setting.allow_local_requests_from_web_hooks_and_services = false
application_setting.update(allow_local_requests_from_web_hooks_and_services: false)
end
it_behaves_like 'has prometheus service', 'http://localhost:9090'

View file

@ -274,7 +274,6 @@ describe Gitlab::GitalyClient::OperationService do
end
describe '#user_squash' do
let(:branch_name) { 'my-branch' }
let(:squash_id) { '1' }
let(:start_sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
let(:end_sha) { '54cec5282aa9f21856362fe321c800c236a61615' }
@ -284,7 +283,6 @@ describe Gitlab::GitalyClient::OperationService do
repository: repository.gitaly_repository,
user: gitaly_user,
squash_id: squash_id.to_s,
branch: branch_name,
start_sha: start_sha,
end_sha: end_sha,
author: gitaly_user,
@ -295,7 +293,7 @@ describe Gitlab::GitalyClient::OperationService do
let(:response) { Gitaly::UserSquashResponse.new(squash_sha: squash_sha) }
subject do
client.user_squash(user, squash_id, branch_name, start_sha, end_sha, user, commit_message)
client.user_squash(user, squash_id, start_sha, end_sha, user, commit_message)
end
it 'sends a user_squash message and returns the squash sha' do

View file

@ -1401,6 +1401,22 @@ describe Project do
expect(project.repository_storage).to eq('picked')
end
it 'picks from the latest available storage', :request_store do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
Gitlab::CurrentSettings.current_application_settings
settings = ApplicationSetting.last
settings.repository_storages = %w(picked)
settings.save!
expect(Gitlab::CurrentSettings.repository_storages).to eq(%w(default))
project
expect(project.repository.storage).to eq('picked')
expect(Gitlab::CurrentSettings.repository_storages).to eq(%w(picked))
end
end
context 'shared runners by default' do