Commit 9345f698 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent d43aaf28
...@@ -456,7 +456,7 @@ group :ed25519 do ...@@ -456,7 +456,7 @@ group :ed25519 do
end end
# Gitaly GRPC protocol definitions # Gitaly GRPC protocol definitions
gem 'gitaly', '~> 1.86.0' gem 'gitaly', '~> 12.9.0.pre.rc4'
gem 'grpc', '~> 1.24.0' gem 'grpc', '~> 1.24.0'
......
...@@ -366,7 +366,7 @@ GEM ...@@ -366,7 +366,7 @@ GEM
po_to_json (>= 1.0.0) po_to_json (>= 1.0.0)
rails (>= 3.2.0) rails (>= 3.2.0)
git (1.5.0) git (1.5.0)
gitaly (1.86.0) gitaly (12.9.0.pre.rc4)
grpc (~> 1.0) grpc (~> 1.0)
github-markup (1.7.0) github-markup (1.7.0)
gitlab-chronic (0.10.5) gitlab-chronic (0.10.5)
...@@ -1228,7 +1228,7 @@ DEPENDENCIES ...@@ -1228,7 +1228,7 @@ DEPENDENCIES
gettext (~> 3.2.2) gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0) gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3) gettext_i18n_rails_js (~> 1.3)
gitaly (~> 1.86.0) gitaly (~> 12.9.0.pre.rc4)
github-markup (~> 1.7.0) github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5) gitlab-chronic (~> 0.10.5)
gitlab-derailed_benchmarks gitlab-derailed_benchmarks
......
...@@ -66,7 +66,13 @@ class Project < ApplicationRecord ...@@ -66,7 +66,13 @@ class Project < ApplicationRecord
default_value_for :archived, false default_value_for :archived, false
default_value_for :resolve_outdated_diff_discussions, false default_value_for :resolve_outdated_diff_discussions, false
default_value_for :container_registry_enabled, gitlab_config_features.container_registry 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(:shared_runners_enabled) { Gitlab::CurrentSettings.shared_runners_enabled }
default_value_for :issues_enabled, gitlab_config_features.issues default_value_for :issues_enabled, gitlab_config_features.issues
default_value_for :merge_requests_enabled, gitlab_config_features.merge_requests default_value_for :merge_requests_enabled, gitlab_config_features.merge_requests
......
...@@ -1061,8 +1061,7 @@ class Repository ...@@ -1061,8 +1061,7 @@ class Repository
end end
def squash(user, merge_request, message) def squash(user, merge_request, message)
raw.squash(user, merge_request.id, branch: merge_request.target_branch, raw.squash(user, merge_request.id, start_sha: merge_request.diff_start_sha,
start_sha: merge_request.diff_start_sha,
end_sha: merge_request.diff_head_sha, end_sha: merge_request.diff_head_sha,
author: merge_request.author, author: merge_request.author,
message: message) message: message)
......
---
title: Upgrade Gitaly gem and fix UserSquash RPC usage
merge_request: 27372
author:
type: other
---
title: Ensure freshness of settings with project creation
merge_request: 27156
author:
type: fixed
...@@ -15,7 +15,7 @@ taken to protect the users. ...@@ -15,7 +15,7 @@ taken to protect the users.
NOTE: **Note:** NOTE: **Note:**
[Shared runners on GitLab.com](../quick_start/README.md#shared-runners) do not [Shared runners on GitLab.com](../quick_start/README.md#shared-runners) do not
provide an interactive web terminal. Follow [this 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 adding support. For groups and projects hosted on GitLab.com, interactive web
terminals are available when using your own group or project runner. terminals are available when using your own group or project runner.
......
...@@ -628,8 +628,17 @@ do not use this option until further notice. ...@@ -628,8 +628,17 @@ do not use this option until further notice.
### Links to internal documentation ### Links to internal documentation
- To link to internal documentation, use relative links, not absolute URLs. NOTE: **Note:**
Use `../` to navigate to high-level directories. Links should not refer to root. _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: Don't:
...@@ -652,8 +661,7 @@ do not use this option until further notice. ...@@ -652,8 +661,7 @@ do not use this option until further notice.
- `../../issues/tags.md` - `../../issues/tags.md`
- `../../issues/tags.md#stages` - `../../issues/tags.md#stages`
- Using the Markdown extension is necessary for the [`/help`](index.md#gitlab-help) - Use the Markdown extension for the [`/help`](index.md#gitlab-help) section of GitLab.
section of GitLab.
### Links requiring permissions ### Links requiring permissions
......
...@@ -79,11 +79,11 @@ Marked stuck import jobs as failed. JIDs: xyz ...@@ -79,11 +79,11 @@ Marked stuck import jobs as failed. JIDs: xyz
| Problem | Possible solutions | | 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 | | Batch export
| | Optimize SQL | | Optimize SQL
| | Move away from `ActiveRecord` callbacks (difficult) | | 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 | | | [Netflix Fast JSON API](https://github.com/Netflix/fast_jsonapi) may help |
| | Batch reading/writing to disk and any SQL | | Batch reading/writing to disk and any SQL
......
...@@ -842,10 +842,9 @@ module Gitlab ...@@ -842,10 +842,9 @@ module Gitlab
end end
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 wrapped_gitaly_errors do
gitaly_operation_client.user_squash(user, squash_id, branch, gitaly_operation_client.user_squash(user, squash_id, start_sha, end_sha, author, message)
start_sha, end_sha, author, message)
end end
end end
......
...@@ -248,12 +248,11 @@ module Gitlab ...@@ -248,12 +248,11 @@ module Gitlab
request_enum.close request_enum.close
end 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( request = Gitaly::UserSquashRequest.new(
repository: @gitaly_repo, repository: @gitaly_repo,
user: Gitlab::Git::User.from_gitlab(user).to_gitaly, user: Gitlab::Git::User.from_gitlab(user).to_gitaly,
squash_id: squash_id.to_s, squash_id: squash_id.to_s,
branch: encode_binary(branch),
start_sha: start_sha, start_sha: start_sha,
end_sha: end_sha, end_sha: end_sha,
author: Gitlab::Git::User.from_gitlab(author).to_gitaly, author: Gitlab::Git::User.from_gitlab(author).to_gitaly,
......
...@@ -50,7 +50,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -50,7 +50,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end end
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(:project) { result[:project] }
let(:group) { result[:group] } let(:group) { result[:group] }
let(:application_setting) { Gitlab::CurrentSettings.current_application_settings } let(:application_setting) { Gitlab::CurrentSettings.current_application_settings }
...@@ -58,8 +58,9 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -58,8 +58,9 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
let!(:user) { create(:user, :admin) } let!(:user) { create(:user, :admin) }
before do before do
allow(ApplicationSetting).to receive(:current_without_cache) { application_setting } stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
application_setting.allow_local_requests_from_web_hooks_and_services = true
application_setting.update(allow_local_requests_from_web_hooks_and_services: true)
end end
shared_examples 'has prometheus service' do |listen_address| shared_examples 'has prometheus service' do |listen_address|
...@@ -130,12 +131,17 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -130,12 +131,17 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
it 'saves the project id' do it 'saves the project id' do
expect(result[:status]).to eq(:success) 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 end
it 'expires application_setting cache' do it 'creates a Prometheus service' do
expect(Gitlab::CurrentSettings).to receive(:expire_current_application_settings)
expect(result[:status]).to eq(:success) 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 end
it 'creates an environment for the project' do it 'creates an environment for the project' do
...@@ -158,8 +164,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -158,8 +164,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end end
it 'returns error when saving project ID fails' do it 'returns error when saving project ID fails' do
allow(application_setting).to receive(:update).and_call_original allow(subject.application_settings).to receive(:update).and_call_original
allow(application_setting).to receive(:update) allow(subject.application_settings).to receive(:update)
.with(self_monitoring_project_id: anything) .with(self_monitoring_project_id: anything)
.and_return(false) .and_return(false)
...@@ -175,8 +181,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -175,8 +181,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
let(:existing_project) { create(:project, namespace: existing_group) } let(:existing_project) { create(:project, namespace: existing_group) }
before do before do
application_setting.instance_administrators_group_id = existing_group.id application_setting.update(instance_administrators_group_id: existing_group.id,
application_setting.self_monitoring_project_id = existing_project.id self_monitoring_project_id: existing_project.id)
end end
it 'returns success' do it 'returns success' do
...@@ -189,7 +195,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -189,7 +195,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
context 'when local requests from hooks and services are not allowed' do context 'when local requests from hooks and services are not allowed' do
before 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 end
it_behaves_like 'has prometheus service', 'http://localhost:9090' it_behaves_like 'has prometheus service', 'http://localhost:9090'
......
...@@ -274,7 +274,6 @@ describe Gitlab::GitalyClient::OperationService do ...@@ -274,7 +274,6 @@ describe Gitlab::GitalyClient::OperationService do
end end
describe '#user_squash' do describe '#user_squash' do
let(:branch_name) { 'my-branch' }
let(:squash_id) { '1' } let(:squash_id) { '1' }
let(:start_sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' } let(:start_sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
let(:end_sha) { '54cec5282aa9f21856362fe321c800c236a61615' } let(:end_sha) { '54cec5282aa9f21856362fe321c800c236a61615' }
...@@ -284,7 +283,6 @@ describe Gitlab::GitalyClient::OperationService do ...@@ -284,7 +283,6 @@ describe Gitlab::GitalyClient::OperationService do
repository: repository.gitaly_repository, repository: repository.gitaly_repository,
user: gitaly_user, user: gitaly_user,
squash_id: squash_id.to_s, squash_id: squash_id.to_s,
branch: branch_name,
start_sha: start_sha, start_sha: start_sha,
end_sha: end_sha, end_sha: end_sha,
author: gitaly_user, author: gitaly_user,
...@@ -295,7 +293,7 @@ describe Gitlab::GitalyClient::OperationService do ...@@ -295,7 +293,7 @@ describe Gitlab::GitalyClient::OperationService do
let(:response) { Gitaly::UserSquashResponse.new(squash_sha: squash_sha) } let(:response) { Gitaly::UserSquashResponse.new(squash_sha: squash_sha) }
subject do 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 end
it 'sends a user_squash message and returns the squash sha' do it 'sends a user_squash message and returns the squash sha' do
......
...@@ -1401,6 +1401,22 @@ describe Project do ...@@ -1401,6 +1401,22 @@ describe Project do
expect(project.repository_storage).to eq('picked') expect(project.repository_storage).to eq('picked')
end 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 end
context 'shared runners by default' do context 'shared runners by default' do
......
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