Commit a4a77904 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'jivanvl-remove-new-pipeline-form-ff' into 'master'

Remove new_pipeline_form feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!55250
parents 6defe730 2ee1010a
......@@ -393,6 +393,7 @@ export default {
v-model="variable.variable_type"
:class="$options.formElementClasses"
:options="$options.typeOptions"
data-testid="pipeline-form-ci-variable-type"
/>
<gl-form-input
v-model="variable.key"
......
......@@ -81,11 +81,12 @@ export default {
};
</script>
<template>
<gl-dropdown :text="refShortName" block @show.once="loadRefs">
<gl-dropdown :text="refShortName" block data-testid="ref-select" @show.once="loadRefs">
<gl-search-box-by-type
v-model.trim="searchTerm"
:is-loading="isLoading"
:placeholder="__('Search refs')"
data-testid="search-refs"
/>
<gl-dropdown-section-header>{{ __('Branches') }}</gl-dropdown-section-header>
<gl-dropdown-item
......
......@@ -13,7 +13,6 @@ class Projects::PipelinesController < Projects::ApplicationController
before_action :authorize_create_pipeline!, only: [:new, :create, :config_variables]
before_action :authorize_update_pipeline!, only: [:retry, :cancel]
before_action do
push_frontend_feature_flag(:new_pipeline_form, project, default_enabled: :yaml)
push_frontend_feature_flag(:pipeline_graph_layers_view, project, type: :development, default_enabled: :yaml)
push_frontend_feature_flag(:pipeline_filter_jobs, project, default_enabled: :yaml)
push_frontend_feature_flag(:graphql_pipeline_details, project, type: :development, default_enabled: :yaml)
......
- breadcrumb_title _('Pipelines')
- page_title s_('Pipeline|Run pipeline')
- settings_link = link_to _('CI/CD settings'), project_settings_ci_cd_path(@project)
%h3.page-title
= s_('Pipeline|Run pipeline')
%hr
- if Feature.enabled?(:new_pipeline_form, @project, default_enabled: :yaml)
#js-new-pipeline{ data: { project_id: @project.id,
pipelines_path: project_pipelines_path(@project),
config_variables_path: config_variables_namespace_project_pipelines_path(@project.namespace, @project),
default_branch: @project.default_branch,
ref_param: params[:ref] || @project.default_branch,
var_param: params[:var].to_json,
file_param: params[:file_var].to_json,
project_refs_endpoint: refs_project_path(@project, sort: 'updated_desc'),
settings_link: project_settings_ci_cd_path(@project),
max_warnings: ::Gitlab::Ci::Warnings::MAX_LIMIT } }
- else
= form_for @pipeline, as: :pipeline, url: project_pipelines_path(@project), html: { id: "new-pipeline-form", class: "js-new-pipeline-form js-requires-input" } do |f|
= form_errors(@pipeline)
= pipeline_warnings(@pipeline)
.form-group.row
.col-sm-12
= f.label :ref, s_('Pipeline|Run for'), class: 'col-form-label'
= hidden_field_tag 'pipeline[ref]', params[:ref] || @project.default_branch
= dropdown_tag(params[:ref] || @project.default_branch,
options: { toggle_class: 'js-branch-select wide monospace',
filter: true, dropdown_class: "dropdown-menu-selectable git-revision-dropdown", placeholder: s_("Pipeline|Search branches"),
data: { selected: params[:ref] || @project.default_branch, field_name: 'pipeline[ref]' } })
.form-text.text-muted
= s_("Pipeline|Existing branch name or tag")
.col-sm-12.gl-mt-3.js-ci-variable-list-section
%label
= s_('Pipeline|Variables')
%ul.ci-variable-list
- if params[:var]
- params[:var].each do |variable|
= render 'ci/variables/url_query_variable_row', form_field: 'pipeline', variable: variable
- if params[:file_var]
- params[:file_var].each do |variable|
- variable.push("file")
= render 'ci/variables/url_query_variable_row', form_field: 'pipeline', variable: variable
= render 'ci/variables/variable_row', form_field: 'pipeline', only_key_value: true
.form-text.text-muted
= (s_("Pipeline|Specify variable values to be used in this run. The values specified in %{settings_link} will be used by default.") % {settings_link: settings_link}).html_safe
.form-actions
= f.submit s_('Pipeline|Run pipeline'), class: 'btn gl-button btn-confirm gl-mr-3 js-variables-save-button'
= link_to _('Cancel'), project_pipelines_path(@project), class: 'btn gl-button btn-default'
%script#availableRefs{ type: "application/json" }= @project.repository.ref_names.to_json.html_safe
#js-new-pipeline{ data: { project_id: @project.id,
pipelines_path: project_pipelines_path(@project),
config_variables_path: config_variables_namespace_project_pipelines_path(@project.namespace, @project),
default_branch: @project.default_branch,
ref_param: params[:ref] || @project.default_branch,
var_param: params[:var].to_json,
file_param: params[:file_var].to_json,
project_refs_endpoint: refs_project_path(@project, sort: 'updated_desc'),
settings_link: project_settings_ci_cd_path(@project),
max_warnings: ::Gitlab::Ci::Warnings::MAX_LIMIT } }
---
title: Enable the new pipeline form by default
merge_request: 55250
author:
type: changed
---
name: new_pipeline_form
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/35674
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/229632
milestone: '13.2'
type: development
group: group::continuous integration
default_enabled: true
......@@ -5571,9 +5571,6 @@ msgstr ""
msgid "CI/CD for external repo"
msgstr ""
msgid "CI/CD settings"
msgstr ""
msgid "CICDAnalytics|%{percent}%{percentSymbol}"
msgstr ""
......@@ -23507,9 +23504,6 @@ msgstr ""
msgid "Pipeline|Duration"
msgstr ""
msgid "Pipeline|Existing branch name or tag"
msgstr ""
msgid "Pipeline|Failed"
msgstr ""
......@@ -23552,9 +23546,6 @@ msgstr ""
msgid "Pipeline|Raw text search is not currently supported. Please use the available search tokens."
msgstr ""
msgid "Pipeline|Run for"
msgstr ""
msgid "Pipeline|Run for branch name or tag"
msgstr ""
......@@ -23564,18 +23555,12 @@ msgstr ""
msgid "Pipeline|Running"
msgstr ""
msgid "Pipeline|Search branches"
msgstr ""
msgid "Pipeline|Skipped"
msgstr ""
msgid "Pipeline|Specify variable values to be used in this run. The values specified in %{linkStart}CI/CD settings%{linkEnd} will be used by default."
msgstr ""
msgid "Pipeline|Specify variable values to be used in this run. The values specified in %{settings_link} will be used by default."
msgstr ""
msgid "Pipeline|Stages"
msgstr ""
......
......@@ -8,7 +8,6 @@ RSpec.describe "Populate new pipeline CI variables with url params", :js do
let(:page_path) { new_project_pipeline_path(project) }
before do
stub_feature_flags(new_pipeline_form: false)
sign_in(user)
project.add_maintainer(user)
......@@ -16,18 +15,18 @@ RSpec.describe "Populate new pipeline CI variables with url params", :js do
end
it "var[key1]=value1 populates env_var variable correctly" do
page.within('.ci-variable-list .js-row:nth-child(1)') do
expect(find('.js-ci-variable-input-variable-type').value).to eq('env_var')
expect(find('.js-ci-variable-input-key').value).to eq('key1')
expect(find('.js-ci-variable-input-value').text).to eq('value1')
page.within(all("[data-testid='ci-variable-row']")[0]) do
expect(find("[data-testid='pipeline-form-ci-variable-type']").value).to eq('env_var')
expect(find("[data-testid='pipeline-form-ci-variable-key']").value).to eq('key1')
expect(find("[data-testid='pipeline-form-ci-variable-value']").value).to eq('value1')
end
end
it "file_var[key2]=value2 populates file variable correctly" do
page.within('.ci-variable-list .js-row:nth-child(2)') do
expect(find('.js-ci-variable-input-variable-type').value).to eq('file')
expect(find('.js-ci-variable-input-key').value).to eq('key2')
expect(find('.js-ci-variable-input-value').text).to eq('value2')
page.within(all("[data-testid='ci-variable-row']")[1]) do
expect(find("[data-testid='pipeline-form-ci-variable-type']").value).to eq('file')
expect(find("[data-testid='pipeline-form-ci-variable-key']").value).to eq('key2')
expect(find("[data-testid='pipeline-form-ci-variable-value']").value).to eq('value2')
end
end
end
......@@ -657,26 +657,28 @@ RSpec.describe 'Pipelines', :js do
let(:project) { create(:project, :repository) }
before do
stub_feature_flags(new_pipeline_form: false)
visit new_project_pipeline_path(project)
end
context 'for valid commit', :js do
before do
click_button project.default_branch
wait_for_requests
page.within '.dropdown-menu' do
click_link 'master'
end
find('p', text: 'master').click
wait_for_requests
end
context 'with gitlab-ci.yml' do
context 'with gitlab-ci.yml', :js do
before do
stub_ci_pipeline_to_return_yaml_file
end
it 'creates a new pipeline' do
expect { click_on 'Run pipeline' }
expect do
click_on 'Run pipeline'
wait_for_requests
end
.to change { Ci::Pipeline.count }.by(1)
expect(Ci::Pipeline.last).to be_web
......@@ -684,12 +686,15 @@ RSpec.describe 'Pipelines', :js do
context 'when variables are specified' do
it 'creates a new pipeline with variables' do
page.within '.ci-variable-row-body' do
fill_in "Input variable key", with: "key_name"
fill_in "Input variable value", with: "value"
page.within(find("[data-testid='ci-variable-row']")) do
find("[data-testid='pipeline-form-ci-variable-key']").set('key_name')
find("[data-testid='pipeline-form-ci-variable-value']").set('value')
end
expect { click_on 'Run pipeline' }
expect do
click_on 'Run pipeline'
wait_for_requests
end
.to change { Ci::Pipeline.count }.by(1)
expect(Ci::Pipeline.last.variables.map { |var| var.slice(:key, :secret_value) })
......@@ -701,19 +706,17 @@ RSpec.describe 'Pipelines', :js do
context 'without gitlab-ci.yml' do
before do
click_on 'Run pipeline'
wait_for_requests
end
it { expect(page).to have_content('Missing CI config file') }
it 'creates a pipeline after first request failed and a valid gitlab-ci.yml file is available when trying again' do
click_button project.default_branch
stub_ci_pipeline_to_return_yaml_file
page.within '.dropdown-menu' do
click_link 'master'
expect do
click_on 'Run pipeline'
wait_for_requests
end
expect { click_on 'Run pipeline' }
.to change { Ci::Pipeline.count }.by(1)
end
end
......@@ -760,14 +763,13 @@ RSpec.describe 'Pipelines', :js do
let(:project) { create(:project, :repository) }
before do
stub_feature_flags(new_pipeline_form: false)
visit new_project_pipeline_path(project)
end
describe 'new pipeline page' do
it 'has field to add a new pipeline' do
expect(page).to have_selector('.js-branch-select')
expect(find('.js-branch-select')).to have_content project.default_branch
expect(page).to have_selector('[data-testid="ref-select"]')
expect(find('[data-testid="ref-select"]')).to have_content project.default_branch
expect(page).to have_content('Run for')
end
end
......@@ -776,10 +778,10 @@ RSpec.describe 'Pipelines', :js do
it 'shows filtered pipelines', :js do
click_button project.default_branch
page.within '.dropdown-menu' do
find('.dropdown-input-field').native.send_keys('fix')
page.within '[data-testid="ref-select"]' do
find('[data-testid="search-refs"]').native.send_keys('fix')
page.within '.dropdown-content' do
page.within '.gl-new-dropdown-contents' do
expect(page).to have_content('fix')
end
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'projects/pipelines/new' do
include Devise::Test::ControllerHelpers
let_it_be(:project) { create(:project, :repository) }
let(:pipeline) { create(:ci_pipeline, project: project) }
before do
assign(:project, project)
assign(:pipeline, pipeline)
stub_feature_flags(new_pipeline_form: false)
end
describe 'warning messages' do
let(:warning_messages) do
[double(content: 'warning 1'), double(content: 'warning 2')]
end
before do
allow(pipeline).to receive(:warning_messages).and_return(warning_messages)
end
it 'displays the warnings' do
render
expect(rendered).to have_css('div.bs-callout-warning')
expect(rendered).to have_content('warning 1')
expect(rendered).to have_content('warning 2')
end
end
end
......@@ -12,8 +12,6 @@ RSpec.describe 'projects/pipelines/show' do
before do
assign(:project, project)
assign(:pipeline, presented_pipeline)
stub_feature_flags(new_pipeline_form: false)
end
context 'when pipeline has errors' do
......
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