Commit 57a32c54 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '330272-remove-omit-commit-sha-ff' into 'master'

Remove omit_commit_sha feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!64421
parents c4b61d45 05b4762c
---
name: ci_pipeline_status_omit_commit_sha_in_cache_key
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33712
rollout_issue_url:
milestone: '13.2'
type: development
group: group::pipeline execution
default_enabled: true
...@@ -50,8 +50,6 @@ module Gitlab ...@@ -50,8 +50,6 @@ module Gitlab
def load_status def load_status
return if loaded? return if loaded?
return unless Gitlab::Ci::Features.pipeline_status_omit_commit_sha_in_cache_key?(project) || commit
if has_cache? if has_cache?
load_from_cache load_from_cache
else else
...@@ -119,11 +117,7 @@ module Gitlab ...@@ -119,11 +117,7 @@ module Gitlab
end end
def cache_key def cache_key
if Gitlab::Ci::Features.pipeline_status_omit_commit_sha_in_cache_key?(project) "#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:project:#{project.id}:pipeline_status"
"#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:project:#{project.id}:pipeline_status"
else
"#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:project:#{project.id}:pipeline_status:#{commit&.sha}"
end
end end
def commit def commit
......
...@@ -14,10 +14,6 @@ module Gitlab ...@@ -14,10 +14,6 @@ module Gitlab
::Feature.enabled?(:ci_pipeline_latest, default_enabled: true) ::Feature.enabled?(:ci_pipeline_latest, default_enabled: true)
end end
def self.pipeline_status_omit_commit_sha_in_cache_key?(project)
Feature.enabled?(:ci_pipeline_status_omit_commit_sha_in_cache_key, project, default_enabled: true)
end
# NOTE: The feature flag `disallow_to_create_merge_request_pipelines_in_target_project` # NOTE: The feature flag `disallow_to_create_merge_request_pipelines_in_target_project`
# is a safe switch to disable the feature for a particular project when something went wrong, # is a safe switch to disable the feature for a particular project when something went wrong,
# therefore it's not supposed to be enabled by default. # therefore it's not supposed to be enabled by default.
......
...@@ -83,24 +83,8 @@ RSpec.describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cac ...@@ -83,24 +83,8 @@ RSpec.describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cac
expect(pipeline_status).not_to be_has_cache expect(pipeline_status).not_to be_has_cache
end end
context 'ci_pipeline_status_omit_commit_sha_in_cache_key is enabled' do it 'makes a Gitaly call' do
before do expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(1)
stub_feature_flags(ci_pipeline_status_omit_commit_sha_in_cache_key: project)
end
it 'makes a Gitaly call' do
expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(1)
end
end
context 'ci_pipeline_status_omit_commit_sha_in_cache_key is disabled' do
before do
stub_feature_flags(ci_pipeline_status_omit_commit_sha_in_cache_key: false)
end
it 'makes a Gitaly calls' do
expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(1)
end
end end
end end
...@@ -111,24 +95,8 @@ RSpec.describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cac ...@@ -111,24 +95,8 @@ RSpec.describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cac
expect(pipeline_status).to be_has_cache expect(pipeline_status).to be_has_cache
end end
context 'ci_pipeline_status_omit_commit_sha_in_cache_key is enabled' do it 'makes no Gitaly calls' do
before do expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(0)
stub_feature_flags(ci_pipeline_status_omit_commit_sha_in_cache_key: project)
end
it 'makes no Gitaly calls' do
expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(0)
end
end
context 'ci_pipeline_status_omit_commit_sha_in_cache_key is disabled' do
before do
stub_feature_flags(ci_pipeline_status_omit_commit_sha_in_cache_key: false)
end
it 'makes a Gitaly calls' do
expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(1)
end
end end
end end
end end
......
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