Add project level config for merge train

We add the option and expose the parameter for frontend work
This commit is contained in:
Shinya Maeda 2019-04-16 18:56:48 +07:00
parent a96e96d5c8
commit e51912543c
3 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddMergeTrainEnabledToCiCdSettings < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column_with_default :project_ci_cd_settings, :merge_trains_enabled, :boolean, default: false, allow_null: false
end
def down
remove_column :project_ci_cd_settings, :merge_trains_enabled
end
end

View file

@ -1612,6 +1612,7 @@ ActiveRecord::Schema.define(version: 20190426180107) do
t.integer "project_id", null: false
t.boolean "group_runners_enabled", default: true, null: false
t.boolean "merge_pipelines_enabled"
t.boolean "merge_trains_enabled", default: false, null: false
t.index ["project_id"], name: "index_project_ci_cd_settings_on_project_id", unique: true, using: :btree
end

View file

@ -2123,7 +2123,7 @@ describe MergeRequest do
end
context 'when merges are not restricted to green builds' do
subject { build(:merge_request, target_project: build(:project, only_allow_merge_if_pipeline_succeeds: false)) }
subject { build(:merge_request, target_project: create(:project, only_allow_merge_if_pipeline_succeeds: false)) }
context 'and a failed pipeline is associated' do
before do