Skip to content

Codeowners seems to exhibit flaky behavior when a project token bot is present

Summary

Codeowners seems to exhibit flaky behavior when a project token bot is present

Steps to reproduce

I don't have completely reliable repro instructions, because it appears to be flaky. I don't know which of these details is the important one, so I'm providing what I have.

However, this describes as much of the complete scenario as I can think of:

  1. Create a project bot token. We'll call this bot user @project_12600_bot1
  2. Create a complex codeowner file:
[BOT OR ADMIN]
* @admin-group1 @admin-group2 @project_12600_bot1

[ADMIN]
* @admin-group1 @admin-group2
/no-admin-required/
/no-admin-required-file

[SERVICE OWNER OR ADMIN]
/no-admin-required/path1/ @admin-group1 @admin-group2 @user-group1 @user-group2 user1@example.com
/no-admin-required/path2/ @admin-group1 @admin-group2 @user-group3 @user-group4 user2@example.com

^[SERVICE OWNER]
/included/path1/ @user-group1 @user-group2 user1@example.com
/included/path2/ @user-group3 @user-group4 user2@example.com
  1. Land codeowners in main branch.
  2. Submit an MR

Example Project

The example project is on our internal instance.

What is the current bug behavior?

When we submit the MR, it it seemingly random whether the project token bot appears under Approvers / BOT OR ADMIN; sometimes it does, sometimes it doesn't. So far I haven't noticed a pattern. When the bot approves the MR, they show up under "Approved by" at the top, but they don't show up under "Approved by" in the column alongside BOT OR ADMIN

What is the expected correct behavior?

The bot should be able to approve under the codeowners section it was added to.

Relevant logs and/or screenshots

As far as I know, gitlab doesn't output any logs on codeowners parse actions.

Output of checks

I unfortunately don't have access to this information. The behavior was showing up under {"version":"14.10.5-ee","revision":"af6735ad95f"} and our admins just upgraded to {"version":"15.1.5-ee","revision":"0c79d82b990"} so I don't have a good sense for how the bug might have changed yet.

Possible fixes

If I had to guess, it'd be some interaction between project tokens and the codeowners parse.