Add setting to change default MR target project
What does this MR do?
- Adds
project_settings.mr_default_target_self
column - Adds UI to allow user to set
project_settings.mr_default_target_self
- If
project_settings.mr_default_target_self
istrue
we use same project as default target for a new merge request. Otherwise we use old behavior where upstream project was used.
Related to #14522 (closed)
Database migration output:
Up
[2] pry(main)> require './db/migrate/20210331125111_add_default_target_project.rb'
=> true
[3] pry(main)> AddDefaultTargetProject.new.up
(0.2ms) BEGIN /*application:console,line:/lib/gitlab/database/with_lock_retries.rb:168:in `execute'*/
(0.1ms) SET LOCAL lock_timeout TO '100ms' /*application:console,line:/lib/gitlab/database/with_lock_retries.rb:168:in `execute'*/
-- add_column(:project_settings, :mr_default_target_self, :boolean, {:default=>false, :null=>false})
(0.7ms) ALTER TABLE "project_settings" ADD "mr_default_target_self" boolean DEFAULT FALSE NOT NULL /*application:console,line:/Users/dzaporozhets/.asdf/installs/ruby/2.7.2/lib/ruby/2.7.0/benchmark.rb:293:in `measure'*/
-> 0.0018s
(5.9ms) COMMIT /*application:console,line:/lib/gitlab/database.rb:342:in `block in transaction'*/
(0.2ms) RESET idle_in_transaction_session_timeout; RESET lock_timeout /*application:console,line:/lib/gitlab/database/with_lock_retries.rb:168:in `execute'*/
=> true
Down
[1] pry(main)> require './db/migrate/20210331125111_add_default_target_project.rb'
=> true
[2] pry(main)> AddDefaultTargetProject.new.down
(0.4ms) BEGIN /*application:console,line:/lib/gitlab/database/with_lock_retries.rb:168:in `execute'*/
(0.2ms) SET LOCAL lock_timeout TO '100ms' /*application:console,line:/lib/gitlab/database/with_lock_retries.rb:168:in `execute'*/
-- remove_column(:project_settings, :mr_default_target_self)
(0.9ms) ALTER TABLE "project_settings" DROP COLUMN "mr_default_target_self" /*application:console,line:/Users/dzaporozhets/.asdf/installs/ruby/2.7.2/lib/ruby/2.7.0/benchmark.rb:293:in `measure'*/
-> 0.0014s
(0.5ms) COMMIT /*application:console,line:/lib/gitlab/database.rb:342:in `block in transaction'*/
(0.1ms) RESET idle_in_transaction_session_timeout; RESET lock_timeout /*application:console,line:/lib/gitlab/database/with_lock_retries.rb:168:in `execute'*/
=> true
Screenshots (strongly suggested)
Project settings
When user choose "this project"
When user choose "upstream project"
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) => !59118 (merged) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Edited by Dmytro Zaporozhets (DZ)