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
def load_status
return if loaded?
return unless Gitlab::Ci::Features.pipeline_status_omit_commit_sha_in_cache_key?(project) || commit
if has_cache?
load_from_cache
else
......@@ -119,11 +117,7 @@ module Gitlab
end
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"
else
"#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:project:#{project.id}:pipeline_status:#{commit&.sha}"
end
"#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:project:#{project.id}:pipeline_status"
end
def commit
......
......@@ -14,10 +14,6 @@ module Gitlab
::Feature.enabled?(:ci_pipeline_latest, default_enabled: true)
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`
# 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.
......
......@@ -83,24 +83,8 @@ RSpec.describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cac
expect(pipeline_status).not_to be_has_cache
end
context 'ci_pipeline_status_omit_commit_sha_in_cache_key is enabled' do
before do
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
it 'makes a Gitaly call' do
expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(1)
end
end
......@@ -111,24 +95,8 @@ RSpec.describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cac
expect(pipeline_status).to be_has_cache
end
context 'ci_pipeline_status_omit_commit_sha_in_cache_key is enabled' do
before do
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
it 'makes no Gitaly calls' do
expect { pipeline_status.load_status }.to change { Gitlab::GitalyClient.get_request_count }.by(0)
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