mirror of
https://github.com/gitlabhq/gitlabhq.git
synced 2025-08-13 14:33:08 +00:00
Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
variables:
|
||||
AUTO_BUILD_IMAGE_VERSION: 'v1.28.0'
|
||||
AUTO_BUILD_IMAGE_VERSION: 'v1.29.0'
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -1,5 +1,5 @@
|
||||
variables:
|
||||
AUTO_BUILD_IMAGE_VERSION: 'v1.28.0'
|
||||
AUTO_BUILD_IMAGE_VERSION: 'v1.29.0'
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -10,8 +10,11 @@ module Gitlab
|
||||
start_time = Gitlab::Metrics::System.monotonic_time
|
||||
retry_attempts = 0
|
||||
|
||||
# prevent scope override, see https://gitlab.com/gitlab-org/gitlab/-/issues/391186
|
||||
klass = subject.is_a?(ActiveRecord::Relation) ? subject.klass : subject.class
|
||||
|
||||
begin
|
||||
subject.transaction do
|
||||
klass.transaction do
|
||||
yield(subject)
|
||||
end
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
|
@ -505,7 +505,7 @@ namespace :gitlab do
|
||||
end
|
||||
|
||||
if existing_metadata['classes'] && existing_metadata['classes'].sort != table_metadata['classes'].sort
|
||||
existing_metadata['classes'] = table_metadata['classes']
|
||||
existing_metadata['classes'] = (existing_metadata['classes'] + table_metadata['classes']).uniq.sort
|
||||
outdated = true
|
||||
end
|
||||
|
||||
|
@ -37770,6 +37770,12 @@ msgstr ""
|
||||
msgid "ScanExecutionPolicy|A pipeline is run"
|
||||
msgstr ""
|
||||
|
||||
msgid "ScanExecutionPolicy|Add condition"
|
||||
msgstr ""
|
||||
|
||||
msgid "ScanExecutionPolicy|Conditions"
|
||||
msgstr ""
|
||||
|
||||
msgid "ScanExecutionPolicy|Ex, tag-name-1, tag-name-2"
|
||||
msgstr ""
|
||||
|
||||
|
@ -16,6 +16,19 @@ RSpec.describe Gitlab::OptimisticLocking do
|
||||
describe '#retry_lock' do
|
||||
let(:name) { 'optimistic_locking_spec' }
|
||||
|
||||
it 'does not change current_scope', :aggregate_failures do
|
||||
instance = Class.new { include Gitlab::OptimisticLocking }.new
|
||||
relation = pipeline.cancelable_statuses
|
||||
|
||||
expected_scope = Ci::Build.current_scope&.to_sql
|
||||
|
||||
instance.send(:retry_lock, relation, name: :test) do
|
||||
expect(Ci::Build.current_scope&.to_sql).to eq(expected_scope)
|
||||
end
|
||||
|
||||
expect(Ci::Build.current_scope&.to_sql).to eq(expected_scope)
|
||||
end
|
||||
|
||||
context 'when state changed successfully without retries' do
|
||||
subject do
|
||||
described_class.retry_lock(pipeline, name: name) do |lock_subject|
|
||||
|
@ -395,7 +395,7 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the dictionary files already exist' do
|
||||
context 'when a new model class is added to the codebase' do
|
||||
let(:table_class) do
|
||||
Class.new(ApplicationRecord) do
|
||||
self.table_name = 'table1'
|
||||
@ -410,7 +410,7 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor
|
||||
|
||||
table_metadata = {
|
||||
'table_name' => 'table1',
|
||||
'classes' => [],
|
||||
'classes' => ['TableClass'],
|
||||
'feature_categories' => [],
|
||||
'description' => nil,
|
||||
'introduced_by_url' => nil,
|
||||
@ -418,7 +418,7 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor
|
||||
}
|
||||
view_metadata = {
|
||||
'view_name' => 'view1',
|
||||
'classes' => [],
|
||||
'classes' => ['ViewClass'],
|
||||
'feature_categories' => [],
|
||||
'description' => nil,
|
||||
'introduced_by_url' => nil,
|
||||
@ -426,8 +426,8 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor
|
||||
}
|
||||
|
||||
before do
|
||||
stub_const('TableClass', table_class)
|
||||
stub_const('ViewClass', view_class)
|
||||
stub_const('TableClass1', table_class)
|
||||
stub_const('ViewClass1', view_class)
|
||||
|
||||
File.write(table_file_path, table_metadata.to_yaml)
|
||||
File.write(view_file_path, view_metadata.to_yaml)
|
||||
@ -435,14 +435,50 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor
|
||||
allow(model).to receive(:descendants).and_return([table_class, view_class])
|
||||
end
|
||||
|
||||
it 'update the dictionary content' do
|
||||
it 'appends new classes to the dictionary' do
|
||||
run_rake_task('gitlab:db:dictionary:generate')
|
||||
|
||||
table_metadata = YAML.safe_load(File.read(table_file_path))
|
||||
expect(table_metadata['classes']).to match_array(['TableClass'])
|
||||
expect(table_metadata['classes']).to match_array(%w[TableClass TableClass1])
|
||||
|
||||
view_metadata = YAML.safe_load(File.read(view_file_path))
|
||||
expect(view_metadata['classes']).to match_array(['ViewClass'])
|
||||
expect(view_metadata['classes']).to match_array(%w[ViewClass ViewClass1])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a model class is removed from the codebase' do
|
||||
table_metadata = {
|
||||
'table_name' => 'table1',
|
||||
'classes' => ['TableClass'],
|
||||
'feature_categories' => [],
|
||||
'description' => nil,
|
||||
'introduced_by_url' => nil,
|
||||
'milestone' => 14.3
|
||||
}
|
||||
view_metadata = {
|
||||
'view_name' => 'view1',
|
||||
'classes' => ['ViewClass'],
|
||||
'feature_categories' => [],
|
||||
'description' => nil,
|
||||
'introduced_by_url' => nil,
|
||||
'milestone' => 14.3
|
||||
}
|
||||
|
||||
before do
|
||||
File.write(table_file_path, table_metadata.to_yaml)
|
||||
File.write(view_file_path, view_metadata.to_yaml)
|
||||
|
||||
allow(model).to receive(:descendants).and_return([])
|
||||
end
|
||||
|
||||
it 'keeps the dictionary classes' do
|
||||
run_rake_task('gitlab:db:dictionary:generate')
|
||||
|
||||
table_metadata = YAML.safe_load(File.read(table_file_path))
|
||||
expect(table_metadata['classes']).to match_array(%w[TableClass])
|
||||
|
||||
view_metadata = YAML.safe_load(File.read(view_file_path))
|
||||
expect(view_metadata['classes']).to match_array(%w[ViewClass])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -46,13 +46,14 @@ module Tooling
|
||||
MSG
|
||||
|
||||
NEEDS_PACKAGE_AND_TEST_MESSAGE = <<~MSG
|
||||
The `e2e:package-and-test` job is not present or needs to be triggered manually. Please start the `e2e:package-and-test`
|
||||
job and re-run `danger-review`.
|
||||
The `e2e:package-and-test` job is not present or needs to be automatically triggered.
|
||||
Please ensure the job is present in the latest pipeline, if necessary, retry the `danger-review` job.
|
||||
Read the "QA e2e:package-and-test" section for more details.
|
||||
MSG
|
||||
|
||||
WARN_PACKAGE_AND_TEST_MESSAGE = <<~MSG
|
||||
The `e2e:package-and-test` job needs to succeed or have approval from a Software Engineer in Test. See the section below
|
||||
for more details.
|
||||
**The `e2e:package-and-test` job needs to succeed or have approval from a Software Engineer in Test.**
|
||||
Read the "QA e2e:package-and-test" section for more details.
|
||||
MSG
|
||||
|
||||
# rubocop:disable Style/SignalException
|
||||
|
Reference in New Issue
Block a user