Refactor ExternalApprovalRules to ExternalStatusChecks
What does this MR do?
- Due to a mid-milestone pivot in 13.12, groupcompliance decided to rename External Approval Rules to External Status Checks.
-
Update database schema -
Update API endpoints -
Update documentation -
Update services -
Do a find & replace for ExternalApprovalRule
andexternal_approval_rule
to find any stragglers. -
Inform frontend folks as it will affect their work.
Note: This feature has always been behind a default-off feature flag so this is not a breaking change.
Does this MR meet the acceptance criteria?
Conformity
-
I have included a changelog entry, or it's not needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
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.
Database Review
CreateExternalStatusChecksTable
Up
== 20210604082145 CreateExternalStatusChecksTable: migrating ==================
-- create_table(:external_status_checks, {:if_not_exists=>true})
-- quote_column_name(:external_url)
-> 0.0001s
-- quote_column_name(:name)
-> 0.0000s
-> 0.0270s
-- quote_table_name("check_ae0dec3f61")
-> 0.0000s
-- quote_table_name("check_7e3b9eb41a")
-> 0.0000s
-- quote_table_name(:external_status_checks)
-> 0.0000s
-- execute("ALTER TABLE \"external_status_checks\"\nADD CONSTRAINT \"check_ae0dec3f61\" CHECK (char_length(\"external_url\") <= 255),\nADD CONSTRAINT \"check_7e3b9eb41a\" CHECK (char_length(\"name\") <= 255)\n")
-> 0.0015s
-- create_table(:external_status_checks_protected_branches)
-> 0.0079s
== 20210604082145 CreateExternalStatusChecksTable: migrated (0.0460s) =========
Down
== 20210604082145 CreateExternalStatusChecksTable: reverting ==================
-- drop_table(:external_status_checks_protected_branches, {:force=>:cascade, :if_exists=>true})
-> 0.0020s
-- drop_table(:external_status_checks, {:force=>:cascade, :if_exists=>true})
-> 0.0020s
== 20210604082145 CreateExternalStatusChecksTable: reverted (0.0204s) =========
RenameStatusCheckResponsesApprovalRule
Up
== 20210604085600 RenameStatusCheckResponsesApprovalRule: migrating ===========
-- add_column(:status_check_responses, :external_status_check_id, :bigint, {:null=>false})
-> 0.0013s
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:status_check_responses)
-> 0.0037s
-- execute("ALTER TABLE status_check_responses\nADD CONSTRAINT fk_55bd2abc83\nFOREIGN KEY (external_status_check_id)\nREFERENCES external_status_checks (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0011s
-- execute("SET statement_timeout TO 0")
-> 0.0005s
-- execute("ALTER TABLE status_check_responses VALIDATE CONSTRAINT fk_55bd2abc83;")
-> 0.0017s
-- execute("RESET ALL")
-> 0.0005s
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:status_check_responses)
-> 0.0023s
-- execute("ALTER TABLE status_check_responses VALIDATE CONSTRAINT fk_f3953d86c6;")
-> 0.0005s
-- transaction_open?()
-> 0.0000s
-- index_exists?(:status_check_responses, :external_status_check_id, {:algorithm=>:concurrently})
-> 0.0024s
-- add_index(:status_check_responses, :external_status_check_id, {:algorithm=>:concurrently})
-> 0.0032s
-- change_column_null(:status_check_responses, :external_approval_rule_id, true)
-> 0.0011s
-- remove_foreign_key(:status_check_responses, :external_approval_rules)
-> 0.0035s
== 20210604085600 RenameStatusCheckResponsesApprovalRule: migrated (0.0306s) ==
Down
== 20210604085600 RenameStatusCheckResponsesApprovalRule: reverting ===========
-- change_column_null(:status_check_responses, :external_approval_rule_id, false)
-> 0.0044s
-- add_foreign_key(:status_check_responses, :external_approval_rules)
-> 0.0206s
-- remove_column(:status_check_responses, :external_status_check_id)
-> 0.0070s
== 20210604085600 RenameStatusCheckResponsesApprovalRule: reverted (0.0413s) ==
AddStatusCheckForeignKeyToProtectedBranchId
Up
== 20210609193101 AddStatusCheckForeignKeyToProtectedBranchId: migrating ======
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:external_status_checks_protected_branches)
-> 0.0025s
-- execute("ALTER TABLE external_status_checks_protected_branches\nADD CONSTRAINT fk_b7d788e813\nFOREIGN KEY (protected_branch_id)\nREFERENCES protected_branches (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0010s
-- execute("ALTER TABLE external_status_checks_protected_branches VALIDATE CONSTRAINT fk_b7d788e813;")
-> 0.0023s
== 20210609193101 AddStatusCheckForeignKeyToProtectedBranchId: migrated (0.0099s)
Down
== 20210609193101 AddStatusCheckForeignKeyToProtectedBranchId: reverting ======
-- remove_foreign_key(:external_status_checks_protected_branches, {:column=>:protected_branch_id})
-> 0.0065s
== 20210609193101 AddStatusCheckForeignKeyToProtectedBranchId: reverted (0.0142s)
AddStatusCheckForeignKeyToExternalStatusCheckId
Up
== 20210609192728 AddStatusCheckForeignKeyToExternalStatusCheckId: migrating ==
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:external_status_checks_protected_branches)
-> 0.0049s
-- execute("ALTER TABLE external_status_checks_protected_branches\nADD CONSTRAINT fk_cc0dcc36d1\nFOREIGN KEY (external_status_check_id)\nREFERENCES external_status_checks (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0025s
-- execute("SET statement_timeout TO 0")
-> 0.0005s
-- execute("ALTER TABLE external_status_checks_protected_branches VALIDATE CONSTRAINT fk_cc0dcc36d1;")
-> 0.0022s
-- execute("RESET ALL")
-> 0.0005s
== 20210609192728 AddStatusCheckForeignKeyToExternalStatusCheckId: migrated (0.0175s)
Down
== 20210609192728 AddStatusCheckForeignKeyToExternalStatusCheckId: reverting ==
-- remove_foreign_key(:external_status_checks_protected_branches, {:column=>:external_status_check_id})
-> 0.0040s
== 20210609192728 AddStatusCheckForeignKeyToExternalStatusCheckId: reverted (0.0086s)
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.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Max Woolf