Skip to content

Warn about missing feature flag labels

Erick Bajao requested to merge eb-feature-flag-enforcement into master

What does this MR do and why?

Related to verify-stage#425 (closed), as one of the action items for the Pipeline Security FCL.

In this MR, we add non-blocking Dangerbot feature flag enforcement on backend and frontend MRs. To roll this out gradually, we will start with MRs that have label devopsverify.

What this does

  • If Dangerbot sees a newly added or modified feature flag file in the MR changes, it adds the ~"feature flag::exists" label.
  • Dangerbot will then check, does this MR have the ~"feature flag::exists" label:
    • In the case of the MR having touched a feature flag config file, this would then result to no warnings because then we will have ~"feature flag::exists" label.
    • In the case wherein no feature flag config file was touched, Dangerbot will then check if ~"feature flag::skipped" label has been added. A warning will show if the label has not been added.
  • This is only enforced on backend and frontend labeled MRs.

What do we expect from the developer when they see the warning?

The main goal of this warning is to trigger a manual intervention and thought process to ponder upon the presence or need of a flag:

  • If the changes in the MR are already controlled by an existing flag added previously, then the developer will just manually add ~"feature flag::exists".
  • If the changes are trivial or are simple enough that it won't benefit from having a feature flag, then the developer adds the ~"feature flag::skipped" label, and leave a comment on the reason.

What this does not do

  • This is not super smart yet. It can't tell if the feature flag config file changed/added was actually related to the changes in the MR.
  • If an MR has multiple changes that would have needed their own separate flags but only a single flag was added, this would not trigger a warning.

Screenshots

This was tested on a dummy MR (!116568).

Here's what shows when labels are not found:

Screenshot_2023-04-04_at_7.59.18_PM

Here are some screenshots of the feature flag labels added:

Screenshot_2023-04-04_at_8.08.26_PM

Screenshot_2023-04-04_at_8.12.05_PM

Edited by Albert

Merge request reports