Repository
Maintenance
Background
There are hundreds of repositories in openEuler community. It is very difficult to maintain all of repositories and the members in every single repository. An automatic tool is wanted to figure out these problems and save the team's workload.
Solution
The infrastucture team have built a mechanism to simplify the repository maintenance.
The repositories and repository members about openEuler are addressed in
openeuler.yaml,
meanwhile the repositories and repository members about src-openEuler are addressed
in src-openeuler.yaml.
If the yaml files are changed by a pull request, the openeuler-ci-bot will detect these changes
and automatically do some actions like create a repository, add members for a repository,
remove members from a repository, add protecting a branch and remove protecting a branch
based on the Gitee API.
How to create a repository
repositories:
- name: abattis-cantarell-fonts
description: "fonts repo"
type: private
If you want to add a new repository into openEuler community, you can modify the openeuler.yaml or src-openeuler.yaml with a pull request with the above example.
-
abattis-cantarell-fonts: the name of the new repository you want to create. -
fonts repo: the description of the new repository. -
private: this represents the repository type.privatemeans the new repository is only visible for some specified people.publicmeans the new repository is public for all of the pepple.
When your pull request is merged, the openeuler-ci-bot will create the new repository immediately.
How to create or remove a member
community:
name: openeuler
managers:
- zhuchunyi
- overweight
developers:
- igorkorkin
viewers:
- jianminw
repositories:
- name: abattis-cantarell-fonts
description: "fonts repo"
type: private
- name: accountsservice
description: "account repo"
type: private
managers:
- dogsheng
developers:
- igorkorkin
viewers:
- jianminw
If you want to add or remove a member in a repository, you can modify the openeuler.yaml or src-openeuler.yaml with a pull request with the above example.
openeuler: the name of the openEuler communtiy which has another namesrc-openeuler, actually it is no need to modify.managers: the managers you want to specify undercommunityor therepositories. The Gitee accounts are needed here, likezhuchunyi.developers: the developers you want to specify undercommunityor therepositories. The Gitee accounts are needed here, likeigorkorkin.viewers: the viewers you want to specify undercommunityor therepositories. The Gitee accounts are needed here, likejianminw.
NOTE: you may find managers, developers and viewers are existing
under community or the repositories in the same time. Let's see the difference between them:
- Usually if you want to add or remove a manager, developer or viewer of all the repositories,
you can modify the
managers,developersandviewersundercommunity. - Specially if you want to add or remove a manager, developer or viewer of a specified repository,
you can modify the
managers,developersandviewersunder the specified repository likeaccountsservice. - If a repository does not specify any member(including
managers,developersandviewers) likeabattis-cantarell-fonts, theopeneuler-ci-botwill usemanagers,developersandviewersundercommunityto create members for this repository likeabattis-cantarell-fonts. - If a repository does specify some members(including
managers,developersandviewers) likeaccountsservice, theopeneuler-ci-botwill usemanagers,developersandviewersunder the repository to create members likeaccountsservice. - If a Gitee account is exsiting in
managers,developersandviewers, this Gitee account will be as a manager, as the permisson in Gitee is likemanagers>developers>viewers.
How to add or remove protecting a branch
community:
name: openeuler
protected_branches:
- master
repositories:
- name: abattis-cantarell-fonts
description: "fonts repo"
type: private
- name: accountsservice
description: "account repo"
protected_branches:
- master
- dev
type: private
If you want to add or remove protecting a branch in a repository, you can modify the openeuler.yaml or src-openeuler.yaml with a pull request with the above example.
openeuler: the name of the openEuler communtiy which has another namesrc-openeuler, actually it is no need to modify.protected_branches: the branches to be protected you want to specify undercommunityor therepositories.
NOTE: you may find protected_branches is existing under community or the repositories in the
same time. Let's see the difference between them:
- Usually if you want to add or remove protecting a branch of all the repositories,
you can modify the
protected_branchesundercommunity. - Specially if you want to add or remove protecting a branch of a specified repository,
you can modify the
protected_branchesunder the specified repository likeaccountsservice. - If a repository does not specify any protected branches like
abattis-cantarell-fonts, theopeneuler-ci-botwill useprotected_branchesundercommunityto add protecting branches for this repository likeabattis-cantarell-fonts. - If a repository does specify some protected branches like
accountsservice, theopeneuler-ci-botwill useprotected_branchesunder the repository to add protecting branches likeaccountsservice. - If the branch specified in
protected_branchesdose not exist,openeuler-ci-botwill do nothing relevant.
How to create or remove a maintainer beyond Gitee
Gitee provides manager, developer and viewer and so forth for the repository permission management.
openeuler-ci-bot supports another way to add maintainers for every repository.
openeuler-ci-bot will scan the OWNERS file under every repository to discovery the extra maintainers.
Take https://gitee.com/openeuler/ci-bot/blob/master/OWNERS under ci-bot as an example.
The file content is like below:
maintainers:
- edisontest
- freesky-edward
- TommyLike
- xiangxinyong
- zerodefect
It means all of these five users have the permission to merge the pull request in the ci-bot repository.
These users can use /lgtm and /approve commands to trigger openeuler-ci-bot to merge the pull request.
You can find more bot commands from https://gitee.com/openeuler/community/blob/master/en/command.md
By the way, all of the managers and developers in Gitee can also use /lgtm and /approve.
If you want to keep maintainers beyond Gitee, please add the OWNERS file under your repository,
and add the maintainer into the OWNERS file, openeuler-ci-bot will grant the merge permission to these maintainers.