Commit 15155949 authored by Stan Hu's avatar Stan Hu

Merge branch '267492-change-to-enabled-sp-ff' into 'master'

Change from suggest_pipeline experiment to enabled ff

See merge request gitlab-org/gitlab!45926
parents b076da89 c25aeb86
...@@ -7,7 +7,6 @@ import initWebIdeLink from '~/pages/projects/shared/web_ide_link'; ...@@ -7,7 +7,6 @@ import initWebIdeLink from '~/pages/projects/shared/web_ide_link';
import '~/sourcegraph/load'; import '~/sourcegraph/load';
import PipelineTourSuccessModal from '~/blob/pipeline_tour_success_modal.vue'; import PipelineTourSuccessModal from '~/blob/pipeline_tour_success_modal.vue';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import { isExperimentEnabled } from '~/lib/utils/experimentation';
const createGitlabCiYmlVisualization = (containerId = '#js-blob-toggle-graph-preview') => { const createGitlabCiYmlVisualization = (containerId = '#js-blob-toggle-graph-preview') => {
const el = document.querySelector(containerId); const el = document.querySelector(containerId);
...@@ -74,7 +73,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -74,7 +73,7 @@ document.addEventListener('DOMContentLoaded', () => {
); );
} }
if (isExperimentEnabled('suggestPipeline')) { if (gon.features?.suggestPipeline) {
const successPipelineEl = document.querySelector('.js-success-pipeline-modal'); const successPipelineEl = document.querySelector('.js-success-pipeline-modal');
if (successPipelineEl) { if (successPipelineEl) {
......
...@@ -46,7 +46,6 @@ import GroupedTestReportsApp from '../reports/components/grouped_test_reports_ap ...@@ -46,7 +46,6 @@ import GroupedTestReportsApp from '../reports/components/grouped_test_reports_ap
import { setFaviconOverlay } from '../lib/utils/common_utils'; import { setFaviconOverlay } from '../lib/utils/common_utils';
import GroupedAccessibilityReportsApp from '../reports/accessibility_report/grouped_accessibility_reports_app.vue'; import GroupedAccessibilityReportsApp from '../reports/accessibility_report/grouped_accessibility_reports_app.vue';
import getStateQuery from './queries/get_state.query.graphql'; import getStateQuery from './queries/get_state.query.graphql';
import { isExperimentEnabled } from '~/lib/utils/experimentation';
export default { export default {
el: '#js-vue-mr-widget', el: '#js-vue-mr-widget',
...@@ -154,7 +153,7 @@ export default { ...@@ -154,7 +153,7 @@ export default {
}, },
shouldSuggestPipelines() { shouldSuggestPipelines() {
return ( return (
isExperimentEnabled('suggestPipeline') && gon.features?.suggestPipeline &&
!this.mr.hasCI && !this.mr.hasCI &&
this.mr.mergeRequestAddCiConfigPath && this.mr.mergeRequestAddCiConfigPath &&
!this.mr.isDismissedSuggestPipeline !this.mr.isDismissedSuggestPipeline
......
...@@ -33,7 +33,7 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -33,7 +33,7 @@ class Projects::BlobController < Projects::ApplicationController
before_action :set_last_commit_sha, only: [:edit, :update] before_action :set_last_commit_sha, only: [:edit, :update]
before_action only: :show do before_action only: :show do
push_frontend_experiment(:suggest_pipeline) push_frontend_feature_flag(:suggest_pipeline, default_enabled: true)
push_frontend_feature_flag(:gitlab_ci_yml_preview, @project, default_enabled: false) push_frontend_feature_flag(:gitlab_ci_yml_preview, @project, default_enabled: false)
end end
......
...@@ -27,7 +27,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -27,7 +27,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action :authenticate_user!, only: [:assign_related_issues] before_action :authenticate_user!, only: [:assign_related_issues]
before_action :check_user_can_push_to_source_branch!, only: [:rebase] before_action :check_user_can_push_to_source_branch!, only: [:rebase]
before_action only: [:show] do before_action only: [:show] do
push_frontend_experiment(:suggest_pipeline) push_frontend_feature_flag(:suggest_pipeline, default_enabled: true)
push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true) push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true)
push_frontend_feature_flag(:mr_commit_neighbor_nav, @project, default_enabled: true) push_frontend_feature_flag(:mr_commit_neighbor_nav, @project, default_enabled: true)
push_frontend_feature_flag(:multiline_comments, @project, default_enabled: true) push_frontend_feature_flag(:multiline_comments, @project, default_enabled: true)
......
...@@ -382,7 +382,7 @@ module BlobHelper ...@@ -382,7 +382,7 @@ module BlobHelper
end end
def show_suggest_pipeline_creation_celebration? def show_suggest_pipeline_creation_celebration?
experiment_enabled?(:suggest_pipeline) && Feature.enabled?(:suggest_pipeline, default_enabled: true) &&
@blob.path == Gitlab::FileDetector::PATTERNS[:gitlab_ci] && @blob.path == Gitlab::FileDetector::PATTERNS[:gitlab_ci] &&
@blob.auxiliary_viewer&.valid?(project: @project, sha: @commit.sha, user: current_user) && @blob.auxiliary_viewer&.valid?(project: @project, sha: @commit.sha, user: current_user) &&
@project.uses_default_ci_config? && @project.uses_default_ci_config? &&
......
...@@ -76,7 +76,6 @@ module IssuablesHelper ...@@ -76,7 +76,6 @@ module IssuablesHelper
when Issue when Issue
IssueSerializer IssueSerializer
when MergeRequest when MergeRequest
opts[:experiment_enabled] = :suggest_pipeline if experiment_enabled?(:suggest_pipeline) && opts[:serializer] == 'widget'
MergeRequestSerializer MergeRequestSerializer
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module SuggestPipelineHelper module SuggestPipelineHelper
def should_suggest_gitlab_ci_yml? def should_suggest_gitlab_ci_yml?
experiment_enabled?(:suggest_pipeline) && Feature.enabled?(:suggest_pipeline, default_enabled: true) &&
current_user && current_user &&
params[:suggest_gitlab_ci_yml] == 'true' params[:suggest_gitlab_ci_yml] == 'true'
end end
......
...@@ -67,15 +67,15 @@ class MergeRequestWidgetEntity < Grape::Entity ...@@ -67,15 +67,15 @@ class MergeRequestWidgetEntity < Grape::Entity
) )
end end
expose :user_callouts_path, if: -> (_, opts) { opts[:experiment_enabled] == :suggest_pipeline } do |_merge_request| expose :user_callouts_path, if: -> (*) { Feature.enabled?(:suggest_pipeline, default_enabled: true) } do |_merge_request|
user_callouts_path user_callouts_path
end end
expose :suggest_pipeline_feature_id, if: -> (_, opts) { opts[:experiment_enabled] == :suggest_pipeline } do |_merge_request| expose :suggest_pipeline_feature_id, if: -> (*) { Feature.enabled?(:suggest_pipeline, default_enabled: true) } do |_merge_request|
SUGGEST_PIPELINE SUGGEST_PIPELINE
end end
expose :is_dismissed_suggest_pipeline, if: -> (_, opts) { opts[:experiment_enabled] == :suggest_pipeline } do |_merge_request| expose :is_dismissed_suggest_pipeline, if: -> (*) { Feature.enabled?(:suggest_pipeline, default_enabled: true) } do |_merge_request|
current_user && current_user.dismissed_callout?(feature_name: SUGGEST_PIPELINE) current_user && current_user.dismissed_callout?(feature_name: SUGGEST_PIPELINE)
end end
......
---
title: Add suggest pipeline for viable merge requests without pipelines
merge_request: 45926
author:
type: changed
---
name: suggest_pipeline
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45926
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/267492
type: development
group: group::growth
default_enabled: true
...@@ -36,9 +36,6 @@ module Gitlab ...@@ -36,9 +36,6 @@ module Gitlab
onboarding_issues: { onboarding_issues: {
tracking_category: 'Growth::Conversion::Experiment::OnboardingIssues' tracking_category: 'Growth::Conversion::Experiment::OnboardingIssues'
}, },
suggest_pipeline: {
tracking_category: 'Growth::Expansion::Experiment::SuggestPipeline'
},
ci_notification_dot: { ci_notification_dot: {
tracking_category: 'Growth::Expansion::Experiment::CiNotificationDot' tracking_category: 'Growth::Expansion::Experiment::CiNotificationDot'
}, },
......
...@@ -9,8 +9,6 @@ RSpec.describe 'Merge request > User sees suggest pipeline', :js do ...@@ -9,8 +9,6 @@ RSpec.describe 'Merge request > User sees suggest pipeline', :js do
before do before do
stub_application_setting(auto_devops_enabled: false) stub_application_setting(auto_devops_enabled: false)
stub_experiment(suggest_pipeline: true)
stub_experiment_for_user(suggest_pipeline: true)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
......
...@@ -10,7 +10,6 @@ RSpec.describe 'User follows pipeline suggest nudge spec when feature is enabled ...@@ -10,7 +10,6 @@ RSpec.describe 'User follows pipeline suggest nudge spec when feature is enabled
describe 'viewing the new blob page' do describe 'viewing the new blob page' do
before do before do
stub_experiment_for_user(suggest_pipeline: true)
sign_in(user) sign_in(user)
end end
......
import Vue from 'vue'; import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import mountComponent from 'helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
import { withGonExperiment } from 'helpers/experimentation_helper';
import Api from '~/api'; import Api from '~/api';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import mrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue'; import mrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue';
...@@ -850,7 +849,7 @@ describe('mrWidgetOptions', () => { ...@@ -850,7 +849,7 @@ describe('mrWidgetOptions', () => {
}); });
}); });
describe('suggestPipeline Experiment', () => { describe('suggestPipeline feature flag', () => {
beforeEach(() => { beforeEach(() => {
mock.onAny().reply(200); mock.onAny().reply(200);
...@@ -859,10 +858,10 @@ describe('mrWidgetOptions', () => { ...@@ -859,10 +858,10 @@ describe('mrWidgetOptions', () => {
jest.spyOn(console, 'warn').mockImplementation(); jest.spyOn(console, 'warn').mockImplementation();
}); });
describe('given experiment is enabled', () => { describe('given feature flag is enabled', () => {
withGonExperiment('suggestPipeline');
beforeEach(() => { beforeEach(() => {
gon.features = { suggestPipeline: true };
createComponent(); createComponent();
vm.mr.hasCI = false; vm.mr.hasCI = false;
...@@ -893,10 +892,10 @@ describe('mrWidgetOptions', () => { ...@@ -893,10 +892,10 @@ describe('mrWidgetOptions', () => {
}); });
}); });
describe('given suggestPipeline experiment is not enabled', () => { describe('given feature flag is not enabled', () => {
withGonExperiment('suggestPipeline', false);
beforeEach(() => { beforeEach(() => {
gon.features = { suggestPipeline: false };
createComponent(); createComponent();
vm.mr.hasCI = false; vm.mr.hasCI = false;
......
...@@ -236,11 +236,7 @@ RSpec.describe BlobHelper do ...@@ -236,11 +236,7 @@ RSpec.describe BlobHelper do
let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) } let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
let(:blob) { fake_blob(path: Gitlab::FileDetector::PATTERNS[:gitlab_ci], data: data) } let(:blob) { fake_blob(path: Gitlab::FileDetector::PATTERNS[:gitlab_ci], data: data) }
context 'experiment enabled' do context 'feature enabled' do
before do
allow(helper).to receive(:experiment_enabled?).and_return(true)
end
it 'is true' do it 'is true' do
expect(helper.show_suggest_pipeline_creation_celebration?).to be_truthy expect(helper.show_suggest_pipeline_creation_celebration?).to be_truthy
end end
...@@ -284,9 +280,9 @@ RSpec.describe BlobHelper do ...@@ -284,9 +280,9 @@ RSpec.describe BlobHelper do
end end
end end
context 'experiment disabled' do context 'feature disabled' do
before do before do
allow(helper).to receive(:experiment_enabled?).and_return(false) stub_feature_flags(suggest_pipeline: false)
end end
it 'is false' do it 'is false' do
...@@ -298,11 +294,7 @@ RSpec.describe BlobHelper do ...@@ -298,11 +294,7 @@ RSpec.describe BlobHelper do
context 'when file is not a pipeline config file' do context 'when file is not a pipeline config file' do
let(:blob) { fake_blob(path: 'LICENSE') } let(:blob) { fake_blob(path: 'LICENSE') }
context 'experiment enabled' do context 'feature enabled' do
before do
allow(helper).to receive(:experiment_enabled?).and_return(true)
end
it 'is false' do it 'is false' do
expect(helper.show_suggest_pipeline_creation_celebration?).to be_falsey expect(helper.show_suggest_pipeline_creation_celebration?).to be_falsey
end end
......
...@@ -352,35 +352,4 @@ RSpec.describe IssuablesHelper do ...@@ -352,35 +352,4 @@ RSpec.describe IssuablesHelper do
expect(helper.sidebar_milestone_tooltip_label(milestone)).to eq('&lt;img onerror=alert(1)&gt;<br/>Milestone') expect(helper.sidebar_milestone_tooltip_label(milestone)).to eq('&lt;img onerror=alert(1)&gt;<br/>Milestone')
end end
end end
describe '#serialize_issuable' do
context 'when it is a merge request' do
let(:merge_request) { build(:merge_request) }
let(:user) { build(:user) }
before do
allow(helper).to receive(:current_user) { user }
end
it 'has suggest_pipeline experiment enabled' do
allow(helper).to receive(:experiment_enabled?).with(:suggest_pipeline) { true }
expect_next_instance_of(MergeRequestSerializer) do |serializer|
expect(serializer).to receive(:represent).with(merge_request, { serializer: 'widget', experiment_enabled: :suggest_pipeline })
end
helper.serialize_issuable(merge_request, serializer: 'widget')
end
it 'suggest_pipeline experiment disabled' do
allow(helper).to receive(:experiment_enabled?).with(:suggest_pipeline) { false }
expect_next_instance_of(MergeRequestSerializer) do |serializer|
expect(serializer).to receive(:represent).with(merge_request, { serializer: 'widget' })
end
helper.serialize_issuable(merge_request, serializer: 'widget')
end
end
end
end end
...@@ -333,6 +333,10 @@ RSpec.describe MergeRequestWidgetEntity do ...@@ -333,6 +333,10 @@ RSpec.describe MergeRequestWidgetEntity do
end end
context 'when suggest pipeline feature is not enabled' do context 'when suggest pipeline feature is not enabled' do
before do
stub_feature_flags(suggest_pipeline: false)
end
it 'provides no valid value for user callout path' do it 'provides no valid value for user callout path' do
expect(subject[:user_callouts_path]).to be_nil expect(subject[:user_callouts_path]).to be_nil
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