diff --git a/app/models/project.rb b/app/models/project.rb index 7f1c3cd475c2f31f5e02a6974870d435978900ab..8cf4795d97ec96ef2027a53c5525a78fe4135f1e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2390,12 +2390,8 @@ def has_ci? end def has_ci_config_file? - if ::Feature.enabled?(:ci_refactor_has_ci_config_file, self, type: :gitlab_com_derisk) - strong_memoize(:has_ci_config_file) do - ci_config_for('HEAD').present? - end - else - repository.gitlab_ci_yml.present? + strong_memoize(:has_ci_config_file) do + ci_config_for('HEAD').present? end end diff --git a/app/models/repository.rb b/app/models/repository.rb index cd3c4f7500ffaa19a85658a3ea8b43c049a52d86..1c052db44847dac14d69220604530fc671bfcc7e 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -675,7 +675,6 @@ def gitignore cache_method :gitignore # Deprecated, use `project.has_ci_config_file?` instead. - # Can be removed with the FF `ci_refactor_has_ci_config_file`. def gitlab_ci_yml file_on_head(:gitlab_ci) end diff --git a/config/feature_flags/gitlab_com_derisk/ci_refactor_has_ci_config_file.yml b/config/feature_flags/gitlab_com_derisk/ci_refactor_has_ci_config_file.yml deleted file mode 100644 index b083a7873f1ce84040db60bfe7e1397273048110..0000000000000000000000000000000000000000 --- a/config/feature_flags/gitlab_com_derisk/ci_refactor_has_ci_config_file.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -name: ci_refactor_has_ci_config_file -feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/26169 -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141990 -rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/17406 -milestone: '16.9' -group: group::pipeline authoring -type: gitlab_com_derisk -default_enabled: false diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 3d5ccbc6feb177950e1f15481bb2a3b4c4078608..a275f080b1fd2685aad34250cd544c958f5d1ff9 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -5347,57 +5347,32 @@ def has_external_wiki describe '#has_ci_config_file?' do subject(:has_ci_config_file) { project.has_ci_config_file? } - # Extract these from `shared_examples` when the FF ci_refactor_has_ci_config_file is removed. - shared_examples '#has_ci_config_file?' do - context 'when the repository does not exist' do - let_it_be(:project) { create(:project) } - - it { is_expected.to be_falsey } - end - - context 'when the repository has a .gitlab-ci.yml file' do - let_it_be(:project) { create(:project, :small_repo, files: { '.gitlab-ci.yml' => 'test' }) } + context 'when the repository does not exist' do + let_it_be(:project) { create(:project) } - it { is_expected.to be_truthy } - end + it { is_expected.to be_falsey } + end - context 'when the repository does not have a .gitlab-ci.yml file' do - let_it_be(:project) { create(:project, :small_repo, files: { 'README.md' => 'hello' }) } + context 'when the repository has a .gitlab-ci.yml file' do + let_it_be(:project) { create(:project, :small_repo, files: { '.gitlab-ci.yml' => 'test' }) } - it { is_expected.to be_falsey } - end + it { is_expected.to be_truthy } end - context 'when the FF ci_refactor_has_ci_config_file is enabled' do - it_behaves_like '#has_ci_config_file?' - - context 'when the repository has a custom CI config file' do - let_it_be(:project) { create(:project, :small_repo, files: { 'my_ci_file.yml' => 'test' }) } + context 'when the repository does not have a .gitlab-ci.yml file' do + let_it_be(:project) { create(:project, :small_repo, files: { 'README.md' => 'hello' }) } - before do - project.ci_config_path = 'my_ci_file.yml' - end - - it { is_expected.to be_truthy } - end + it { is_expected.to be_falsey } end - context 'when the FF ci_refactor_has_ci_config_file is disabled' do + context 'when the repository has a custom CI config file' do + let_it_be(:project) { create(:project, :small_repo, files: { 'my_ci_file.yml' => 'test' }) } + before do - stub_feature_flags(ci_refactor_has_ci_config_file: false) + project.ci_config_path = 'my_ci_file.yml' end - it_behaves_like '#has_ci_config_file?' - - context 'when the repository has a custom CI config file' do - let_it_be(:project) { create(:project, :small_repo, files: { 'my_ci_file.yml' => 'test' }) } - - before do - project.ci_config_path = 'my_ci_file.yml' - end - - it { is_expected.to be_falsey } - end + it { is_expected.to be_truthy } end end