Add danger bot rules for stable branches
🔎 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 into15-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:
Trying to merge a change into a qualified version (15.4) but with a typefeature label:
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
- Checkout this branch
- Copy the commit sha
- Checkout a stable branch (for example
15-3-stable-ee
) - Create a new branch from the stable branch (
git new branch test123
) - Cherry pick the commit to get the new danger rules on that branch (
git cherry-pick <sha>
) - Push the changes to your new branch.
- Create a merge request targeting the stable branch that you branched off of.
- In the merge request, add typefeature label to see the feature error
- In the merge request, add typebug label and rerun the Danger job to see the error disappear.
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to: gitlab-com/gl-infra/delivery#2691 (closed)