GitLab/Policy

From mediawiki.org

This page describes intended policy for GitLab. It covers topics like the expected layout of projects, access control, administrative privileges, enabled features, and expectations of users.

This is a work in progress, and will naturally evolve as we migrate projects to GitLab. Substantive changes should be made in collaboration with the Wikimedia Release Engineering Team and affected users. Feel free to ask questions in #wikimedia-gitlab connect on libera.chat, tagged with the Gitlab project on Phabricator, or on the talk page here.

Project layout[edit]

Users[edit]

A user is a unique identifier for a person identified by an email. Each user has a unique username. A user's username is also a unique top-level namespace in GitLab.

All users login to GitLab with their LDAP developer accounts. A user's display name is their LDAP cn (as is the case with Gerrit), while usernames (which determine profile URLs) are uid, matching shell names. This avoids using ReCaptcha software for account creation.

Users with Developer privileges (or above) outside of their personal namespaces—those who merge code—must have two-factor authentication enabled on their account.

Namespace Groups[edit]

Groups are local to the GitLab instance. Groups can act as containers for subgroups.

All officially-supported projects live in the top-level repos namespace, where they are allocated a pool of job runners for CI. Subgroups of repos act as namespaces for projects, as well as modeling contributor access to those projects. These should be reserved for large functional areas that encompass projects. Although it may be similar, this is not the same thing as a team or organizational unit, since the team responsible for a code project may change.

For example, repos/mediawiki is a namespace group that can contain the project repos/mediawiki/core. More layers of group nesting may be useful. For example, a repos/mediawiki/extensions namespace group is a subgroup of the repos/mediawiki namespace group and may contain MediaWiki extensions.

mediawiki/
├── [core]
├── extensions
│   ├── [extension1]
│   ├── [extension2]
│   └── [extension3]
├── libs
│   ├── [library1]
│   ├── [library2]
│   └── [library3]
├── skins
│   ├── [skin1]
│   ├── [skin2]
│   └── [skin3]
├── tools
│   ├── [tool1]
│   ├── [tool2]
│   └── [tool3]
└── [vendor]

Membership / ownership[edit]

Individual users should be added as privileged members of namespace groups.

For most small groups of projects, it is appropriate for collaborators to own the group and self-manage access for other collaborators. For larger and higher-risk groups such as the planned /repos/mediawiki, it may be necessary to define a stricter access scheme with more than one level of access.

Projects[edit]

Projects are collaborative digital spaces to write, review, test, merge, and browse code in GitLab. A project corresponds to a Git repository. Projects belong to either an individual user (for example thcipriani/train-stats) or a namespace group under /repos (for example repos/releng/dev-images).

Permissions[edit]

Projects have features that contain specific permissions.

To ensure everyone can contribute, projects should allow "Everyone with Access" to create merge requests. This is a setting for each repository under "Settings" > "General" > "Visibility, project features, permissions" > "Repository". This will allow all users to create merge requests for a project.

Membership[edit]

In general, project membership should be inherited from a containing namespace group that models a functional area of code, as described in #Membership_/_ownership.

Projects may also have individual members with privileges. Project members are users or, potentially, user groups. For specific forms of collaboration it may appropriate to add individual users as privileged project members.

Namespace inheritance[edit]

Projects belong to namespace groups. Namespace groups may contain members. Members of a namespace are also members of a project in that namespace. For example, if you are a member of the repos/mediawiki namespace group you will also be a member of the repos/mediawiki/core project.

Privileges[edit]

This section borrows text from Gerrit/Privilege_policy

Groups in GitLab contain members. These members have one of 5 roles:

  • Guest
  • Reporters
  • Developers
  • Maintainers
  • Owners

You can read more about permissions in the upstream GitLab permission documentation. GitLab allows you to build a permission model by policy. Our policy is outlined on this page.

Any user should be able to create or comment on a merge request. Reporters can run tests for a given project. Developers can create branches on the project to use for merge-requests in the work namespace. Developers can also approve and merge code for a project. Maintainers can reconfigure a project, change privileges, and update merge and squash options. Owners can delete and rename projects.

Developers and Maintainers can approve and merge their own merge requests similar to a self-+2 in Gerrit. Self-merge is discouraged by policy. Merging your own code without approval from a reviewer may be grounds for revocation of privileges.

Merging a change to the MediaWiki core or an extension deployed by Wikimedia is a big deal. Your merge could cause Wikipedia or other sites to fail. It could create a security vulnerability that allows attackers to delete or corrupt data, or to gain access to private information. And in the more common case, it could cause technical debt to increase if the code doesn't have tests, is poorly implemented or poorly socialized. You should carefully read this document and all relevant policies before merging a merge request.

Maintainer permissions are a strong expression of trust, and trust is maintained through good judgement and careful action.

In code review, design discussions, and bug comments, those with merge abilities have a special responsibility to see from others' points of view.

User groups may be used in the future[edit]

When GitLab project migration began, Release Engineering assumed that groups of users would be the best way to model membership in projects. For a number of reasons, this proved impractical. See GitLab: Rethinking how we handle access control for some reasoning about this. Nevertheless, the /people namespace is reserved for possible future use where appropriate.

Groups in GitLab can contain members. Members of a group are individual users or other groups. User groups can be useful models of real world associations of people.

Examples of useful abstractions that could be user groups are teams (for example people/wmf-team-release-engineering) and volunteer project maintainers (for example people/volunteer-group-cloud-admin).

Any defined user groups should be kept under the top-level namespace group /people. If the purpose of a group is to model a real-world group then a subgroup under the people namespace is appropriate.

people
├── trusted-contributors
├── wmde-team-foo
├── volunteer-group-bar
└── wmf-team-baz

User groups may fulfill a number of purposes:

  1. To ease onboarding/offboarding for groups of collaborators
  2. To enforce user policy (e.g., 2fa) at the group level
  3. To model some amount of organizational structure to be independently of project layout, and allow it to change without re-arranging project groups

Project Features[edit]

Private repositories[edit]

Private repositories are currently disallowed, with the exception of some experimental security workflows. This reflects the status quo from Gerrit.

Issue tracking and wikis[edit]

Phabricator is used for issue tracking, bug reports, and project management in Wikimedia technical spaces. Use of GitLab for issue tracking was considered out of scope during the GitLab consultation (see GitLab consultation#FAQ). Accordingly, to avoid confusion, fragmentation, and administrative overhead, GitLab issues and wikis are disabled on the Wikimedia instance.

Job runners[edit]

Users may configure self-service job runners for individual projects.

Administration[edit]

Users may be set to an admin status. Application-level administrative privileges are held by:

  • Members of the Wikimedia Foundation Release Engineering team, for servicing most application-level administrative tasks and technical support requests.
  • Relevant members of the WMF ServiceOps team, for addressing infrastructure-level concerns.

wikitech:GitLab houses documentation on GitLab infrastructure and SRE-related topics.