Skip to content
代码片段 群组 项目
未验证 提交 426062f0 编辑于 作者: Marius Bobin's avatar Marius Bobin 提交者: GitLab
浏览文件

Merge branch 'morefice/ff-ci-pipeline-variables-routing-table' into 'master'

Add FF to read from p_ci_pipeline_variables

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/143334



Merged-by: default avatarMarius Bobin <mbobin@gitlab.com>
Approved-by: default avatarPanos Kanellidis <pkanellidis@gitlab.com>
Approved-by: default avatarMarius Bobin <mbobin@gitlab.com>
Co-authored-by: default avatarMaxime Orefice <morefice@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -6,12 +6,17 @@ class PipelineVariable < Ci::ApplicationRecord
include Ci::HasVariable
include Ci::RawVariable
ROUTING_FEATURE_FLAG = :ci_partitioning_use_ci_pipeline_variables_routing_table
belongs_to :pipeline
self.primary_key = :id
self.sequence_name = :ci_pipeline_variables_id_seq
partitionable scope: :pipeline
partitionable scope: :pipeline, through: {
table: :p_ci_pipeline_variables,
flag: ROUTING_FEATURE_FLAG
}
alias_attribute :secret_value, :value
......
......@@ -34,7 +34,7 @@ def routing_table_enabled?
return false if routing_class?
Gitlab::SafeRequestStore.fetch(routing_table_name_flag) do
::Feature.enabled?(routing_table_name_flag, :request)
::Feature.enabled?(routing_table_name_flag, :request, type: :gitlab_com_derisk)
end
end
......
---
name: ci_partitioning_use_ci_pipeline_variables_routing_table
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/439069
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/143334
rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/17508
milestone: '16.9'
group: group::pipeline execution
type: gitlab_com_derisk
default_enabled: false
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Ci::PipelineVariable do
RSpec.describe Ci::PipelineVariable, feature_category: :continuous_integration do
subject { build(:ci_pipeline_variable) }
it_behaves_like "CI variable"
......@@ -38,4 +38,26 @@
end
end
end
describe 'routing table switch' do
context 'with ff disabled' do
before do
stub_feature_flags(ci_partitioning_use_ci_pipeline_variables_routing_table: false)
end
it 'uses the legacy table' do
expect(described_class.table_name).to eq('ci_pipeline_variables')
end
end
context 'with ff enabled' do
before do
stub_feature_flags(ci_partitioning_use_ci_pipeline_variables_routing_table: true)
end
it 'uses the routing table' do
expect(described_class.table_name).to eq('p_ci_pipeline_variables')
end
end
end
end
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Ci::Partitionable::Switch, :aggregate_failures do
RSpec.describe Ci::Partitionable::Switch, :aggregate_failures, feature_category: :continuous_integration do
let(:model) do
Class.new(Ci::ApplicationRecord) do
self.primary_key = :id
......@@ -71,7 +71,7 @@ def self.name
allow(Feature::Definition).to receive(:get).with(table_rollout_flag)
.and_return(
Feature::Definition.new("development/#{table_rollout_flag}.yml",
{ type: 'development', name: table_rollout_flag }
{ type: 'gitlab_com_derisk', name: table_rollout_flag }
)
)
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册