Skip to content

manage acls fails if it tries to add permissions to a project bot #1

@hugochinchilla

Description

@hugochinchilla

Hi, I'm having issues with bot accounts created because of access tokens in a project, hurdurr fails with the following message:

$ /bin/hurrdurr -manage-acls  -config config.yaml 
level=info msg="hurrdurr Version: 0.1.6 Commit: cc9a5a250771be615b7473fd91291d10a1043dd2 Date: 2020-04-22T14:22:07+00:00"
Executing Changes:

... redacted output ...

Faile to run action: failed to add user 'project_1119_bot1' to group 'documentation': POST https://gitlab.clarity.ai/api/v4/groups/documentation/members: 400 {message: {user_id: [project bots cannot be added to other groups / projects]}}

I think the problem originates from a piece of config like this:

  product:
    developers:
      - "query: users"

I see at least 3 ways of solving the issue:

  • At the query level, filter out users matching ^project_[\d+]_bot[\d*]$
  • At the action level, filter out users matching the same regex
  • At the client level, recognise the error project bots cannot be added to other groups / projects and trigger a non fatal error that will be logged in the console but will not cause the program to terminate inmediatly.

I want to provide a PR to fix this issue, but I want to ask for what would be your preferred style to fix this issue before starting anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions