Add project setting to disable merge immediately [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
This is behind a feature flag and implements parts of #320981 (closed). Which adds an admin-only project setting that when disabled will prevent users from bypassing pipeline completion and merging.
What's included in the MR:
- Adds a migration with the new column (true by default)
- Allows for updating the new column (controller and view)
- Feature test for updating the column
- Blocks Merging via API if
merge_when_pipeline_succeeds
is false and the new column is set to false
What's not included in this MR:
- Graphql update
- Graphql fetch
- Public REST Api update
- Public REST Api fetch
- Disabling merge immediately button based on the new column
Screenshots (strongly suggested)
Database
Migration
Up
== 20210216153814 AddMergeBeforePipelineSucceedsToCiCdSettings: migrating =====
-- add_column(:project_ci_cd_settings, :merge_before_pipeline_completes_enabled, :boolean, {:default=>true, :null=>false})
-> 0.0030s
== 20210216153814 AddMergeBeforePipelineSucceedsToCiCdSettings: migrated (0.0122s)
ALTER TABLE "project_ci_cd_settings" ADD "merge_before_pipeline_completes_enabled" boolean DEFAULT TRUE NOT NULL
Down
rake db:migrate:down VERSION=20210216153814
== 20210216153814 AddMergeBeforePipelineSucceedsToCiCdSettings: reverting =====
-- remove_column(:project_ci_cd_settings, :merge_before_pipeline_completes_enabled)
-> 0.0047s
== 20210216153814 AddMergeBeforePipelineSucceedsToCiCdSettings: reverted (0.0117s)
ALTER TABLE "project_ci_cd_settings" DROP COLUMN "merge_before_pipeline_completes_enabled"
Queries
UPDATE "project_ci_cd_settings"
SET "merge_before_pipeline_completes_enabled" = TRUE
WHERE "project_ci_cd_settings"."id" = 36;
Time: 22.323 ms
- planning: 0.591 ms
- execution: 21.732 ms
- I/O read: 21.380 ms
- I/O write: N/A
Shared buffers:
- hits: 8 (~64.00 KiB) from the buffer pool
- reads: 15 (~120.00 KiB) from the OS file cache, including disk I/O
- dirtied: 5 (~40.00 KiB)
- writes: 0
https://console.postgres.ai/gitlab/gitlab-production-tunnel/sessions/3982/commands/13717
Conformity
-
I have included a changelog entry, or it's not needed. (Does this MR need a changelog?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Queries
UPDATE "project_ci_cd_settings" SET "merge_before_pipeline_completes_enabled" = TRUE
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.)
Edited by Allison Browne