Commit ea7b3e97 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'cleanup-ci-runner-templates-experiment' into 'master'

Cleanup CI Runner Templates Experiment

See merge request gitlab-org/gitlab!81168
parents 46f9ec8d 6634d3a3
...@@ -2,20 +2,12 @@ ...@@ -2,20 +2,12 @@
import { GlEmptyState, GlButton } from '@gitlab/ui'; import { GlEmptyState, GlButton } from '@gitlab/ui';
import { startCodeQualityWalkthrough, track } from '~/code_quality_walkthrough/utils'; import { startCodeQualityWalkthrough, track } from '~/code_quality_walkthrough/utils';
import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue'; import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';
import ExperimentTracking from '~/experimentation/experiment_tracking';
import { getExperimentData } from '~/experimentation/utils'; import { getExperimentData } from '~/experimentation/utils';
import { helpPagePath } from '~/helpers/help_page_helper';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import PipelinesCiTemplates from './pipelines_ci_templates.vue'; import PipelinesCiTemplates from './pipelines_ci_templates.vue';
export default { export default {
i18n: { i18n: {
title: s__('Pipelines|Build with confidence'),
description: s__(`Pipelines|GitLab CI/CD can automatically build,
test, and deploy your code. Let GitLab take care of time
consuming tasks, so you can spend more time creating.`),
aboutRunnersBtnText: s__('Pipelines|Learn about Runners'),
installRunnersBtnText: s__('Pipelines|Install GitLab Runners'),
codeQualityTitle: s__('Pipelines|Improve code quality with GitLab CI/CD'), codeQualityTitle: s__('Pipelines|Improve code quality with GitLab CI/CD'),
codeQualityDescription: s__(`Pipelines|To keep your codebase simple, codeQualityDescription: s__(`Pipelines|To keep your codebase simple,
readable, and accessible to contributors, use GitLab CI/CD readable, and accessible to contributors, use GitLab CI/CD
...@@ -56,15 +48,9 @@ export default { ...@@ -56,15 +48,9 @@ export default {
}, },
}, },
computed: { computed: {
ciHelpPagePath() {
return helpPagePath('ci/quick_start/index.md');
},
isCodeQualityExperimentActive() { isCodeQualityExperimentActive() {
return this.canSetCi && Boolean(getExperimentData('code_quality_walkthrough')); return this.canSetCi && Boolean(getExperimentData('code_quality_walkthrough'));
}, },
isCiRunnerTemplatesExperimentActive() {
return this.canSetCi && Boolean(getExperimentData('ci_runner_templates'));
},
}, },
mounted() { mounted() {
startCodeQualityWalkthrough(); startCodeQualityWalkthrough();
...@@ -73,10 +59,6 @@ export default { ...@@ -73,10 +59,6 @@ export default {
trackClick() { trackClick() {
track('cta_clicked'); track('cta_clicked');
}, },
trackCiRunnerTemplatesClick(action) {
const tracking = new ExperimentTracking('ci_runner_templates');
tracking.event(action);
},
}, },
}; };
</script> </script>
...@@ -98,33 +80,6 @@ export default { ...@@ -98,33 +80,6 @@ export default {
</gl-empty-state> </gl-empty-state>
</template> </template>
</gitlab-experiment> </gitlab-experiment>
<gitlab-experiment v-else-if="isCiRunnerTemplatesExperimentActive" name="ci_runner_templates">
<template #control><pipelines-ci-templates /></template>
<template #candidate>
<gl-empty-state
:title="$options.i18n.title"
:svg-path="emptyStateSvgPath"
:description="$options.i18n.description"
>
<template #actions>
<gl-button
:href="ciRunnerSettingsPath"
variant="confirm"
@click="trackCiRunnerTemplatesClick('install_runners_button_clicked')"
>
{{ $options.i18n.installRunnersBtnText }}
</gl-button>
<gl-button
:href="ciHelpPagePath"
variant="default"
@click="trackCiRunnerTemplatesClick('learn_button_clicked')"
>
{{ $options.i18n.aboutRunnersBtnText }}
</gl-button>
</template>
</gl-empty-state>
</template>
</gitlab-experiment>
<pipelines-ci-templates <pipelines-ci-templates
v-else-if="canSetCi" v-else-if="canSetCi"
:ci-runner-settings-path="ciRunnerSettingsPath" :ci-runner-settings-path="ciRunnerSettingsPath"
......
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
export const EXPERIMENT_NAME = 'ci_runner_templates';
export const README_URL = export const README_URL =
'https://gitlab.com/guided-explorations/aws/gitlab-runner-autoscaling-aws-asg/-/blob/main/easybuttons.md'; 'https://gitlab.com/guided-explorations/aws/gitlab-runner-autoscaling-aws-asg/-/blob/main/easybuttons.md';
......
<script> <script>
import { GlModal, GlSprintf, GlLink } from '@gitlab/ui'; import { GlModal, GlSprintf, GlLink } from '@gitlab/ui';
import awsCloudFormationImageUrl from 'images/aws-cloud-formation.png'; import awsCloudFormationImageUrl from 'images/aws-cloud-formation.png';
import ExperimentTracking from '~/experimentation/experiment_tracking'; import Tracking from '~/tracking';
import { getBaseURL, objectToQuery } from '~/lib/utils/url_utility'; import { getBaseURL, objectToQuery } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import { import { README_URL, CF_BASE_URL, TEMPLATES_BASE_URL, EASY_BUTTONS } from './constants';
EXPERIMENT_NAME,
README_URL,
CF_BASE_URL,
TEMPLATES_BASE_URL,
EASY_BUTTONS,
} from './constants';
export default { export default {
components: { components: {
...@@ -18,6 +12,7 @@ export default { ...@@ -18,6 +12,7 @@ export default {
GlSprintf, GlSprintf,
GlLink, GlLink,
}, },
mixins: [Tracking.mixin()],
props: { props: {
modalId: { modalId: {
type: String, type: String,
...@@ -39,8 +34,9 @@ export default { ...@@ -39,8 +34,9 @@ export default {
return CF_BASE_URL + objectToQuery(params); return CF_BASE_URL + objectToQuery(params);
}, },
trackCiRunnerTemplatesClick(stackName) { trackCiRunnerTemplatesClick(stackName) {
const tracking = new ExperimentTracking(EXPERIMENT_NAME); this.track('template_clicked', {
tracking.event(`template_clicked_${stackName}`); label: stackName,
});
}, },
}, },
i18n: { i18n: {
......
...@@ -52,7 +52,6 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -52,7 +52,6 @@ class Projects::PipelinesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
enable_code_quality_walkthrough_experiment enable_code_quality_walkthrough_experiment
enable_ci_runner_templates_experiment
enable_runners_availability_section_experiment enable_runners_availability_section_experiment
end end
format.json do format.json do
...@@ -320,19 +319,6 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -320,19 +319,6 @@ class Projects::PipelinesController < Projects::ApplicationController
end end
end end
def enable_ci_runner_templates_experiment
experiment(:ci_runner_templates, namespace: project.root_ancestor) do |e|
e.exclude! unless current_user
e.exclude! unless can?(current_user, :create_pipeline, project)
e.exclude! if @pipelines_count.to_i > 0
e.exclude! if helpers.has_gitlab_ci?(project)
e.control {}
e.candidate {}
e.publish_to_database
end
end
def enable_runners_availability_section_experiment def enable_runners_availability_section_experiment
return unless current_user return unless current_user
return unless can?(current_user, :create_pipeline, project) return unless can?(current_user, :create_pipeline, project)
......
---
name: ci_runner_templates
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58357
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326725
milestone: "14.0"
type: experiment
group: group::activation
default_enabled: false
...@@ -27011,18 +27011,12 @@ msgstr "" ...@@ -27011,18 +27011,12 @@ msgstr ""
msgid "Pipelines|Install GitLab Runner" msgid "Pipelines|Install GitLab Runner"
msgstr "" msgstr ""
msgid "Pipelines|Install GitLab Runners"
msgstr ""
msgid "Pipelines|It is recommended the code is reviewed thoroughly before running this pipeline with the parent project's CI resource." msgid "Pipelines|It is recommended the code is reviewed thoroughly before running this pipeline with the parent project's CI resource."
msgstr "" msgstr ""
msgid "Pipelines|Last Used" msgid "Pipelines|Last Used"
msgstr "" msgstr ""
msgid "Pipelines|Learn about Runners"
msgstr ""
msgid "Pipelines|Learn the basics of pipelines and .yml files" msgid "Pipelines|Learn the basics of pipelines and .yml files"
msgstr "" msgstr ""
......
...@@ -296,10 +296,6 @@ RSpec.describe Projects::PipelinesController do ...@@ -296,10 +296,6 @@ RSpec.describe Projects::PipelinesController do
it_behaves_like 'tracks assignment and records the subject', :code_quality_walkthrough, :namespace it_behaves_like 'tracks assignment and records the subject', :code_quality_walkthrough, :namespace
end end
context 'ci_runner_templates experiment' do
it_behaves_like 'tracks assignment and records the subject', :ci_runner_templates, :namespace
end
context 'runners_availability_section experiment' do context 'runners_availability_section experiment' do
it_behaves_like 'tracks assignment and records the subject', :runners_availability_section, :namespace it_behaves_like 'tracks assignment and records the subject', :runners_availability_section, :namespace
end end
......
...@@ -586,44 +586,6 @@ describe('Pipelines', () => { ...@@ -586,44 +586,6 @@ describe('Pipelines', () => {
}); });
}); });
describe('when the ci_runner_templates experiment is active', () => {
beforeAll(() => {
getExperimentData.mockImplementation((name) => name === 'ci_runner_templates');
});
describe('the control state', () => {
beforeAll(() => {
getExperimentVariant.mockReturnValue('control');
});
it('renders the CI/CD templates', () => {
expect(wrapper.findComponent(PipelinesCiTemplates).exists()).toBe(true);
});
});
describe('the candidate state', () => {
beforeAll(() => {
getExperimentVariant.mockReturnValue('candidate');
});
it('renders two buttons', () => {
expect(findEmptyState().findAllComponents(GlButton).length).toBe(2);
expect(findEmptyState().findAllComponents(GlButton).at(0).text()).toBe(
'Install GitLab Runners',
);
expect(findEmptyState().findAllComponents(GlButton).at(0).attributes('href')).toBe(
paths.ciRunnerSettingsPath,
);
expect(findEmptyState().findAllComponents(GlButton).at(1).text()).toBe(
'Learn about Runners',
);
expect(findEmptyState().findAllComponents(GlButton).at(1).attributes('href')).toBe(
'/help/ci/quick_start/index.md',
);
});
});
});
it('does not render filtered search', () => { it('does not render filtered search', () => {
expect(findFilteredSearch().exists()).toBe(false); expect(findFilteredSearch().exists()).toBe(false);
}); });
......
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import ExperimentTracking from '~/experimentation/experiment_tracking';
import { getBaseURL } from '~/lib/utils/url_utility'; import { getBaseURL } from '~/lib/utils/url_utility';
import { mockTracking } from 'helpers/tracking_helper';
import { import {
EXPERIMENT_NAME,
CF_BASE_URL, CF_BASE_URL,
TEMPLATES_BASE_URL, TEMPLATES_BASE_URL,
EASY_BUTTONS, EASY_BUTTONS,
} from '~/vue_shared/components/runner_aws_deployments/constants'; } from '~/vue_shared/components/runner_aws_deployments/constants';
import RunnerAwsDeploymentsModal from '~/vue_shared/components/runner_aws_deployments/runner_aws_deployments_modal.vue'; import RunnerAwsDeploymentsModal from '~/vue_shared/components/runner_aws_deployments/runner_aws_deployments_modal.vue';
jest.mock('~/experimentation/experiment_tracking');
describe('RunnerAwsDeploymentsModal', () => { describe('RunnerAwsDeploymentsModal', () => {
let wrapper; let wrapper;
let trackingSpy;
const findEasyButtons = () => wrapper.findAllComponents(GlLink); const findEasyButtons = () => wrapper.findAllComponents(GlLink);
...@@ -65,12 +63,14 @@ describe('RunnerAwsDeploymentsModal', () => { ...@@ -65,12 +63,14 @@ describe('RunnerAwsDeploymentsModal', () => {
}); });
it('should track an event when clicked', () => { it('should track an event when clicked', () => {
trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn);
findFirstButton().vm.$emit('click'); findFirstButton().vm.$emit('click');
expect(ExperimentTracking).toHaveBeenCalledWith(EXPERIMENT_NAME); expect(trackingSpy).toHaveBeenCalledTimes(1);
expect(ExperimentTracking.prototype.event).toHaveBeenCalledWith( expect(trackingSpy).toHaveBeenCalledWith(undefined, 'template_clicked', {
`template_clicked_${EASY_BUTTONS[0].stackName}`, label: EASY_BUTTONS[0].stackName,
); });
}); });
}); });
}); });
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