From 149d9f73f14dd6c121fac9dadd53b90410e50984 Mon Sep 17 00:00:00 2001 From: drew cimino Date: Fri, 8 May 2020 20:35:44 -0400 Subject: [PATCH] Feature flag for variables with potentially long values --- app/models/ci/build.rb | 2 +- spec/models/ci/build_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index d51ffa70035df0..a79713b6747be3 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -568,7 +568,7 @@ def persisted_environment_variables def environment_changed_page_variables Gitlab::Ci::Variables::Collection.new.tap do |variables| - break variables unless environment_status + break variables unless environment_status && Feature.enabled?(:modifed_path_ci_variables, project) variables.append(key: 'CI_MERGE_REQUEST_CHANGED_PAGE_PATHS', value: environment_status.changed_paths.join(',')) variables.append(key: 'CI_MERGE_REQUEST_CHANGED_PAGE_URLS', value: environment_status.changed_urls.join(',')) diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 3a608391b2be77..7cb5eec11ed6a7 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2495,6 +2495,17 @@ end end end + + context 'with the :modified_path_ci_variables feature flag disabled' do + before do + stub_feature_flags(modified_path_ci_variables: false) + end + + it 'does not set CI_MERGE_REQUEST_CHANGED_PAGES_* variables' do + expect(subject.find { |var| var[:key] == 'CI_MERGE_REQUEST_CHANGED_PAGE_PATHS' }).to be_nil + expect(subject.find { |var| var[:key] == 'CI_MERGE_REQUEST_CHANGED_PAGE_URLS' }).to be_nil + end + end end context 'when build has user' do -- GitLab