Skip to content
代码片段 群组 项目
提交 be7883ca 编辑于 作者: 杨林's avatar 杨林
浏览文件

Merge branch 'main-jh' of https://jihulab.com/HimmaHorde/gitlab into main-jh

dawfwef
No related branches found
No related tags found
无相关合并请求
Pipeline #3379822 已失败
# Disable package-and-test-ee temp, we may bring it back later # Disable test-on-omnibus-ee temp, we may bring it back later
.qa:rules:package-and-test-ee: .qa:rules:test-on-omnibus-ee:
rules: rules:
- !reference [".not-run-if-jh", "rules"] - !reference [".not-run-if-jh", "rules"]
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
rules: rules:
- !reference [".not-run-if-jh", "rules"] - !reference [".not-run-if-jh", "rules"]
# Disable package-and-test-ce forever, we should not support ce edition # Disable test-on-omnibus-ce forever, we should not support ce edition
.qa:rules:package-and-test-ce: .qa:rules:test-on-omnibus-ce:
rules: rules:
- !reference [".not-run-if-jh", "rules"] - !reference [".not-run-if-jh", "rules"]
.qa:rules:package-and-test-nightly: .qa:rules:test-on-omnibus-nightly:
rules: rules:
- !reference [".not-run-if-jh", "rules"] - !reference [".not-run-if-jh", "rules"]
......
# Default variables for package-and-test # Default variables for test-on-omnibus
variables: variables:
REGISTRY_HOST: "registry.jihulab.com" REGISTRY_HOST: "registry.jihulab.com"
...@@ -8,7 +8,7 @@ variables: ...@@ -8,7 +8,7 @@ variables:
QA_LOG_LEVEL: "info" QA_LOG_LEVEL: "info"
QA_TESTS: "" QA_TESTS: ""
QA_FEATURE_FLAGS: "" QA_FEATURE_FLAGS: ""
# run all tests by default when package-and-test is included natively in other projects # run all tests by default when test-on-omnibus is included natively in other projects
# this will be overridden when selective test execution is used in gitlab canonical project # this will be overridden when selective test execution is used in gitlab canonical project
QA_RUN_ALL_TESTS: "true" QA_RUN_ALL_TESTS: "true"
USE_OLD_RUBY_VERSION: "true" USE_OLD_RUBY_VERSION: "true"
## 17.4.1 (2024-09-26)
JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md)
### Fixed (2 changes)
### Security (3 changes)
## 17.3.4 (2024-09-26)
JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md)
### Security (3 changes)
## 17.3.3 (2024-09-17) ## 17.3.3 (2024-09-17)
JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md) JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md)
...@@ -33,6 +48,11 @@ JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md) ...@@ -33,6 +48,11 @@ JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md)
### Security (4 changes) ### Security (4 changes)
## 17.2.8 (2024-09-26)
JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md)
### Security (3 changes)
## 17.2.7 (2024-09-18) ## 17.2.7 (2024-09-18)
JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md) JH changes only. For others see [CHANGELOG.md](../CHANGELOG.md)
......
...@@ -14,5 +14,29 @@ module MergeRequest ...@@ -14,5 +14,29 @@ module MergeRequest
include ContentValidateable include ContentValidateable
validates :title, :description, content_validation: true, if: :with_project_should_validate_content? validates :title, :description, content_validation: true, if: :with_project_should_validate_content?
end end
override :mergeable_ci_state?
def mergeable_ci_state?
return super unless ::MergeRequests::MonorepoService.monorepo_enabled?(self)
return super if diff_head_pipeline
# The following code logic refers to the Upstream code "MergeRequest#mergeable_ci_state?"
return true unless only_allow_merge_if_pipeline_succeeds? ||
(auto_merge_strategy == ::AutoMergeService::STRATEGY_MERGE_WHEN_CHECKS_PASS && has_ci_enabled?)
return false unless mono_central_pipeline
return true if project.allow_merge_on_skipped_pipeline?(inherit_group_setting: true) &&
mono_central_pipeline.skipped?
mono_central_pipeline.success?
end
private
def mono_central_pipeline
monorepo_service = ::MergeRequests::MonorepoService.new(project.root_ancestor, source_branch)
monorepo_service.central_pipeline(filter_by_precise_time_range: false)
end
end end
end end
...@@ -127,13 +127,14 @@ def cancel_lease! ...@@ -127,13 +127,14 @@ def cancel_lease!
Gitlab::ExclusiveLease.cancel(lease_key, lease_value) Gitlab::ExclusiveLease.cancel(lease_key, lease_value)
end end
def central_pipeline # "filter_by_precise_time_range" is used to solve the problem of circular references.
def central_pipeline(filter_by_precise_time_range: true)
return if ci_central_project.nil? return if ci_central_project.nil?
pipelines = ::Ci::PipelinesFinder.new( pipelines = ::Ci::PipelinesFinder.new(
ci_central_project, ci_central_project,
@root_group.owners.allow_cross_joins_across_databases(url: "https://jihulab.com/gitlab-cn/gitlab/-/issues/4002").first, @root_group.owners.allow_cross_joins_across_databases(url: "https://jihulab.com/gitlab-cn/gitlab/-/issues/4002").first,
central_pipeline_finder_params central_pipeline_finder_params(filter_by_precise_time_range)
).execute ).execute
pipelines.find do |pipeline| pipelines.find do |pipeline|
...@@ -213,10 +214,11 @@ def ci_central_project ...@@ -213,10 +214,11 @@ def ci_central_project
@ci_central_project ||= @root_group.projects.find_by_path(CI_CENTRAL_PROJECT_NAME) @ci_central_project ||= @root_group.projects.find_by_path(CI_CENTRAL_PROJECT_NAME)
end end
def central_pipeline_finder_params def central_pipeline_finder_params(filter_by_precise_time_range)
finder_params = { updated_after: merge_requests.first.created_at, ref: CI_CENTRAL_PROJECT_DEFAULT_BRANCH } finder_params = { updated_after: merge_requests.first.created_at, ref: CI_CENTRAL_PROJECT_DEFAULT_BRANCH }
if merge_requests_list_status == :merged || merge_requests_list_status == :closed if filter_by_precise_time_range &&
(merge_requests_list_status == :merged || merge_requests_list_status == :closed)
finder_params[:updated_before] = merged_at finder_params[:updated_before] = merged_at
end end
......
...@@ -7,4 +7,54 @@ ...@@ -7,4 +7,54 @@
it_behaves_like "content validation with project", :merge_request, :title it_behaves_like "content validation with project", :merge_request, :title
it_behaves_like "content validation with project", :merge_request, :description it_behaves_like "content validation with project", :merge_request, :description
end end
describe '#mergeable_ci_state?' do
let(:mono_central_pipeline) { build(:ci_empty_pipeline) }
let(:merge_request) { build(:merge_request, source_project: project) }
let(:project) { build(:project, :repository, only_allow_merge_if_pipeline_succeeds: true) }
context 'when monorepo is enabled' do
before do
allow(::MergeRequests::MonorepoService).to receive(:monorepo_enabled?).and_return(true)
end
context 'when no diff_head_pipeline is associated' do
before do
allow_any_instance_of(::MergeRequests::MonorepoService)
.to receive(:central_pipeline)
.and_return(mono_central_pipeline)
end
context 'and has no mono_central_pipeline associated' do
let(:mono_central_pipeline) { nil }
it { expect(merge_request.mergeable_ci_state?).to be_falsey }
end
context 'and a failed mono_central_pipeline is associated' do
before do
mono_central_pipeline.status = 'failed'
end
it { expect(merge_request.mergeable_ci_state?).to be_falsey }
end
context 'and a successful mono_central_pipeline is associated' do
before do
mono_central_pipeline.status = 'success'
end
it { expect(merge_request.mergeable_ci_state?).to be_truthy }
end
context 'and a skipped mono_central_pipeline is associated' do
before do
mono_central_pipeline.status = 'skipped'
end
it { expect(merge_request.mergeable_ci_state?).to be_falsey }
end
end
end
end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册