Skip to content

Add danger bot rules for stable branches

Steve Abrams requested to merge delivery2691-danger-stable-branches into master

🔎 What does this MR do and why?

The delivery team is working on extending the mainenance policy for patch releases. We are going to be allowing developers to create MRs targeting stable branches (previous versions) similar to what we do for security releases. This MR adds some new Danger rules for MRs targeting these branches as described in gitlab-com/gl-infra/delivery#2691 (closed).

The rules are:

If

  • The MR is targeting a qualified stable branch (one of the last 3 minor versions)
  • Is on the canonical repo (in other words, not a security MR)
  • Not targeting a preparation branch (looks like a stable branch, but with an additional suffix, for example 15-4-stable-ee-patch-2)

Danger bot should fail if the MR:

  • Is labeled with type::feature
  • Is not labeled with type::bug
  • Targets a branch with a version older than the last 3 minor versions, e.g. merging to 15-5-stable-ee is okay, but merging into 15-1-stable-ee is not.

📸 Screenshots or screen recordings

Trying to merge a change into a non-qualified version (15.3) and without a typebug label:

Screen_Shot_2022-11-23_at_9.57.35_AM

Trying to merge a change into a qualified version (15.4) but with a typefeature label:

Screen_Shot_2022-11-23_at_10.10.17_AM

Trying to merge a change into a qualified security version with a typefeature label (results in no errors):

💻 How to set up and validate locally

  1. Checkout this branch
  2. Copy the commit sha
  3. Checkout a stable branch (for example 15-3-stable-ee)
  4. Create a new branch from the stable branch (git new branch test123)
  5. Cherry pick the commit to get the new danger rules on that branch (git cherry-pick <sha>)
  6. Push the changes to your new branch.
  7. Create a merge request targeting the stable branch that you branched off of.
  8. In the merge request, add typefeature label to see the feature error
  9. In the merge request, add typebug label and rerun the Danger job to see the error disappear.
  10. If you are targeting an unqualified branch (15.3 or earlier at the time of this writing), you will see the error for targeting an unqualified version.

🛃 MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to: gitlab-com/gl-infra/delivery#2691 (closed)

Edited by Steve Abrams

Merge request reports