Skip to content

Independently infer and apply group and stage labels

The following has been implemented to improve our automatic inference of stage and group labels based on category labels.

The most important rules are:

  • The bot does doesn't change a stage or group label if it's already set.
  • A group label is chosen only if the highest group match from its category labels is > 50%.
  • A group label is chosen only if it matches the already set stage label (if applicable).
  • A stage label is set based on the chosen or already set group label.
  • The bot leaves a message that explains its inference logic.

The complete workflow is shown below:

Workflow

graph LR
A{Stage label is present?} -- Yes --> B
B{Group label is present?} -- Yes --> X1[Nothing to do.]
B -- No --> E
E{Group is detected based on category labels<br>with a match rate > 50% among all category labels?} -- Yes --> H
E -- No --> K
H{Does detected group label matches stage label?} -- Yes --> X2[Set detected group label.]
H -- No --> K
K{Several potential groups in current<br>stage detected from category labels?} -- Yes --> X3[Manual triage required.]
K -- No --> X4[Set default group label based on stage label.]

A -- No --> C
C{Group label is present?} -- Yes --> X5[Set stage label based on group label, we're done!]
C -- No --> G
G{Group is detected based on feature/category labels?} -- Yes --> X6[Set group and stage labels.]
G -- No --> X7[Manual triage required.]

Test cases

Stage label Group label Category labels Team label New labels Bot message Note
~"devops::configure" ~"group::autodevops and kubernetes" ~"wiki" ~"Verify" 🚫 🚫 No new labels.
~"devops::configure" ~"group::autodevops and kubernetes" ~"wiki" 🚫 🚫 🚫 No new labels.
~"devops::configure" ~"group::autodevops and kubernetes" 🚫 ~"Verify" 🚫 🚫 No new labels.
~"devops::configure" ~"group::autodevops and kubernetes" 🚫 🚫 🚫 🚫 No new labels.
devopscreate 🚫 ~"wiki" (100% matching stage) ~"Verify" groupknowledge Setting ~"group::knowledge" based on ~"wiki". Group based on category since category matches stage
devopscreate 🚫 ~"wiki" (100% matching stage) 🚫 groupknowledge Setting ~"group::knowledge" based on ~"wiki". Group based on category since category matches stage
devopscreate 🚫 ~"wiki" ~elasticsearch (100% matching stage, 2 different groups) ~"Verify" groupknowledge 🚫 Manual triage required since the 2 potential groups are conflicting
devopscreate 🚫 ~"wiki" ~elasticsearch (100% matching stage, 2 different groups) 🚫 groupknowledge 🚫 Manual triage required since the 2 potential groups are conflicting
devopscreate 🚫 ~"wiki" ~"design management" analytics (66% matching stage) ~"Verify" groupknowledge Setting ~"group::knowledge" based on ~"design management" ~"wiki". Group based on category since category matches stage
devopscreate 🚫 ~"wiki" ~"design management" analytics (66% matching stage) 🚫 groupknowledge Setting ~"group::knowledge" based on ~"design management" ~"wiki". Group based on category since category matches stage
devopscreate 🚫 ~"wiki" analytics (50% matching stage) ~"Verify" groupknowledge Setting ~"group::knowledge" based on ~"wiki". Group based on category since category matches stage
devopscreate 🚫 ~"wiki" analytics (50% matching stage) 🚫 groupknowledge Setting ~"group::knowledge" based on ~"wiki". Group based on category since category matches stage
devopscreate 🚫 ~"wiki" analytics epics (33% matching stage) ~"Verify" groupknowledge Setting ~"group::knowledge" based on ~"wiki". Group based on category since category matches stage
devopscreate 🚫 ~"wiki" analytics epics (33% matching stage) 🚫 groupknowledge Setting ~"group::knowledge" based on ~"wiki". Group based on category since category matches stage
devopspackage 🚫 ~"design management" (none matching stage) ~"Verify" ~"group::package" Setting ~"group::package" based on ~"devops::package". Group based on stage since category does not match stage
devopspackage 🚫 ~"design management" (none matching stage) 🚫 ~"group::package" Setting ~"group::package" based on ~"devops::package". Group based on stage since category does not match stage
~"devops::configure" 🚫 🚫 ~"Gitaly" ~"group::autodevops and kubernetes" Setting ~"group::autodevops and kubernetes" based on ~"devops::configure". Group based on stage
devopsverify 🚫 🚫 🚫 ~"group::ci and runner" Setting ~"group::ci and runner" based on ~"devops::verify". Default group from stage
🚫 groupsource code ~"design management" markdown ~"Verify" devopscreate Setting ~"devops::create" based on ~"group::source code". Stage based on group
🚫 groupsource code ~"design management" markdown 🚫 devopscreate Setting ~"devops::create" based on ~"group::source code". Stage based on group
🚫 ~"group::memory" 🚫 ~"Gitaly" ~"devops::enablement" Setting ~"devops::enablement" based on ~"group::memory". Stage label based on group
🚫 ~"group::memory" 🚫 🚫 ~"devops::enablement" Setting ~"devops::enablement" based on ~"group::memory". Stage label based on group
🚫 🚫 backend ~"bug" ~"Plan" devopsplan ~"group::team planning" Setting ~"devops::plan" and ~"group::team planning" based on ~"Plan". Stage and group based on team
🚫 🚫 ~"bug" rake tasks 🚫 🚫 🚫 Manual triage required
🚫 🚫 ~"internationalization" (best match: 100%) ~"Verify" devopsmanage ~"group::measure" Setting ~"devops::manage" and ~"group::measure" based on ~"internationalization". Stage and group based on category
🚫 🚫 ~"internationalization" (best match: 100%) 🚫 devopsmanage ~"group::measure" Setting ~"devops::manage" and ~"group::measure" based on ~"internationalization". Stage and group based on category
🚫 🚫 snippets ~"elasticsearch" ~"internationalization" (best match: 66%) ~"Verify" devopscreate ~"group::editor" Setting ~"devops::create" and ~"group::editor" based on ~"elasticsearch" ~"snippets". Stage and group based on category label
🚫 🚫 snippets ~"elasticsearch" ~"internationalization" (best match: 66%) 🚫 devopscreate ~"group::editor" Setting ~"devops::create" and ~"group::editor" based on ~"elasticsearch" ~"snippets". Stage and group based on category label
🚫 🚫 ~"elasticsearch" ~"internationalization" (best match: 50%) ~"Verify" devopsverify ~"group::ci and runner" Setting ~"devops::verify" and ~"group::ci and runner" based on ~"Verify". Stage and group based on team
🚫 🚫 ~"elasticsearch" ~"internationalization" (best match: 50%) 🚫 🚫 🚫 Manual triage required
🚫 🚫 pipeline ~"elasticsearch" ~"internationalization" (best match: 33%) ~"Verify" devopsverify ~"group::ci and runner" Setting ~"devops::verify" and ~"group::ci and runner" based on ~"Verify" Stage and group based on team
🚫 🚫 pipeline ~"elasticsearch" ~"internationalization" (best match: 33%) 🚫 🚫 🚫 Manual triage required
🚫 🚫 ~"backstage" (no match) ~"Verify" devopsverify ~"group::ci and runner" Setting ~"devops::verify" and ~"group::ci and runner" based on ~"Verify" Stage and group based on team
🚫 🚫 ~"backstage" (no match) 🚫 🚫 🚫 Manual triage required
🚫 🚫 insights 🚫 Quality Setting ~"Quality" based on ~"insights". This is handled as a special use-case since Quality is a department (we can do the same for UX).
Quality 🚫 insights 🚫 🚫 🚫 No new labels.

Documentation update can be found at gitlab-com/www-gitlab-com!25161 (merged).

Closes #169 (closed).

Edited by Rémy Coutable

Merge request reports