Faster GitLab authz
There are currently no pipelines.
To run a merge request pipeline, the jobs in the CI/CD configuration file must be configured to run in merge request pipelines and you must have sufficient permissions in the source project.
Created by: beyang
Fixes https://github.com/sourcegraph/sourcegraph/issues/2007
The first commit makes the actual change. Subsequent commits update unit tests.
This makes GitLab permissions fetching use the same general strategy as we use for GitHub. GitLab has 3 levels of project (a GitLab project is analogous to a GitHub repo): public, internal, and private. Public projects are accessible to anyone, including unauthenticated requests. Internal projs are accessible to any authenticated user. Private projs are subject to permissions. We cache the following pieces of information:
This results in much better performance, because we don't have to block on fetching a user's entire list of accessible projects. Instead, we make at most 2 API requests for each project being accessed, the first to determine if the project is public/internal (GetProject
), the second to determine if a private project is accessible to the current user (ListTree
).
To run a merge request pipeline, the jobs in the CI/CD configuration file must be configured to run in merge request pipelines and you must have sufficient permissions in the source project.