diff --git a/ee/app/services/ee/ci/pipeline_processing/atomic_processing_service.rb b/ee/app/services/ee/ci/pipeline_processing/atomic_processing_service.rb index 3e9b1e2271e34f362e5092fa23381ed5dad9389b..dad4726ccc32a05fa94c8e5fb1299dd1bb26b609 100644 --- a/ee/app/services/ee/ci/pipeline_processing/atomic_processing_service.rb +++ b/ee/app/services/ee/ci/pipeline_processing/atomic_processing_service.rb @@ -20,7 +20,7 @@ def status_of_previous_jobs_dag(job) # pipeline-policy-pre stage is not completed. This is to # ensure jobs can not circumvent enforces security checks. def calculate_status_based_on_policy_pre_stage(status, job) - return status if ensure_pipeline_policy_pre_stage_complete_disabled? + return status unless ensure_pipeline_policy_pre_stage_complete_enabled? return status unless policy_pre_stage || job_on_policy_pre_stage?(job) policy_pre_stage_completed? ? status : 'running' @@ -42,10 +42,11 @@ def policy_pre_stage end strong_memoize_attr :policy_pre_stage - def ensure_pipeline_policy_pre_stage_complete_disabled? - ::Feature.disabled?(:ensure_pipeline_policy_pre_stage_complete, pipeline.project) + def ensure_pipeline_policy_pre_stage_complete_enabled? + ::Feature.enabled?(:ensure_pipeline_policy_pre_stage_complete, pipeline.project) || + ::Feature.enabled?(:ensure_pipeline_policy_pre_stage_complete_group, pipeline.project.group) end - strong_memoize_attr :ensure_pipeline_policy_pre_stage_complete_disabled? + strong_memoize_attr :ensure_pipeline_policy_pre_stage_complete_enabled? end end end diff --git a/ee/config/feature_flags/beta/ensure_pipeline_policy_pre_stage_complete_group.yml b/ee/config/feature_flags/beta/ensure_pipeline_policy_pre_stage_complete_group.yml new file mode 100644 index 0000000000000000000000000000000000000000..e2123c9b139348117300698fa802553803e6d2ff --- /dev/null +++ b/ee/config/feature_flags/beta/ensure_pipeline_policy_pre_stage_complete_group.yml @@ -0,0 +1,9 @@ +--- +name: ensure_pipeline_policy_pre_stage_complete_group +feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/469256 +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/176192 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/500652 +milestone: '17.8' +group: group::security policies +type: beta +default_enabled: false diff --git a/ee/spec/services/ee/ci/pipeline_processing/atomic_processing_service_spec.rb b/ee/spec/services/ee/ci/pipeline_processing/atomic_processing_service_spec.rb index 81698f49dfa60cc4938f22355b23da02d8d15147..907211589425d8eae169645d0d42af3d859c7cc9 100644 --- a/ee/spec/services/ee/ci/pipeline_processing/atomic_processing_service_spec.rb +++ b/ee/spec/services/ee/ci/pipeline_processing/atomic_processing_service_spec.rb @@ -425,9 +425,10 @@ end end - context 'when the ensure_pipeline_policy_pre_stage_complete feature is disabled' do + context 'when both feature flags are disabled' do before do stub_feature_flags(ensure_pipeline_policy_pre_stage_complete: false) + stub_feature_flags(ensure_pipeline_policy_pre_stage_complete_group: false) end it 'creates a pipeline with policy_job and bridge_dag_job pending', :aggregate_failures do